summaryrefslogtreecommitdiffstats
path: root/drivers/perf
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-07-13 13:16:36 -0400
committerIngo Molnar <mingo@kernel.org>2016-07-15 04:40:23 -0400
commit7d88eb695a1f5f67820e02999b949d5cfa080442 (patch)
treeb7f811547579d68a007fee254ca190ae74f19974 /drivers/perf
parente5b61bafe70477e05e1dce0d6ca4ec181e23cb2a (diff)
arm/perf: Convert to hotplug state machine
Straight forward conversion w/o bells and whistles. 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: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153335.794097159@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/perf')
-rw-r--r--drivers/perf/arm_pmu.c36
1 files changed, 15 insertions, 21 deletions
diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index 140436a046c0..ae9fc6c6add3 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -691,24 +691,15 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler)
691 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading 691 * UNKNOWN at reset, the PMU must be explicitly reset to avoid reading
692 * junk values out of them. 692 * junk values out of them.
693 */ 693 */
694static int cpu_pmu_notify(struct notifier_block *b, unsigned long action, 694static int arm_perf_starting_cpu(unsigned int cpu)
695 void *hcpu)
696{ 695{
697 int cpu = (unsigned long)hcpu; 696 if (!__oprofile_cpu_pmu)
698 struct arm_pmu *pmu = container_of(b, struct arm_pmu, hotplug_nb); 697 return 0;
699 698 if (!cpumask_test_cpu(cpu, &__oprofile_cpu_pmu->supported_cpus))
700 if ((action & ~CPU_TASKS_FROZEN) != CPU_STARTING) 699 return 0;
701 return NOTIFY_DONE; 700 if (__oprofile_cpu_pmu->reset)
702 701 __oprofile_cpu_pmu->reset(__oprofile_cpu_pmu);
703 if (!cpumask_test_cpu(cpu, &pmu->supported_cpus)) 702 return 0;
704 return NOTIFY_DONE;
705
706 if (pmu->reset)
707 pmu->reset(pmu);
708 else
709 return NOTIFY_DONE;
710
711 return NOTIFY_OK;
712} 703}
713 704
714#ifdef CONFIG_CPU_PM 705#ifdef CONFIG_CPU_PM
@@ -819,8 +810,9 @@ static int cpu_pmu_init(struct arm_pmu *cpu_pmu)
819 if (!cpu_hw_events) 810 if (!cpu_hw_events)
820 return -ENOMEM; 811 return -ENOMEM;
821 812
822 cpu_pmu->hotplug_nb.notifier_call = cpu_pmu_notify; 813 err = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_STARTING,
823 err = register_cpu_notifier(&cpu_pmu->hotplug_nb); 814 "AP_PERF_ARM_STARTING",
815 arm_perf_starting_cpu, NULL);
824 if (err) 816 if (err)
825 goto out_hw_events; 817 goto out_hw_events;
826 818
@@ -858,7 +850,7 @@ static int cpu_pmu_init(struct arm_pmu *cpu_pmu)
858 return 0; 850 return 0;
859 851
860out_unregister: 852out_unregister:
861 unregister_cpu_notifier(&cpu_pmu->hotplug_nb); 853 cpuhp_remove_state_nocalls(CPUHP_AP_PERF_ARM_STARTING);
862out_hw_events: 854out_hw_events:
863 free_percpu(cpu_hw_events); 855 free_percpu(cpu_hw_events);
864 return err; 856 return err;
@@ -867,7 +859,7 @@ out_hw_events:
867static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu) 859static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)
868{ 860{
869 cpu_pm_pmu_unregister(cpu_pmu); 861 cpu_pm_pmu_unregister(cpu_pmu);
870 unregister_cpu_notifier(&cpu_pmu->hotplug_nb); 862 cpuhp_remove_state_nocalls(CPUHP_AP_PERF_ARM_STARTING);
871 free_percpu(cpu_pmu->hw_events); 863 free_percpu(cpu_pmu->hw_events);
872} 864}
873 865
@@ -1027,6 +1019,8 @@ int arm_pmu_device_probe(struct platform_device *pdev,
1027 if (ret) 1019 if (ret)
1028 goto out_destroy; 1020 goto out_destroy;
1029 1021
1022 WARN(__oprofile_cpu_pmu, "%s(): missing PMU strucure for CPU-hotplug\n",
1023 __func__);
1030 if (!__oprofile_cpu_pmu) 1024 if (!__oprofile_cpu_pmu)
1031 __oprofile_cpu_pmu = pmu; 1025 __oprofile_cpu_pmu = pmu;
1032 1026