[GIT pull] perf/urgent for v6.12-rc6

From: Thomas Gleixner
Date: Sun Nov 03 2024 - 05:31:25 EST


Linus,

please pull the latest perf/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2024-11-03

up to: e3dfd64c1f34: perf: Fix missing RCU reader protection in perf_event_clear_cpumask()

A single fix for perf:

perf_event_clear_cpumask() uses list_for_each_entry_rcu() without being
in a RCU read side critical section, which triggers a "suspicious RCU
usage" warning.

It turns out that the list walk does not be RCU protected because the
write side lock is held in this contxt.

Change it to a regular list walk.

Thanks,

tglx

------------------>
Kan Liang (1):
perf: Fix missing RCU reader protection in perf_event_clear_cpumask()


kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index cdd09769e6c5..df27d08a7232 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -13959,7 +13959,7 @@ static void perf_event_clear_cpumask(unsigned int cpu)
}

/* migrate */
- list_for_each_entry_rcu(pmu, &pmus, entry, lockdep_is_held(&pmus_srcu)) {
+ list_for_each_entry(pmu, &pmus, entry) {
if (pmu->scope == PERF_PMU_SCOPE_NONE ||
WARN_ON_ONCE(pmu->scope >= PERF_PMU_MAX_SCOPE))
continue;