bus/arm-cci: Use cpu-hp's multi instance support instead custom list
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: rt@linutronix.de Cc: Olof Johansson <olof@lixom.net> Link: http://lkml.kernel.org/r/1471024183-12666-5-git-send-email-bigeasy@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
6e103c0cfe
commit
b230f0db91
|
@ -144,15 +144,12 @@ struct cci_pmu {
|
||||||
int num_cntrs;
|
int num_cntrs;
|
||||||
atomic_t active_events;
|
atomic_t active_events;
|
||||||
struct mutex reserve_mutex;
|
struct mutex reserve_mutex;
|
||||||
struct list_head entry;
|
struct hlist_node node;
|
||||||
cpumask_t cpus;
|
cpumask_t cpus;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define to_cci_pmu(c) (container_of(c, struct cci_pmu, pmu))
|
#define to_cci_pmu(c) (container_of(c, struct cci_pmu, pmu))
|
||||||
|
|
||||||
static DEFINE_MUTEX(cci_pmu_mutex);
|
|
||||||
static LIST_HEAD(cci_pmu_list);
|
|
||||||
|
|
||||||
enum cci_models {
|
enum cci_models {
|
||||||
#ifdef CONFIG_ARM_CCI400_PMU
|
#ifdef CONFIG_ARM_CCI400_PMU
|
||||||
CCI400_R0,
|
CCI400_R0,
|
||||||
|
@ -1506,25 +1503,21 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev)
|
||||||
return perf_pmu_register(&cci_pmu->pmu, name, -1);
|
return perf_pmu_register(&cci_pmu->pmu, name, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cci_pmu_offline_cpu(unsigned int cpu)
|
static int cci_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
|
||||||
{
|
{
|
||||||
struct cci_pmu *cci_pmu;
|
struct cci_pmu *cci_pmu = hlist_entry_safe(node, struct cci_pmu, node);
|
||||||
unsigned int target;
|
unsigned int target;
|
||||||
|
|
||||||
mutex_lock(&cci_pmu_mutex);
|
|
||||||
list_for_each_entry(cci_pmu, &cci_pmu_list, entry) {
|
|
||||||
if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus))
|
if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus))
|
||||||
continue;
|
return 0;
|
||||||
target = cpumask_any_but(cpu_online_mask, cpu);
|
target = cpumask_any_but(cpu_online_mask, cpu);
|
||||||
if (target >= nr_cpu_ids)
|
if (target >= nr_cpu_ids)
|
||||||
continue;
|
return 0;
|
||||||
/*
|
/*
|
||||||
* TODO: migrate context once core races on event->ctx have
|
* TODO: migrate context once core races on event->ctx have
|
||||||
* been fixed.
|
* been fixed.
|
||||||
*/
|
*/
|
||||||
cpumask_set_cpu(target, &cci_pmu->cpus);
|
cpumask_set_cpu(target, &cci_pmu->cpus);
|
||||||
}
|
|
||||||
mutex_unlock(&cci_pmu_mutex);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,10 +1761,8 @@ static int cci_pmu_probe(struct platform_device *pdev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
mutex_lock(&cci_pmu_mutex);
|
cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE,
|
||||||
list_add(&cci_pmu->entry, &cci_pmu_list);
|
&cci_pmu->node);
|
||||||
mutex_unlock(&cci_pmu_mutex);
|
|
||||||
|
|
||||||
pr_info("ARM %s PMU driver probed", cci_pmu->model->name);
|
pr_info("ARM %s PMU driver probed", cci_pmu->model->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1804,7 +1795,7 @@ static int __init cci_platform_init(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE,
|
ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_CCI_ONLINE,
|
||||||
"AP_PERF_ARM_CCI_ONLINE", NULL,
|
"AP_PERF_ARM_CCI_ONLINE", NULL,
|
||||||
cci_pmu_offline_cpu);
|
cci_pmu_offline_cpu);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
Loading…
Reference in New Issue