CPUidle: increment state counter for state actually entered
PATCH 1/1 CPUidle: increment state counter for state actually entered
Currently, the count for state that the governor chooses is always incremented after the 'state_enter' hook is called. However, the target's enter hook may choose a different state based on BM activity or other factors.
This patch does the accounting use 'dev->last_state' state instead of the governor-chosen state. If the target's enter_idle hook enters a different state than it was asked, it should update dev->last_state.
--- drivers/cpuidle/cpuidle.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/cpuidle/cpuidle.c +3 -3
@@ -67,10 +67,10 @@ static void cpuidle_idle_call(void) target_state = &dev->states[next_state];/* enter the state and update stats */ - dev->last_residency = target_state->enter (dev, target_state); dev->last_state = target_state; - target_state->time += (unsigned long long )dev->last_residency; - target_state->usage++; + dev->last_residency = target_state->enter (dev, target_state); + dev->last_state->time += (unsigned long long )dev->last_residency; + dev->last_state->usage++;/* give the governor an opportunity to reflect on the outcome */ if (cpuidle_curr_governor->reflect)
Signature · 1 line
1.6.0
Quoted 9 lines · Kevin Hilman
Currently, the count for state that the governor chooses is always incremented after the '
state_enter' hook is called. However, the target's enter hook may choose a different state based on BM activity or other factors.This patch does the accounting use '
dev->last_state' state instead of the governor-chosen state. If the target'senter_idlehook enters a different state than it was asked, it should updatedev->last_state.
Oops, I sent this before I saw Venkatesh's earlier patch to do the same.
Kevin
Quoted 24 lines
--- drivers/cpuidle/cpuidle.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/cpuidle/cpuidle.c +3
-3@@ -67,10 +67,10 @@ static void cpuidle_idle_call(void) target_state = &dev->states[next_state];/* enter the state and update stats */ - dev->last_residency = target_state->enter (dev, target_state); dev->last_state = target_state; - target_state->time += (unsigned long long )dev->last_residency; - target_state->usage++; + dev->last_residency = target_state->enter (dev, target_state); + dev->last_state->time += (unsigned long long )dev->last_residency; + dev->last_state->usage++;/* give the governor an opportunity to reflect on the outcome */ if (cpuidle_curr_governor->reflect)Signature · 1 line
1.6.0
Quoted 7 lines
[email protected]] On Behalf Of Kevin Hilman
Sent: Wednesday, October 01, 2008 5:47 AMThis patch does the accounting use '
dev->last_state' state instead of the governor-chosen state. If the target'senter_idlehook enters a different state than it was asked, it should updatedev->last_state.
Isn't this the same as the patch Venki pushed on the pm list? I've been using a version of it for a while from him and haven't seen any issue.
I had also done a version which was much more evasive. In the version I was hacking at I tried to push the aborted state information back into the governor as it locally caches the last state tried.
Doing this simpler way like in patch does make sure the accounting is correct which is a plus, powertop doesn't 'lie' any more. It however, does not stop a following likely mis-prediction based on the local state kept in the governor.
Doing at least this much is necessary. However, if you don't want to feed the false state data into the predictor more linkage has to be done.
Regards,
Richard W.
As noted in PM minisummit notes here
http://lwn.net/Articles/292447/
Richard Woodruff <[email protected]> reported a bug
"the CPUIDLE bug that if target is avoided due to BM activity the original target state is still accounted the time."
Following provides a mechanism to fix the problem for all drivers and fixes the problem for acpi cpuidle driver.
--
_______________________________________________
linux-pm mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Quoted 7 lines
[email protected]] On Behalf Of Kevin Hilman
Sent: Wednesday, October 01, 2008 5:47 AMThis patch does the accounting use '
dev->last_state' state instead of the governor-chosen state. If the target'senter_idlehook enters a different state than it was asked, it should updatedev->last_state.
Isn't this the same as the patch Venki pushed on the pm list? I've been using a version of it for a while from him and haven't seen any issue.
I had also done a version which was much more evasive. In the version I was hacking at I tried to push the aborted state information back into the governor as it locally caches the last state tried.
Doing this simpler way like in patch does make sure the accounting is correct which is a plus, powertop doesn't 'lie' any more. It however, does not stop a following likely mis-prediction based on the local state kept in the governor.
Doing at least this much is necessary. However, if you don't want to feed the false state data into the predictor more linkage has to be done.
Regards,
Richard W.
As noted in PM minisummit notes here
http://lwn.net/Articles/292447/
Richard Woodruff <[email protected]> reported a bug
"the CPUIDLE bug that if target is avoided due to BM activity the original target state is still accounted the time."
Following provides a mechanism to fix the problem for all drivers and fixes the problem for acpi cpuidle driver.
--