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

perf/arm-dmc620: 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.395086573@linutronix.de
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Thomas Gleixner and committed by
Will Deacon
1ceeb8d4 8ec25d34

+2 -3
+2 -3
drivers/perf/arm_dmc620_pmu.c
··· 421 421 if (ret) 422 422 goto out_free_aff; 423 423 424 - ret = irq_set_affinity_hint(irq_num, cpumask_of(irq->cpu)); 424 + ret = irq_set_affinity(irq_num, cpumask_of(irq->cpu)); 425 425 if (ret) 426 426 goto out_free_irq; 427 427 ··· 475 475 list_del(&irq->irqs_node); 476 476 mutex_unlock(&dmc620_pmu_irqs_lock); 477 477 478 - WARN_ON(irq_set_affinity_hint(irq->irq_num, NULL)); 479 478 free_irq(irq->irq_num, irq); 480 479 cpuhp_state_remove_instance_nocalls(cpuhp_state_num, &irq->node); 481 480 kfree(irq); ··· 621 622 perf_pmu_migrate_context(&dmc620_pmu->pmu, irq->cpu, target); 622 623 mutex_unlock(&dmc620_pmu_irqs_lock); 623 624 624 - WARN_ON(irq_set_affinity_hint(irq->irq_num, cpumask_of(target))); 625 + WARN_ON(irq_set_affinity(irq->irq_num, cpumask_of(target))); 625 626 irq->cpu = target; 626 627 627 628 return 0;