Skip to content

Commit

Permalink
[POWERPC] Update wait_state_cycles in the VPA
Browse files Browse the repository at this point in the history
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: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Tony Breeds authored and Paul Mackerras committed Mar 25, 2008
1 parent 71e91a0 commit 96366a8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,15 @@ static void pseries_dedicated_idle_sleep(void)
{
unsigned int cpu = smp_processor_id();
unsigned long start_snooze;
unsigned long in_purr, out_purr;

/*
* Indicate to the HV that we are idle. Now would be
* a good time to find other work to dispatch.
*/
get_lppaca()->idle = 1;
get_lppaca()->donate_dedicated_cpu = 1;
in_purr = mfspr(SPRN_PURR);

/*
* We come in with interrupts disabled, and need_resched()
Expand Down Expand Up @@ -432,6 +434,8 @@ static void pseries_dedicated_idle_sleep(void)

out:
HMT_medium();
out_purr = mfspr(SPRN_PURR);
get_lppaca()->wait_state_cycles += out_purr - in_purr;
get_lppaca()->donate_dedicated_cpu = 0;
get_lppaca()->idle = 0;
}
Expand Down

0 comments on commit 96366a8

Please sign in to comment.