From: "tip-bot2 for Luo Gengkun" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Luo Gengkun <luogengkun@huaweicloud.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/urgent] perf/core: Fix the WARN_ON_ONCE is out of lock protected region
Date: Tue, 01 Jul 2025 13:03:47 -0000 [thread overview]
Message-ID: <175137502738.406.18395407234477293993.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250626135403.2454105-1-luogengkun@huaweicloud.com>
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: 7b4c5a37544ba22c6ebe72c0d4ea56c953459fa5
Gitweb: https://git.kernel.org/tip/7b4c5a37544ba22c6ebe72c0d4ea56c953459fa5
Author: Luo Gengkun <luogengkun@huaweicloud.com>
AuthorDate: Thu, 26 Jun 2025 13:54:03
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 30 Jun 2025 09:32:49 +02:00
perf/core: Fix the WARN_ON_ONCE is out of lock protected region
commit 3172fb986666 ("perf/core: Fix WARN in perf_cgroup_switch()") try to
fix a concurrency problem between perf_cgroup_switch and
perf_cgroup_event_disable. But it does not to move the WARN_ON_ONCE into
lock-protected region, so the warning is still be triggered.
Fixes: 3172fb986666 ("perf/core: Fix WARN in perf_cgroup_switch()")
Signed-off-by: Luo Gengkun <luogengkun@huaweicloud.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20250626135403.2454105-1-luogengkun@huaweicloud.com
---
kernel/events/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 7281230..bf2118c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -951,8 +951,6 @@ static void perf_cgroup_switch(struct task_struct *task)
if (READ_ONCE(cpuctx->cgrp) == NULL)
return;
- WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
-
cgrp = perf_cgroup_from_task(task, NULL);
if (READ_ONCE(cpuctx->cgrp) == cgrp)
return;
@@ -964,6 +962,8 @@ static void perf_cgroup_switch(struct task_struct *task)
if (READ_ONCE(cpuctx->cgrp) == NULL)
return;
+ WARN_ON_ONCE(cpuctx->ctx.nr_cgroups == 0);
+
perf_ctx_disable(&cpuctx->ctx, true);
ctx_sched_out(&cpuctx->ctx, NULL, EVENT_ALL|EVENT_CGROUP);
prev parent reply other threads:[~2025-07-01 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 13:54 [PATCH] " Luo Gengkun
2025-07-01 13:03 ` tip-bot2 for Luo Gengkun [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175137502738.406.18395407234477293993.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luogengkun@huaweicloud.com \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®