diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2016-08-12 13:49:41 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-02 14:05:06 -0400 |
commit | b230f0db913136f465a951806f2978b179df95d5 (patch) | |
tree | 568256b325c26c1abff658ecf2fae86ba0bcb2a4 | |
parent | 6e103c0cfeb9ab8d40822a015da9769595096411 (diff) |
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>
-rw-r--r-- | drivers/bus/arm-cci.c | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c index 5755907f836f..4c44ba2d3412 100644 --- a/drivers/bus/arm-cci.c +++ b/drivers/bus/arm-cci.c | |||
@@ -144,15 +144,12 @@ struct cci_pmu { | |||
144 | int num_cntrs; | 144 | int num_cntrs; |
145 | atomic_t active_events; | 145 | atomic_t active_events; |
146 | struct mutex reserve_mutex; | 146 | struct mutex reserve_mutex; |
147 | struct list_head entry; | 147 | struct hlist_node node; |
148 | cpumask_t cpus; | 148 | cpumask_t cpus; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | #define to_cci_pmu(c) (container_of(c, struct cci_pmu, pmu)) | 151 | #define to_cci_pmu(c) (container_of(c, struct cci_pmu, pmu)) |
152 | 152 | ||
153 | static DEFINE_MUTEX(cci_pmu_mutex); | ||
154 | static LIST_HEAD(cci_pmu_list); | ||
155 | |||
156 | enum cci_models { | 153 | enum cci_models { |
157 | #ifdef CONFIG_ARM_CCI400_PMU | 154 | #ifdef CONFIG_ARM_CCI400_PMU |
158 | CCI400_R0, | 155 | CCI400_R0, |
@@ -1506,25 +1503,21 @@ static int cci_pmu_init(struct cci_pmu *cci_pmu, struct platform_device *pdev) | |||
1506 | return perf_pmu_register(&cci_pmu->pmu, name, -1); | 1503 | return perf_pmu_register(&cci_pmu->pmu, name, -1); |
1507 | } | 1504 | } |
1508 | 1505 | ||
1509 | static int cci_pmu_offline_cpu(unsigned int cpu) | 1506 | static int cci_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) |
1510 | { | 1507 | { |
1511 | struct cci_pmu *cci_pmu; | 1508 | struct cci_pmu *cci_pmu = hlist_entry_safe(node, struct cci_pmu, node); |
1512 | unsigned int target; | 1509 | unsigned int target; |
1513 | 1510 | ||
1514 | mutex_lock(&cci_pmu_mutex); | 1511 | if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus)) |
1515 | list_for_each_entry(cci_pmu, &cci_pmu_list, entry) { | 1512 | return 0; |
1516 | if (!cpumask_test_and_clear_cpu(cpu, &cci_pmu->cpus)) | 1513 | target = cpumask_any_but(cpu_online_mask, cpu); |
1517 | continue; | 1514 | if (target >= nr_cpu_ids) |
1518 | target = cpumask_any_but(cpu_online_mask, cpu); | 1515 | return 0; |
1519 | if (target >= nr_cpu_ids) | 1516 | /* |
1520 | continue; | 1517 | * TODO: migrate context once core races on event->ctx have |
1521 | /* | 1518 | * been fixed. |
1522 | * TODO: migrate context once core races on event->ctx have | 1519 | */ |
1523 | * been fixed. | 1520 | cpumask_set_cpu(target, &cci_pmu->cpus); |
1524 | */ | ||
1525 | cpumask_set_cpu(target, &cci_pmu->cpus); | ||
1526 | } | ||
1527 | mutex_unlock(&cci_pmu_mutex); | ||
1528 | return 0; | 1521 | return 0; |
1529 | } | 1522 | } |
1530 | 1523 | ||
@@ -1768,10 +1761,8 @@ static int cci_pmu_probe(struct platform_device *pdev) | |||
1768 | if (ret) | 1761 | if (ret) |
1769 | return ret; | 1762 | return ret; |
1770 | 1763 | ||
1771 | mutex_lock(&cci_pmu_mutex); | 1764 | cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
1772 | list_add(&cci_pmu->entry, &cci_pmu_list); | 1765 | &cci_pmu->node); |
1773 | mutex_unlock(&cci_pmu_mutex); | ||
1774 | |||
1775 | pr_info("ARM %s PMU driver probed", cci_pmu->model->name); | 1766 | pr_info("ARM %s PMU driver probed", cci_pmu->model->name); |
1776 | return 0; | 1767 | return 0; |
1777 | } | 1768 | } |
@@ -1804,9 +1795,9 @@ static int __init cci_platform_init(void) | |||
1804 | { | 1795 | { |
1805 | int ret; | 1796 | int ret; |
1806 | 1797 | ||
1807 | ret = cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, | 1798 | ret = cpuhp_setup_state_multi(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
1808 | "AP_PERF_ARM_CCI_ONLINE", NULL, | 1799 | "AP_PERF_ARM_CCI_ONLINE", NULL, |
1809 | cci_pmu_offline_cpu); | 1800 | cci_pmu_offline_cpu); |
1810 | if (ret) | 1801 | if (ret) |
1811 | return ret; | 1802 | return ret; |
1812 | 1803 | ||