Commit 65264e3b authored by Richard Cochran's avatar Richard Cochran Committed by Ingo Molnar

MIPS/Loongson-3: Convert oprofile to hotplug state machine

Install the callbacks via the state machine and let the core invoke
the callbacks on the already online CPUs.
Signed-off-by: default avatarRichard Cochran <rcochran@linutronix.de>
Signed-off-by: default avatarAnna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: default avatarRalf Baechle <ralf@linux-mips.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Robert Richter <rric@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: oprofile-list@lists.sf.net
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153337.054827168@linutronix.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 4761adb6
...@@ -168,33 +168,26 @@ static int loongson3_perfcount_handler(void) ...@@ -168,33 +168,26 @@ static int loongson3_perfcount_handler(void)
return handled; return handled;
} }
static int loongson3_cpu_callback(struct notifier_block *nfb, static int loongson3_starting_cpu(unsigned int cpu)
unsigned long action, void *hcpu)
{ {
switch (action) {
case CPU_STARTING:
case CPU_STARTING_FROZEN:
write_c0_perflo1(reg.control1); write_c0_perflo1(reg.control1);
write_c0_perflo2(reg.control2); write_c0_perflo2(reg.control2);
break; return 0;
case CPU_DYING: }
case CPU_DYING_FROZEN:
static int loongson3_dying_cpu(unsigned int cpu)
{
write_c0_perflo1(0xc0000000); write_c0_perflo1(0xc0000000);
write_c0_perflo2(0x40000000); write_c0_perflo2(0x40000000);
break; return 0;
}
return NOTIFY_OK;
} }
static struct notifier_block loongson3_notifier_block = {
.notifier_call = loongson3_cpu_callback
};
static int __init loongson3_init(void) static int __init loongson3_init(void)
{ {
on_each_cpu(reset_counters, NULL, 1); on_each_cpu(reset_counters, NULL, 1);
register_hotcpu_notifier(&loongson3_notifier_block); cpuhp_setup_state_nocalls(CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
"AP_MIPS_OP_LOONGSON3_STARTING",
loongson3_starting_cpu, loongson3_dying_cpu);
save_perf_irq = perf_irq; save_perf_irq = perf_irq;
perf_irq = loongson3_perfcount_handler; perf_irq = loongson3_perfcount_handler;
...@@ -204,7 +197,7 @@ static int __init loongson3_init(void) ...@@ -204,7 +197,7 @@ static int __init loongson3_init(void)
static void loongson3_exit(void) static void loongson3_exit(void)
{ {
on_each_cpu(reset_counters, NULL, 1); on_each_cpu(reset_counters, NULL, 1);
unregister_hotcpu_notifier(&loongson3_notifier_block); cpuhp_remove_state_nocalls(CPUHP_AP_MIPS_OP_LOONGSON3_STARTING);
perf_irq = save_perf_irq; perf_irq = save_perf_irq;
} }
......
...@@ -35,6 +35,7 @@ enum cpuhp_state { ...@@ -35,6 +35,7 @@ enum cpuhp_state {
CPUHP_AP_PERF_X86_CSTATE_STARTING, CPUHP_AP_PERF_X86_CSTATE_STARTING,
CPUHP_AP_PERF_XTENSA_STARTING, CPUHP_AP_PERF_XTENSA_STARTING,
CPUHP_AP_PERF_METAG_STARTING, CPUHP_AP_PERF_METAG_STARTING,
CPUHP_AP_MIPS_OP_LOONGSON3_STARTING,
CPUHP_AP_ARM_VFP_STARTING, CPUHP_AP_ARM_VFP_STARTING,
CPUHP_AP_PERF_ARM_STARTING, CPUHP_AP_PERF_ARM_STARTING,
CPUHP_AP_ARM_L2X0_STARTING, CPUHP_AP_ARM_L2X0_STARTING,
......
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