mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
blackfin/perf: Convert hotplug notifier to state machine
Install the callback via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de> Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153334.265797537@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
77c34ef1c3
commit
a409f5ee29
2 changed files with 6 additions and 21 deletions
|
@ -453,29 +453,13 @@ static struct pmu pmu = {
|
||||||
.read = bfin_pmu_read,
|
.read = bfin_pmu_read,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void bfin_pmu_setup(int cpu)
|
static int bfin_pmu_prepare_cpu(unsigned int cpu)
|
||||||
{
|
{
|
||||||
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
|
struct cpu_hw_events *cpuhw = &per_cpu(cpu_hw_events, cpu);
|
||||||
|
|
||||||
|
bfin_write_PFCTL(0);
|
||||||
memset(cpuhw, 0, sizeof(struct cpu_hw_events));
|
memset(cpuhw, 0, sizeof(struct cpu_hw_events));
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
static int
|
|
||||||
bfin_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
|
|
||||||
{
|
|
||||||
unsigned int cpu = (long)hcpu;
|
|
||||||
|
|
||||||
switch (action & ~CPU_TASKS_FROZEN) {
|
|
||||||
case CPU_UP_PREPARE:
|
|
||||||
bfin_write_PFCTL(0);
|
|
||||||
bfin_pmu_setup(cpu);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NOTIFY_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init bfin_pmu_init(void)
|
static int __init bfin_pmu_init(void)
|
||||||
|
@ -491,8 +475,8 @@ static int __init bfin_pmu_init(void)
|
||||||
|
|
||||||
ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
|
ret = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
perf_cpu_notifier(bfin_pmu_notifier);
|
cpuhp_setup_state(CPUHP_PERF_BFIN, "PERF_BFIN",
|
||||||
|
bfin_pmu_prepare_cpu, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
early_initcall(bfin_pmu_init);
|
early_initcall(bfin_pmu_init);
|
||||||
|
|
|
@ -9,6 +9,7 @@ enum cpuhp_state {
|
||||||
CPUHP_PERF_X86_UNCORE_PREP,
|
CPUHP_PERF_X86_UNCORE_PREP,
|
||||||
CPUHP_PERF_X86_AMD_UNCORE_PREP,
|
CPUHP_PERF_X86_AMD_UNCORE_PREP,
|
||||||
CPUHP_PERF_X86_RAPL_PREP,
|
CPUHP_PERF_X86_RAPL_PREP,
|
||||||
|
CPUHP_PERF_BFIN,
|
||||||
CPUHP_NOTIFY_PREPARE,
|
CPUHP_NOTIFY_PREPARE,
|
||||||
CPUHP_BRINGUP_CPU,
|
CPUHP_BRINGUP_CPU,
|
||||||
CPUHP_AP_IDLE_DEAD,
|
CPUHP_AP_IDLE_DEAD,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue