[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ciL7G7YR4bFVO18sC4CRCm30G0WUdgp+txRnsG7CAYPHQ@mail.gmail.com>
Date: Wed, 29 May 2024 23:03:56 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
Changbin Du <changbin.du@...wei.com>, Yang Jihong <yangjihong1@...wei.com>,
Andrii Nakryiko <andrii@...nel.org>, John Fastabend <john.fastabend@...il.com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
bpf@...r.kernel.org
Subject: Re: [PATCH v3 0/3] Use BPF filters for a "perf top -u" workaround
On Fri, May 24, 2024 at 1:52 PM Ian Rogers <irogers@...gle.com> wrote:
>
> Allow uid and gid to be terms in BPF filters by first breaking the
> connection between filter terms and PERF_SAMPLE_xx values. Calculate
> the uid and gid using the bpf_get_current_uid_gid helper, rather than
> from a value in the sample. Allow filters to be passed to perf top, this allows:
>
> $ perf top -e cycles:P --filter "uid == $(id -u)"
>
> to work as a "perf top -u" workaround, as "perf top -u" usually fails
> due to processes/threads terminating between the /proc scan and the
> perf_event_open.
>
> v3. Move PERF_SAMPLE_xx asserts to sample_filter.bpf.c to avoid
> conflicting definitions between vmlinux.h and perf_event.h as
> reported by Namhyung.
> v2. Allow PERF_SAMPLE_xx to be computed from the PBF_TERM_xx value
> using a shift as requested by Namhyung.
>
> Ian Rogers (3):
> perf bpf filter: Give terms their own enum
> perf bpf filter: Add uid and gid terms
> perf top: Allow filters on events
Acked-by: Namhyung Kim <namhyung@...nel.org>
Thanks,
Namhyung
>
> tools/perf/Documentation/perf-record.txt | 2 +-
> tools/perf/Documentation/perf-top.txt | 4 ++
> tools/perf/builtin-top.c | 9 +++
> tools/perf/util/bpf-filter.c | 33 +++++----
> tools/perf/util/bpf-filter.h | 5 +-
> tools/perf/util/bpf-filter.l | 66 +++++++++---------
> tools/perf/util/bpf-filter.y | 7 +-
> tools/perf/util/bpf_skel/sample-filter.h | 40 ++++++++++-
> tools/perf/util/bpf_skel/sample_filter.bpf.c | 73 +++++++++++++++-----
> 9 files changed, 169 insertions(+), 70 deletions(-)
>
> --
> 2.45.1.288.g0e0cd299f1-goog
>
Powered by blists - more mailing lists