[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <dae6bb73-9c13-4b44-a766-0c7c09e5b79f@amd.com>
Date: Tue, 10 Jun 2025 10:42:38 +0530
From: Ravi Bangoria <ravi.bangoria@....com>
To: Ingo Molnar <mingo@...nel.org>, Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Ingo Molnar <mingo@...hat.com>,
Stephane Eranian <eranian@...gle.com>, Ian Rogers <irogers@...gle.com>,
Kan Liang <kan.liang@...ux.intel.com>, James Clark <james.clark@...aro.org>,
Leo Yan <leo.yan@....com>, Joe Mario <jmario@...hat.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Santosh Shukla <santosh.shukla@....com>,
Ananth Narayan <ananth.narayan@....com>, Sandipan Das
<sandipan.das@....com>, bpf@...r.kernel.org,
Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [PATCH 1/4] perf/amd/ibs: Add load/store SW filters to IBS OP PMU
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
Powered by blists - more mailing lists