From: Peter Zijlstra <peterz@infradead.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Will Deacon <will@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Matt Morehouse <mascasa@google.com>
Subject: Re: Process-wide watchpoints
Date: Wed, 3 Feb 2021 13:22:01 +0100
Message-ID: <YBqVaY8aTMYtoUnX@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CACT4Y+bW1gpv8bz0vswaVUt-OB07oJ3NBeTi+vchAe8TTWK+mg@mail.gmail.com>
On Sun, Jan 31, 2021 at 11:04:43AM +0100, Dmitry Vyukov wrote:
> PERF_EVENT_IOC_{ENABLE,DISABLE} work as advertised.
> However, PERF_EVENT_IOC_MODIFY_ATTRIBUTES does not work for inherited
> child events.
> Does something like this make any sense to you? Are you willing to
> accept such change?
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 55d18791a72d..f6974807a32c 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -3174,7 +3174,7 @@ int perf_event_refresh(struct perf_event *event,
> int refresh)
> }
> EXPORT_SYMBOL_GPL(perf_event_refresh);
>
> -static int perf_event_modify_breakpoint(struct perf_event *bp,
> +static int _perf_event_modify_breakpoint(struct perf_event *bp,
> struct perf_event_attr *attr)
> {
> int err;
> @@ -3189,6 +3189,28 @@ static int perf_event_modify_breakpoint(struct
> perf_event *bp,
> return err;
> }
>
> +static int perf_event_modify_breakpoint(struct perf_event *bp,
> + struct perf_event_attr *attr)
> +{
> + struct perf_event *child;
> + int err;
> +
> + WARN_ON_ONCE(bp->ctx->parent_ctx);
> +
> + mutex_lock(&bp->child_mutex);
> + err = _perf_event_modify_breakpoint(bp, attr);
> + if (err)
> + goto unlock;
> + list_for_each_entry(child, &bp->child_list, child_list) {
> + err = _perf_event_modify_breakpoint(child, attr);
> + if (err)
> + goto unlock;
> + }
> +unlock:
> + mutex_unlock(&bp->child_mutex);
> + return err;
> +}
> +
> static int perf_event_modify_attr(struct perf_event *event,
> struct perf_event_attr *attr)
Oh.. yeah, normal ioctl()s go through the perf_event_for_each_child()
thing, but that doesn't work here.
So yeah, I suppose your patch makes sense.
prev parent reply index
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 7:46 Dmitry Vyukov
2020-11-12 10:31 ` Peter Zijlstra
2020-11-12 10:43 ` Dmitry Vyukov
[not found] ` <CACT4Y+bW1gpv8bz0vswaVUt-OB07oJ3NBeTi+vchAe8TTWK+mg@mail.gmail.com>
[not found] ` <CACT4Y+ZsKXfAxrzJGQc5mJ+QiP5sAw7zKWtciS+07qZzSf33mw@mail.gmail.com>
2021-02-01 8:50 ` Dmitry Vyukov
2021-02-03 12:29 ` Peter Zijlstra
2021-02-03 12:49 ` Dmitry Vyukov
2021-02-03 12:50 ` Dmitry Vyukov
2021-02-03 13:37 ` Peter Zijlstra
2021-02-04 8:10 ` Dmitry Vyukov
2021-02-04 9:38 ` Peter Zijlstra
2021-02-04 9:54 ` Dmitry Vyukov
2021-02-04 12:09 ` Peter Zijlstra
2021-02-04 12:53 ` Dmitry Vyukov
2021-02-04 13:10 ` Peter Zijlstra
2021-02-04 13:35 ` Dmitry Vyukov
2021-02-04 13:45 ` Peter Zijlstra
2021-02-04 14:59 ` Peter Zijlstra
2021-02-04 13:33 ` Peter Zijlstra
2021-02-04 13:37 ` Dmitry Vyukov
2021-02-04 13:06 ` Peter Zijlstra
2021-02-03 5:38 ` Namhyung Kim
2021-02-04 8:10 ` Dmitry Vyukov
2021-02-03 12:22 ` Peter Zijlstra [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=YBqVaY8aTMYtoUnX@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dvyukov@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mascasa@google.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=will@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
LKML Archive on lore.kernel.org
Archives are clonable:
git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
linux-kernel@vger.kernel.org
public-inbox-index lkml
Example config snippet for mirrors
Newsgroup available over NNTP:
nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git