powerpc/perf_counter: Make sure PMU gets enabled properly
authorPaul Mackerras <paulus@samba.org>
Wed, 14 Jan 2009 02:44:19 +0000 (13:44 +1100)
committerPaul Mackerras <paulus@samba.org>
Wed, 14 Jan 2009 02:44:19 +0000 (13:44 +1100)
commit01d0287f068de2934109ba9b989d8807526cccc2
tree31e49140ecc61fd158dbd8d4e9f58358d7f84197
parentdd0e6ba22ea21bcc2c420b385a170593c58f4c08
powerpc/perf_counter: Make sure PMU gets enabled properly

This makes sure that we call the platform-specific ppc_md.enable_pmcs
function on each CPU before we try to use the PMU on that CPU.  If the
CPU goes off-line and then on-line, we need to do the enable_pmcs call
again, so we use the hw_perf_counter_setup hook to ensure that.  It gets
called as each CPU comes online, but it isn't called on the CPU that is
coming up, so this adds the CPU number as an argument to it (there were
no non-empty instances of hw_perf_counter_setup before).

This also arranges to set the pmcregs_in_use field of the lppaca (data
structure shared with the hypervisor) on each CPU when we are using the
PMU and clear it when we are not.  This allows the hypervisor to optimize
partition switches by not saving/restoring the PMU registers when we
aren't using the PMU.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/perf_counter.c
kernel/perf_counter.c