From: "tip-bot2 for Budimir Markovic" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Budimir Markovic <markovicbudimir@gmail.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/urgent] perf: Fix check before add_event_to_groups() in perf_group_detach()
Date: Wed, 15 Mar 2023 21:01:24 -0000 [thread overview]
Message-ID: <167891408482.5837.1916820071250811928.tip-bot2@tip-bot2> (raw)
In-Reply-To: <ZBFzvQV9tEqoHEtH@gentoo>
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: fd0815f632c24878e325821943edccc7fde947a2
Gitweb: https://git.kernel.org/tip/fd0815f632c24878e325821943edccc7fde947a2
Author: Budimir Markovic <markovicbudimir@gmail.com>
AuthorDate: Wed, 15 Mar 2023 00:29:01 -07:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 15 Mar 2023 21:49:47 +01:00
perf: Fix check before add_event_to_groups() in perf_group_detach()
Events should only be added to a groups rb tree if they have not been
removed from their context by list_del_event(). Since remove_on_exec
made it possible to call list_del_event() on individual events before
they are detached from their group, perf_group_detach() should check each
sibling's attach_state before calling add_event_to_groups() on it.
Fixes: 2e498d0a74e5 ("perf: Add support for event removal on exec")
Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/ZBFzvQV9tEqoHEtH@gentoo
---
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 52b4aa0..fb3e436 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2163,7 +2163,7 @@ static void perf_group_detach(struct perf_event *event)
/* Inherit group flags from the previous leader */
sibling->group_caps = event->group_caps;
- if (!RB_EMPTY_NODE(&event->group_node)) {
+ if (sibling->attach_state & PERF_ATTACH_CONTEXT) {
add_event_to_groups(sibling, event->ctx);
if (sibling->state == PERF_EVENT_STATE_ACTIVE)
parent reply other threads:[~2023-03-15 21:03 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <ZBFzvQV9tEqoHEtH@gentoo>]
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=167891408482.5837.1916820071250811928.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=markovicbudimir@gmail.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®