Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From ad3c5d9224ffcd7b2e083f03441c6188d2bbef67 Mon Sep 17 00:00:00 2001 |
| 2 | From: Thomas Gleixner <tglx@linutronix.de> |
| 3 | Date: Tue, 18 May 2021 11:17:28 +0200 |
| 4 | Subject: [PATCH 01/14] perf/arm-cmn: Use irq_set_affinity() |
| 5 | |
| 6 | The driver uses irq_set_affinity_hint() to set the affinity for the PMU |
| 7 | interrupts, which relies on the undocumented side effect that this function |
| 8 | actually sets the affinity under the hood. |
| 9 | |
| 10 | Setting an hint is clearly not a guarantee and for these PMU interrupts an |
| 11 | affinity hint, which is supposed to guide userspace for setting affinity, |
| 12 | is beyond pointless, because the affinity of these interrupts cannot be |
| 13 | modified from user space. |
| 14 | |
| 15 | Aside of that the error checks are bogus because the only error which is |
| 16 | returned from irq_set_affinity_hint() is when there is no irq descriptor |
| 17 | for the interrupt number, but not when the affinity set fails. That's on |
| 18 | purpose because the hint can point to an offline CPU. |
| 19 | |
| 20 | Replace the mindless abuse with irq_set_affinity(). |
| 21 | |
| 22 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
| 23 | |
| 24 | Link: https://lore.kernel.org/r/20210518093118.277228577@linutronix.de |
| 25 | Signed-off-by: Will Deacon <will@kernel.org> |
| 26 | |
| 27 | Upstream-Status: Backport [https://lore.kernel.org/r/20210518093118.277228577@linutronix.de] |
| 28 | Signed-off-by: Rupinderjit Singh <rupinderjit.singh@arm.com> |
| 29 | --- |
| 30 | drivers/perf/arm-cmn.c | 9 ++------- |
| 31 | 1 file changed, 2 insertions(+), 7 deletions(-) |
| 32 | |
| 33 | diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c |
| 34 | index 46defb1dcf86..38fa6f89d0bc 100644 |
| 35 | --- a/drivers/perf/arm-cmn.c |
| 36 | +++ b/drivers/perf/arm-cmn.c |
| 37 | @@ -1162,7 +1162,7 @@ static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) |
| 38 | |
| 39 | perf_pmu_migrate_context(&cmn->pmu, cpu, target); |
| 40 | for (i = 0; i < cmn->num_dtcs; i++) |
| 41 | - irq_set_affinity_hint(cmn->dtc[i].irq, cpumask_of(target)); |
| 42 | + irq_set_affinity(cmn->dtc[i].irq, cpumask_of(target)); |
| 43 | cmn->cpu = target; |
| 44 | return 0; |
| 45 | } |
| 46 | @@ -1222,7 +1222,7 @@ static int arm_cmn_init_irqs(struct arm_cmn *cmn) |
| 47 | if (err) |
| 48 | return err; |
| 49 | |
| 50 | - err = irq_set_affinity_hint(irq, cpumask_of(cmn->cpu)); |
| 51 | + err = irq_set_affinity(irq, cpumask_of(cmn->cpu)); |
| 52 | if (err) |
| 53 | return err; |
| 54 | next: |
| 55 | @@ -1568,16 +1568,11 @@ static int arm_cmn_probe(struct platform_device *pdev) |
| 56 | static int arm_cmn_remove(struct platform_device *pdev) |
| 57 | { |
| 58 | struct arm_cmn *cmn = platform_get_drvdata(pdev); |
| 59 | - int i; |
| 60 | |
| 61 | writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL); |
| 62 | |
| 63 | perf_pmu_unregister(&cmn->pmu); |
| 64 | cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); |
| 65 | - |
| 66 | - for (i = 0; i < cmn->num_dtcs; i++) |
| 67 | - irq_set_affinity_hint(cmn->dtc[i].irq, NULL); |
| 68 | - |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | -- |
| 73 | 2.25.1 |
| 74 | |