bus: arm-cci: Fix use of smp_processor_id() in preemptible context

The ARM CCI driver seem to be using smp_processor_id() in a
preemptible context, which is likely to make a DEBUG_PREMPT
kernel scream at boot time.

Turn this into a get_cpu()/put_cpu() that extends over the CPU
hotplug registration, making sure that we don't race against
a CPU down operation.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Cc: stable@vger.kernel.org # 4.2+
Signed-off-by: Pawel Moll <pawel.moll@arm.com>

authored by Marc Zyngier and committed by Pawel Moll 4608af8a b18c2b94

+5 -2
+5 -2
drivers/bus/arm-cci.c
··· 1755 1755 raw_spin_lock_init(&cci_pmu->hw_events.pmu_lock); 1756 1756 mutex_init(&cci_pmu->reserve_mutex); 1757 1757 atomic_set(&cci_pmu->active_events, 0); 1758 - cpumask_set_cpu(smp_processor_id(), &cci_pmu->cpus); 1758 + cpumask_set_cpu(get_cpu(), &cci_pmu->cpus); 1759 1759 1760 1760 ret = cci_pmu_init(cci_pmu, pdev); 1761 - if (ret) 1761 + if (ret) { 1762 + put_cpu(); 1762 1763 return ret; 1764 + } 1763 1765 1764 1766 cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, 1765 1767 &cci_pmu->node); 1768 + put_cpu(); 1766 1769 pr_info("ARM %s PMU driver probed", cci_pmu->model->name); 1767 1770 return 0; 1768 1771 }