Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf/arm-ccn: Use irq_set_affinity()

The driver uses irq_set_affinity_hint() to set the affinity for the PMU
interrupts, which relies on the undocumented side effect that this function
actually sets the affinity under the hood.

Setting an hint is clearly not a guarantee and for these PMU interrupts an
affinity hint, which is supposed to guide userspace for setting affinity,
is beyond pointless, because the affinity of these interrupts cannot be
modified from user space.

Aside of that the error checks are bogus because the only error which is
returned from irq_set_affinity_hint() is when there is no irq descriptor
for the interrupt number, but not when the affinity set fails. That's on
purpose because the hint can point to an offline CPU.

Replace the mindless abuse with irq_set_affinity().

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/20210518093118.128250213@linutronix.de
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Thomas Gleixner and committed by
Will Deacon
84fca8ba da3862e7

+2 -4
+2 -4
drivers/perf/arm-ccn.c
··· 1211 1211 perf_pmu_migrate_context(&dt->pmu, cpu, target); 1212 1212 dt->cpu = target; 1213 1213 if (ccn->irq) 1214 - WARN_ON(irq_set_affinity_hint(ccn->irq, cpumask_of(dt->cpu))); 1214 + WARN_ON(irq_set_affinity(ccn->irq, cpumask_of(dt->cpu))); 1215 1215 return 0; 1216 1216 } 1217 1217 ··· 1291 1291 1292 1292 /* Also make sure that the overflow interrupt is handled by this CPU */ 1293 1293 if (ccn->irq) { 1294 - err = irq_set_affinity_hint(ccn->irq, cpumask_of(ccn->dt.cpu)); 1294 + err = irq_set_affinity(ccn->irq, cpumask_of(ccn->dt.cpu)); 1295 1295 if (err) { 1296 1296 dev_err(ccn->dev, "Failed to set interrupt affinity!\n"); 1297 1297 goto error_set_affinity; ··· 1325 1325 1326 1326 cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE, 1327 1327 &ccn->dt.node); 1328 - if (ccn->irq) 1329 - irq_set_affinity_hint(ccn->irq, NULL); 1330 1328 for (i = 0; i < ccn->num_xps; i++) 1331 1329 writel(0, ccn->xp[i].base + CCN_XP_DT_CONTROL); 1332 1330 writel(0, ccn->dt.base + CCN_DT_PMCR);