Commit 96366a8d authored by Tony Breeds's avatar Tony Breeds Committed by Paul Mackerras

[POWERPC] Update wait_state_cycles in the VPA

The hypervisor can look at the value in the wait_state_cycles field of
the VPA for an estimate of how busy dedicated processors are.
Currently, as the kernel never touches this field, we appear to be
100% busy.  This records the duration the kernel is in powersave and
passes that to the HV to provide a reasonable indication of
utilisation.
Signed-off-by: default avatarTony Breeds <tony@bakeyournoodle.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 71e91a0a
...@@ -393,6 +393,7 @@ static void pseries_dedicated_idle_sleep(void) ...@@ -393,6 +393,7 @@ static void pseries_dedicated_idle_sleep(void)
{ {
unsigned int cpu = smp_processor_id(); unsigned int cpu = smp_processor_id();
unsigned long start_snooze; unsigned long start_snooze;
unsigned long in_purr, out_purr;
/* /*
* Indicate to the HV that we are idle. Now would be * Indicate to the HV that we are idle. Now would be
...@@ -400,6 +401,7 @@ static void pseries_dedicated_idle_sleep(void) ...@@ -400,6 +401,7 @@ static void pseries_dedicated_idle_sleep(void)
*/ */
get_lppaca()->idle = 1; get_lppaca()->idle = 1;
get_lppaca()->donate_dedicated_cpu = 1; get_lppaca()->donate_dedicated_cpu = 1;
in_purr = mfspr(SPRN_PURR);
/* /*
* We come in with interrupts disabled, and need_resched() * We come in with interrupts disabled, and need_resched()
...@@ -432,6 +434,8 @@ static void pseries_dedicated_idle_sleep(void) ...@@ -432,6 +434,8 @@ static void pseries_dedicated_idle_sleep(void)
out: out:
HMT_medium(); HMT_medium();
out_purr = mfspr(SPRN_PURR);
get_lppaca()->wait_state_cycles += out_purr - in_purr;
get_lppaca()->donate_dedicated_cpu = 0; get_lppaca()->donate_dedicated_cpu = 0;
get_lppaca()->idle = 0; get_lppaca()->idle = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment