Skip to content

feat(linux): s2idle: Document the mode selection logic#641

Open
DhruvaG2000 wants to merge 2 commits intoTexasInstruments:masterfrom
DhruvaG2000:s2idle_mode_sel_v1
Open

feat(linux): s2idle: Document the mode selection logic#641
DhruvaG2000 wants to merge 2 commits intoTexasInstruments:masterfrom
DhruvaG2000:s2idle_mode_sel_v1

Conversation

@DhruvaG2000
Copy link
Copy Markdown
Collaborator

Document the mode selection logic using the s2idle flow

Copy link
Copy Markdown
Contributor

@kwillis01 kwillis01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to see if there are other places in the previous parts of the doc that can be updated or that the new info can loop into and consolidate.

Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Copy link
Copy Markdown
Contributor

@kwillis01 kwillis01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly looks good, I think that the QoS Latency Constraints and Mode Selection section needs to be fixed up to flow better and be a little more condensed.

Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
@kwillis01
Copy link
Copy Markdown
Contributor

Additionally, could you update the RTC + DDR section in pm_am62lx_low_power_modes.rst with the updated commands needed to enter RTC + DDR? Then you can point to this page from there if the user wants an indepth explanation on s2idle

@github-actions
Copy link
Copy Markdown

New warnings found with rstcheck:

source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst:537: (ERROR/3) Content block expected for the "note" directive; none found.
source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst:538: (WARNING/2) Explicit markup ends without a blank line; unexpected unindent.

Comment thread source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst Outdated
Comment on lines +697 to +704
printf("QoS set to %s. Press Ctrl+C to exit.\n", LATENCY_VAL);

while (keep_running)
sleep(1);

close(fd);
printf("Released.\n");
return 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we holding this process open with an aggressive loop? There's nothing in the kernel docs that says the value is dropped when the FD is released.

Copy link
Copy Markdown
Collaborator Author

@DhruvaG2000 DhruvaG2000 Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaticRocket kernel source code is the kernel documentation ;)
See kernel/power/qos.c: file_operations cpu_wakeup_latency_qos_fops --> cpu_wakeup_latency_qos_release

Copy link
Copy Markdown
Member

@StaticRocket StaticRocket Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, why not use pause instead of locking a thread at 100% or sleeping an arbitrary amount of time?

Actually you already setup part of your signal handler. Might as well go all the way.
https://sourceware.org/glibc/manual/latest/html_mono/libc.html#Sigsuspend

Copy link
Copy Markdown
Collaborator Author

@DhruvaG2000 DhruvaG2000 Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StaticRocket Can we revisit this improvement in future? Right now the focus was on the rest of the docs introducing s2idle based mode selection. How we do it can always be in multiple ways.
However I completely appreciate the input, I need to read up a bit on sigsuspend to understand it's benefit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Just seen too many people take the examples at face value.

@github-actions
Copy link
Copy Markdown

New warnings found with rstcheck:

source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst:505: (ERROR/3) Content block expected for the "note" directive; none found.
source/linux/Foundational_Components/Power_Management/pm_psci_s2idle.rst:506: (WARNING/2) Explicit markup ends without a blank line; unexpected unindent.

Document the mode selection logic using the s2idle flow

Signed-off-by: Dhruva Gole <d-gole@ti.com>
Add mention of the s2idle based mode selection being part of
low power mode support as of this release

Signed-off-by: Dhruva Gole <d-gole@ti.com>
@DhruvaG2000 DhruvaG2000 changed the title [RFC] feat(linux): s2idle: Document the mode selection logic feat(linux): s2idle: Document the mode selection logic Apr 24, 2026
@DhruvaG2000 DhruvaG2000 marked this pull request as ready for review April 24, 2026 12:39
@DhruvaG2000 DhruvaG2000 requested a review from cshilwant as a code owner April 24, 2026 12:39
Copy link
Copy Markdown
Contributor

@kwillis01 kwillis01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to put explicit instructions on how to enter RTC + DDR via s2idle (besides the constraint setting) in pm_am62lx_low_power_modes. It would give users a quick way to grab the instructions and go.

If regular [mem] interface is selected in `/sys/power/mem_sleep`, the RTC Only + DDR low power mode requires special steps
to enter. The steps are documented in :ref:`am62l_suspend_workarounds`.

RTC Only Plus DDR
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this moved? The note added should be in the RTC + DDR section not before it.

Please go through the s2idle docs to understand how to select between multiple low power modes.
The steps and overall architecture/ sequence diagrams are documented in :ref:`pm_s2idle_psci`.
The default mode via s2idle is RTC Only Plus DDR, since it's the deepest.
If regular [mem] interface is selected in `/sys/power/mem_sleep`, the RTC Only + DDR low power mode requires special steps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we supporting users to use the work around as well as s2idle?

3. Only idle states with ``exit-latency-us + entry-latency-us`` ≤ constraint are considered
4. The deepest eligible state is selected

**Selecting Specific Low-Power Modes:**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make an explicit mention of /dev/cpu_wakeup_latency here? I think it would be confusing to someone reading this section where QoS constraint is set, but which one?


Execute this in a subshell to avoid accidentally keeping it open indefinitely.

**How It Sets QoS Constraints:**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explanation in this section would make more sense under the How QoS Constraints Work section. Explaining this constraint AFTER giving an example with it doesn't make much sense. This explanation would help set the stage for the examples given in this section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants