Skip to content

Commit fa9d277

Browse files
Marc ZyngierKAGA-KOKO
authored andcommitted
perf: arm_pmu: Kill last use of per-CPU cpu_armpmu pointer
Having removed the use of the cpu_armpmu per-CPU variable from the interrupt handling, the only user left is the BRBE scheduler hook. It is easy to drop the use of this variable by following the pointer to the generic PMU structure, and get the arm_pmu structure from there. Perform the conversion and kill cpu_armpmu altogether. Suggested-by: Will Deacon <will@kernel.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Will Deacon <will@kernel.org> Link: https://patch.msgid.link/20251020122944.3074811-27-maz@kernel.org
1 parent ebac464 commit fa9d277

3 files changed

Lines changed: 1 addition & 8 deletions

File tree

drivers/perf/arm_pmu.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ static const struct pmu_irq_ops percpu_pmunmi_ops = {
104104
.free_pmuirq = armpmu_free_percpu_pmunmi
105105
};
106106

107-
DEFINE_PER_CPU(struct arm_pmu *, cpu_armpmu);
108107
static DEFINE_PER_CPU(int, cpu_irq);
109108
static DEFINE_PER_CPU(const struct pmu_irq_ops *, cpu_irq_ops);
110109

@@ -725,8 +724,6 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node)
725724
if (pmu->reset)
726725
pmu->reset(pmu);
727726

728-
per_cpu(cpu_armpmu, cpu) = pmu;
729-
730727
irq = armpmu_get_cpu_irq(pmu, cpu);
731728
if (irq)
732729
per_cpu(cpu_irq_ops, cpu)->enable_pmuirq(irq);
@@ -746,8 +743,6 @@ static int arm_perf_teardown_cpu(unsigned int cpu, struct hlist_node *node)
746743
if (irq)
747744
per_cpu(cpu_irq_ops, cpu)->disable_pmuirq(irq);
748745

749-
per_cpu(cpu_armpmu, cpu) = NULL;
750-
751746
return 0;
752747
}
753748

drivers/perf/arm_pmuv3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ static int armv8pmu_user_event_idx(struct perf_event *event)
10641064
static void armv8pmu_sched_task(struct perf_event_pmu_context *pmu_ctx,
10651065
struct task_struct *task, bool sched_in)
10661066
{
1067-
struct arm_pmu *armpmu = *this_cpu_ptr(&cpu_armpmu);
1067+
struct arm_pmu *armpmu = to_arm_pmu(pmu_ctx->pmu);
10681068
struct pmu_hw_events *hw_events = this_cpu_ptr(armpmu->hw_events);
10691069

10701070
if (!hw_events->branch_users)

include/linux/perf/arm_pmu.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ struct arm_pmu {
132132

133133
#define to_arm_pmu(p) (container_of(p, struct arm_pmu, pmu))
134134

135-
DECLARE_PER_CPU(struct arm_pmu *, cpu_armpmu);
136-
137135
u64 armpmu_event_update(struct perf_event *event);
138136

139137
int armpmu_event_set_period(struct perf_event *event);

0 commit comments

Comments
 (0)