linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Marco Elver" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Marco Elver <elver@google.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children
Date: Fri, 16 Apr 2021 15:01:51 -0000	[thread overview]
Message-ID: <161858531152.29796.6913083188712976214.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210408103605.1676875-3-elver@google.com>

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     47f661eca0700928012e11c57ea0328f5ccfc3b9
Gitweb:        https://git.kernel.org/tip/47f661eca0700928012e11c57ea0328f5ccfc3b9
Author:        Marco Elver <elver@google.com>
AuthorDate:    Thu, 08 Apr 2021 12:35:57 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 16 Apr 2021 16:32:40 +02:00

perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

As with other ioctls (such as PERF_EVENT_IOC_{ENABLE,DISABLE}), fix up
handling of PERF_EVENT_IOC_MODIFY_ATTRIBUTES to also apply to children.

Suggested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
Link: https://lkml.kernel.org/r/20210408103605.1676875-3-elver@google.com
---
 kernel/events/core.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 318ff7b..10ed2cd 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3200,16 +3200,36 @@ static int perf_event_modify_breakpoint(struct perf_event *bp,
 static int perf_event_modify_attr(struct perf_event *event,
 				  struct perf_event_attr *attr)
 {
+	int (*func)(struct perf_event *, struct perf_event_attr *);
+	struct perf_event *child;
+	int err;
+
 	if (event->attr.type != attr->type)
 		return -EINVAL;
 
 	switch (event->attr.type) {
 	case PERF_TYPE_BREAKPOINT:
-		return perf_event_modify_breakpoint(event, attr);
+		func = perf_event_modify_breakpoint;
+		break;
 	default:
 		/* Place holder for future additions. */
 		return -EOPNOTSUPP;
 	}
+
+	WARN_ON_ONCE(event->ctx->parent_ctx);
+
+	mutex_lock(&event->child_mutex);
+	err = func(event, attr);
+	if (err)
+		goto out;
+	list_for_each_entry(child, &event->child_list, child_list) {
+		err = func(child, attr);
+		if (err)
+			goto out;
+	}
+out:
+	mutex_unlock(&event->child_mutex);
+	return err;
 }
 
 static void ctx_sched_out(struct perf_event_context *ctx,

  reply	other threads:[~2021-04-16 15:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 10:35 [PATCH v4 00/10] Add support for synchronous signals on perf events Marco Elver
2021-04-08 10:35 ` [PATCH v4 01/10] perf: Rework perf_event_exit_event() Marco Elver
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Peter Zijlstra
2021-04-08 10:35 ` [PATCH v4 02/10] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children Marco Elver
2021-04-16 15:01   ` tip-bot2 for Marco Elver [this message]
2021-04-08 10:35 ` [PATCH v4 03/10] perf: Support only inheriting events if cloned with CLONE_THREAD Marco Elver
2021-04-08 10:35 ` [PATCH v4 04/10] perf: Add support for event removal on exec Marco Elver
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Marco Elver
2021-04-08 10:36 ` [PATCH v4 05/10] signal: Introduce TRAP_PERF si_code and si_perf to siginfo Marco Elver
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Marco Elver
     [not found]   ` <CGME20210420212618eucas1p102b427d1af9c682217dfe093f3eac3e8@eucas1p1.samsung.com>
2021-04-20 21:26     ` [PATCH v4 05/10] " Marek Szyprowski
2021-04-20 22:42       ` Marco Elver
2021-04-21  6:21         ` Marek Szyprowski
2021-04-21  7:35           ` Marek Szyprowski
2021-04-21  8:11             ` Marco Elver
2021-04-21  9:35               ` Marek Szyprowski
2021-04-21 10:57                 ` Marek Szyprowski
2021-04-21 11:03                   ` Marco Elver
2021-04-21 13:19                     ` Marek Szyprowski
2021-04-21 15:11                       ` Marco Elver
2021-04-21 16:27                         ` Marco Elver
2021-04-21 18:23                           ` Marco Elver
2021-04-22  6:12                             ` Marek Szyprowski
2021-04-22  6:47                               ` Marco Elver
2021-04-22  8:16                                 ` Jon Hunter
2021-04-26  7:35                                 ` Alexander Egorenkov
2021-04-21 15:07   ` Jon Hunter
2021-04-08 10:36 ` [PATCH v4 06/10] perf: Add support for SIGTRAP on perf events Marco Elver
2021-04-08 10:36 ` [PATCH v4 07/10] selftests/perf_events: Add kselftest for process-wide sigtrap handling Marco Elver
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Marco Elver
2021-04-08 10:36 ` [PATCH v4 08/10] selftests/perf_events: Add kselftest for remove_on_exec Marco Elver
2021-04-16 15:01   ` [tip: perf/core] " tip-bot2 for Marco Elver
2021-04-08 10:36 ` [PATCH v4 09/10] tools headers uapi: Sync tools/include/uapi/linux/perf_event.h Marco Elver
2021-04-08 10:36 ` [PATCH v4 10/10] perf test: Add basic stress test for sigtrap handling Marco Elver
2021-04-14  8:37 ` [PATCH v4 00/10] Add support for synchronous signals on perf events Peter Zijlstra

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=161858531152.29796.6913083188712976214.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).