Skip to content

Conversation

decsny
Copy link
Member

@decsny decsny commented Oct 7, 2025

There is some incoherency about the meaning of the timing properties in the power-state binding. Improve the documentation and also fill out the binding to finish matching linux https://www.kernel.org/doc/Documentation/devicetree/bindings/cpu/idle-states.yaml as it was currently an incomplete match. More importantly, remove the check for "power state consistency" as it was in disagreement (inconsistent if you will) with the actual code of the default policy manager. The check considered min-residency-us as including exit-latency-us whereas the zephyr code and linux binding consider them as totally separate values.

Copy link
Contributor

@mbolivar mbolivar left a comment

Choose a reason for hiding this comment

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

No objection to the bindings changes


description: Properties for power management state
description: |
Properties for power management idle states. Note that not all of the timing properties will
Copy link
Contributor

Choose a reason for hiding this comment

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

Nonblocking, but would you mind wrapping this to 80 columns? It will look better if we can avoid horizontal scrolling on the generated DT bindings index page for this, and that's more likely if the text is wrapped to a smaller column limit IMO.

| /-- IDLE1
e | /---
n | /----
e | /---
Copy link
Contributor

Choose a reason for hiding this comment

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

Beautiful ASCII art!

Copy link
Member Author

Choose a reason for hiding this comment

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

It's not mine, I took it from the Linux binding

Copy link
Contributor

Choose a reason for hiding this comment

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

Is BSD 2-Clause compatible with Apache 2.0?

Copy link
Member Author

@decsny decsny Oct 7, 2025

Choose a reason for hiding this comment

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

https://www.apache.org/legal/resolved.html#category-a

But maybe you are right that I forgot to update the copyright of this file, if ASCII art falls under copyright and software licensing

As for generally following the DT binding of Linux , if using the same DT properties and so on is "redistribution" or whatever and it's not compatible then we were already in trouble a long time ago because we have been trying to do that with pretty much all DT bindings. And a lot of the descriptions of bindings have been taken from Linux.

Minimum residency duration in microseconds. It is the minimum time for a
given idle state to be worthwhile energywise. It includes the time to enter
in this state.
into this state and the time spent in the state before exiting. It represents
Copy link
Contributor

Choose a reason for hiding this comment

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

and the time spent in the state before exiting is a bit awkward IMO

If we reworded the whole thing:

-       Minimum residency duration in microseconds. It is the minimum time for a
-       given idle state to be worthwhile energywise. It includes the time to enter
-       into this state and the time spent in the state before exiting. It represents
-       the "break-even" time to justify the time and power spent
-       on the work needed for entering the state based on how much actual energy is saved
-       once in the state.
+       Minimum residency duration in microseconds.
+
+       How much time the residency in a given idle state must last for state entry
+       to be worthwhile energywise. It includes the time to enter into this state
+       and represents the "break-even" time to justify the time and power spent
+       on the work needed for entering the state based on how much actual energy
+       is saved once in the state.

Copy link
Member

Choose a reason for hiding this comment

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

I think the suggestion is clear.

Comment on lines 89 to 96
Maximum delay between the signaling of a wake-up event and the CPU
being able to execute normal code again. If unspecified, it is assumed
to be entry-latency-us + exit-latency-us, which would be the worst case.
But the actual wakeup latency may be lower as the intended meaning
of this value is actually
"exit-latency-us + entry-latency-us - 'software prep latency us'"
because the software prep happening before hardware gets committed
to the idle state could theoretically be aborted.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe making the prep time appear on the timeline diagram would help, that's a bit harsh to understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

it is on the diagram

@ceolin
Copy link
Member

ceolin commented Oct 7, 2025

The changes look pretty good do me :) Just the licensing thing concerns me.

@mbolivar
Copy link
Contributor

mbolivar commented Oct 7, 2025

Just the licensing thing concerns me.

I agree, please fix this @decsny

decsny added 2 commits October 7, 2025 13:35
Clarify the min-residency-us property meaning.

Signed-off-by: Declan Snyder <[email protected]>
This check is totally wrong, min-residency-us and exit-latency-us are
not related to each other at all except that the end of the residency
period occurs when the exit starts, so they are totally orthogonal
values and should not be checking if one is less than the other or
anything like this. Even in the code for the default policy manager,
they are added together, so this check is incompatible / in disagreement
with that code, so it should be removed.

Signed-off-by: Declan Snyder <[email protected]>
@decsny decsny force-pushed the idle_states_binding_match branch from 60dc9db to 3b68396 Compare October 7, 2025 18:36
@decsny decsny changed the title Zephyr,power-state match to linux binding and remove incoherent "consistency" check which was not consistent Zephyr,power-state clarify min-residency-us and remove incoherent "consistency" check which was not consistent Oct 7, 2025
@decsny
Copy link
Member Author

decsny commented Oct 7, 2025

I updated the PR to remove the new properties and diagrams since the software license of the ASCII art was controversial, and we aren't using the properties yet anyways. The main motivation of this PR really was to remove the inconsistent check about the min-residency-us and clarify the property anyways.

Copy link

sonarqubecloud bot commented Oct 7, 2025

@cfriedt cfriedt merged commit 74d715c into zephyrproject-rtos:main Oct 9, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants