diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-12-26 17:11:35 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-12-26 17:11:35 +0100 |
commit | bd361f5de2b338218c276d17a510701a16075deb (patch) | |
tree | e0d60ab13fd29d7a56131c9364c9b53baba4940a /drivers/oprofile/nmi_timer_int.c | |
parent | [media] s5k4ecgx: select CRC32 helper (diff) | |
parent | Linux 4.10-rc1 (diff) | |
download | linux-bd361f5de2b338218c276d17a510701a16075deb.tar.xz linux-bd361f5de2b338218c276d17a510701a16075deb.zip |
Merge tag 'v4.10-rc1' into patchwork
Linux 4.10-rc1
* tag 'v4.10-rc1': (11427 commits)
Linux 4.10-rc1
powerpc: Fix build warning on 32-bit PPC
avoid spurious "may be used uninitialized" warning
mm: add PageWaiters indicating tasks are waiting for a page bit
mm: Use owner_priv bit for PageSwapCache, valid when PageSwapBacked
ktime: Get rid of ktime_equal()
ktime: Cleanup ktime_set() usage
ktime: Get rid of the union
clocksource: Use a plain u64 instead of cycle_t
irqchip/armada-xp: Consolidate hotplug state space
irqchip/gic: Consolidate hotplug state space
coresight/etm3/4x: Consolidate hotplug state space
cpu/hotplug: Cleanup state names
cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions
staging/lustre/libcfs: Convert to hotplug state machine
scsi/bnx2i: Convert to hotplug state machine
scsi/bnx2fc: Convert to hotplug state machine
cpu/hotplug: Prevent overwriting of callbacks
x86/msr: Remove bogus cleanup from the error path
bus: arm-ccn: Prevent hotplug callback leak
...
Diffstat (limited to 'drivers/oprofile/nmi_timer_int.c')
-rw-r--r-- | drivers/oprofile/nmi_timer_int.c | 58 |
1 files changed, 19 insertions, 39 deletions
diff --git a/drivers/oprofile/nmi_timer_int.c b/drivers/oprofile/nmi_timer_int.c index 9559829fb234..e65a576e4032 100644 --- a/drivers/oprofile/nmi_timer_int.c +++ b/drivers/oprofile/nmi_timer_int.c @@ -59,25 +59,16 @@ static void nmi_timer_stop_cpu(int cpu) perf_event_disable(event); } -static int nmi_timer_cpu_notifier(struct notifier_block *b, unsigned long action, - void *data) +static int nmi_timer_cpu_online(unsigned int cpu) { - int cpu = (unsigned long)data; - switch (action) { - case CPU_DOWN_FAILED: - case CPU_ONLINE: - nmi_timer_start_cpu(cpu); - break; - case CPU_DOWN_PREPARE: - nmi_timer_stop_cpu(cpu); - break; - } - return NOTIFY_DONE; + nmi_timer_start_cpu(cpu); + return 0; +} +static int nmi_timer_cpu_predown(unsigned int cpu) +{ + nmi_timer_stop_cpu(cpu); + return 0; } - -static struct notifier_block nmi_timer_cpu_nb = { - .notifier_call = nmi_timer_cpu_notifier -}; static int nmi_timer_start(void) { @@ -103,13 +94,14 @@ static void nmi_timer_stop(void) put_online_cpus(); } +static enum cpuhp_state hp_online; + static void nmi_timer_shutdown(void) { struct perf_event *event; int cpu; - cpu_notifier_register_begin(); - __unregister_cpu_notifier(&nmi_timer_cpu_nb); + cpuhp_remove_state(hp_online); for_each_possible_cpu(cpu) { event = per_cpu(nmi_timer_events, cpu); if (!event) @@ -118,13 +110,11 @@ static void nmi_timer_shutdown(void) per_cpu(nmi_timer_events, cpu) = NULL; perf_event_release_kernel(event); } - - cpu_notifier_register_done(); } static int nmi_timer_setup(void) { - int cpu, err; + int err; u64 period; /* clock cycles per tick: */ @@ -132,24 +122,14 @@ static int nmi_timer_setup(void) do_div(period, HZ); nmi_timer_attr.sample_period = period; - cpu_notifier_register_begin(); - err = __register_cpu_notifier(&nmi_timer_cpu_nb); - if (err) - goto out; - - /* can't attach events to offline cpus: */ - for_each_online_cpu(cpu) { - err = nmi_timer_start_cpu(cpu); - if (err) { - cpu_notifier_register_done(); - nmi_timer_shutdown(); - return err; - } + err = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "oprofile/nmi:online", + nmi_timer_cpu_online, nmi_timer_cpu_predown); + if (err < 0) { + nmi_timer_shutdown(); + return err; } - -out: - cpu_notifier_register_done(); - return err; + hp_online = err; + return 0; } int __init op_nmi_timer_init(struct oprofile_operations *ops) |