]> bbs.cooldavid.org Git - net-next-2.6.git/commit
oprofile/x86: protect cpu hotplug sections
authorRobert Richter <robert.richter@amd.com>
Thu, 29 Apr 2010 12:55:55 +0000 (14:55 +0200)
committerRobert Richter <robert.richter@amd.com>
Tue, 4 May 2010 09:37:56 +0000 (11:37 +0200)
commit6ae56b55bc364bc2f2342f599b46581627ba22da
tree0457732ebc2827aeb976881345e620c656fbb338
parent216f3d9b4e5121feea4b13fae9d4c83e8d7e1c8a
oprofile/x86: protect cpu hotplug sections

This patch reworks oprofile cpu hotplug code as follows:

Introduce ctr_running variable to check, if counters are running or
not. The state must be known for taking a cpu on or offline and when
switching counters during counter multiplexing.

Protect on_each_cpu() sections with get_online_cpus()/put_online_cpu()
functions. This is necessary if notifiers or states are
modified. Within these sections the cpu mask may not change.

Switch only between counters in nmi_cpu_switch(), if counters are
running. Otherwise the switch may restart a counter though they are
disabled.

Add nmi_cpu_setup() and nmi_cpu_shutdown() to cpu hotplug code. The
function must also be called to avoid uninitialzed counter usage.

Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/x86/oprofile/nmi_int.c