From: Ravi Bangoria <ravi.bangoria@amd.com>
To: Ingo Molnar <mingo@kernel.org>, Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Stephane Eranian <eranian@google.com>,
Ian Rogers <irogers@google.com>,
Kan Liang <kan.liang@linux.intel.com>,
James Clark <james.clark@linaro.org>, Leo Yan <leo.yan@arm.com>,
Joe Mario <jmario@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Santosh Shukla <santosh.shukla@amd.com>,
Ananth Narayan <ananth.narayan@amd.com>,
Sandipan Das <sandipan.das@amd.com>,
bpf@vger.kernel.org, Ravi Bangoria <ravi.bangoria@amd.com>
Subject: Re: [PATCH 1/4] perf/amd/ibs: Add load/store SW filters to IBS OP PMU
Date: Tue, 10 Jun 2025 10:42:38 +0530 [thread overview]
Message-ID: <dae6bb73-9c13-4b44-a766-0c7c09e5b79f@amd.com> (raw)
In-Reply-To: <aD6bkAXjRllFvRTV@google.com>
Hi Ingo, Namhyung,
>>> An alternate approach is mem_op BPF filter:
>>>
>>> perf record --filter "mem_op == load || mem_op == store" ...
>>>
>>> However, there are few issues with it:
>>> o BPF filter is called after preparing entire perf sample. If the sample
>>> does not satisfy the filtering criteria, all the efforts of preparing
>>> perf sample gets wasted.
>>
>> Could we add an 'early' BPF callback point as well, to fast-discard
>> samples?
>
> I guess that would require a new BPF program type than PERF_EVENT and
> handle driver-specific details.
Right.
>>> o BPF filter requires root privilege.
>>
>> Could we add 'built-in', 'safe' BPF scripts that are specifically
>> prepared for perf events filtering purposes, that can be toggled by
>> non-root users as well? These could be toggled by tooling via sysfs or
>> so, or even via the perf syscall if that turns out to be the better
>> approach.
>
> We have BPF filter framework in the perf tools and it can be run as
> normal user. But root user should load and pin the BPF program prior
> to use like below.
>
> $ sudo perf record --setup-filter pin
>
> $ perf record -d -e ibs_op/swfilt/u --filter 'mem_op == load' ...
Thanks Namhyung.
Ingo, Do you feel the idea of perf specific 'safe' BPF script is still
worth pursuing despite similar functionality is already provided by
--setup-filter?
Thanks,
Ravi
next prev parent reply other threads:[~2025-06-10 5:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-29 12:34 [PATCH 0/4] perf/amd/ibs: Introduce load/store SW filter Ravi Bangoria
2025-05-29 12:34 ` [PATCH 1/4] perf/amd/ibs: Add load/store SW filters to IBS OP PMU Ravi Bangoria
2025-05-31 7:53 ` Ingo Molnar
2025-06-03 6:52 ` Namhyung Kim
2025-06-10 5:12 ` Ravi Bangoria [this message]
2025-05-29 12:34 ` [PATCH 2/4] perf mem/c2c amd: Wire IBS OP PMU load/store SW filter Ravi Bangoria
2025-05-29 12:34 ` [PATCH 3/4] perf test amd: Add IBS load/store swfilt tests Ravi Bangoria
2025-05-29 12:34 ` [PATCH 4/4] perf doc amd: Update perf-amd-ibs man page Ravi Bangoria
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=dae6bb73-9c13-4b44-a766-0c7c09e5b79f@amd.com \
--to=ravi.bangoria@amd.com \
--cc=acme@kernel.org \
--cc=ananth.narayan@amd.com \
--cc=bpf@vger.kernel.org \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jmario@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sandipan.das@amd.com \
--cc=santosh.shukla@amd.com \
/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).