[<prev] [next>] [day] [month] [year] [list]
Message-ID: <166496920167.401.7879085320473775333.tip-bot2@tip-bot2>
Date: Wed, 05 Oct 2022 11:26:41 -0000
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Mark Rutland <mark.rutland@....com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: perf/core] perf: Fix pmu_filter_match()
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 7be51cc1c68dfa180ef84e71bcb4204237bb5620
Gitweb: https://git.kernel.org/tip/7be51cc1c68dfa180ef84e71bcb4204237bb5620
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Tue, 04 Oct 2022 11:03:47 +02:00
Committer: Peter Zijlstra <peterz@...radead.org>
CommitterDate: Tue, 04 Oct 2022 13:32:09 +02:00
perf: Fix pmu_filter_match()
Mark reported that the new for_each_sibling_event() assertion triggers
in pmu_filter_match() -- which isn't always called with IRQs disabled
or ctx->mutex held.
Fixes: f3c0eba28704 ("perf: Add a few assertions")
Reported-by: Mark Rutland <mark.rutland@....com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Link: https://lkml.kernel.org/r/YvvJq2f/7eFVcnNy@FVFF77S0Q05N
---
kernel/events/core.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 49bc3b5..b981b87 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2226,16 +2226,22 @@ static inline int __pmu_filter_match(struct perf_event *event)
static inline int pmu_filter_match(struct perf_event *event)
{
struct perf_event *sibling;
+ unsigned long flags;
+ int ret = 1;
if (!__pmu_filter_match(event))
return 0;
+ local_irq_save(flags);
for_each_sibling_event(sibling, event) {
- if (!__pmu_filter_match(sibling))
- return 0;
+ if (!__pmu_filter_match(sibling)) {
+ ret = 0;
+ break;
+ }
}
+ local_irq_restore(flags);
- return 1;
+ return ret;
}
static inline int
Powered by blists - more mailing lists