[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aK7hpARhr5RxVveA@J2N7QTR9R3>
Date: Wed, 27 Aug 2025 11:44:52 +0100
From: Mark Rutland <mark.rutland@....com>
To: Chengdong Li(李成栋) <chengdongli@...imatist.com>
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, alexander.shishkin@...ux.intel.com,
jolsa@...nel.org, irogers@...gle.com, adrian.hunter@...el.com,
kan.liang@...ux.intel.com, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf/core: Improve arguments checking of inherited
per-task counters when sampling.
On Tue, Aug 19, 2025 at 09:31:46PM +0800, Chengdong Li(李成栋) wrote:
> Hi Mark,
>
> On 2025/8/19, 18:26, "Mark Rutland" <mark.rutland@....com <mailto:mark.rutland@....com>> wrote:
>
>
> >On Thu, Aug 14, 2025 at 07:06:25PM +0800, Chengdong Li wrote:
> >> It's not allowed to mmap() of inherited per-task counters with CPU ==
> >> -1, this would create a performance issue. But it is not friendly to
> >> developers as current implementation postponed the arguments checking to
> >> perf_mmap(), developer can get an -EINVAL from mmap() but without
> >> any previous error returned from perf_event_open().
> >>
> >> This patch improves it by moving the arguments checking from perf_mmap()
> >> to perf_event_open().
> >
> >Why is that an improvement?
> >
> >IIUC before this patch, it would be possible to read() the event,
> >whereas now the event cannot be opened at all.
>
> That's true, could you provide a use case that using sampling mode but without
> ring buffer? From my best knowledge, I think counting mode is more suitable
> for read() only.
I could be mistaken, but IIRC the RR folk were using sampling mode to
get notifications upon each sample/overflow, but they don't really care
about the sample itself. They might not care about inherited counters
for that workload, but I'm fairly sure that sampling without mmap is a
real (albeit unusual) use-case.
> >AFAICT this is removing functionality people could legitimately use, so
> >this doesn't seem like an improvement.
>
> The problem is that using inherit per-task counter with sampling mode would lead
> developer hard to debug why mmap() returns -EINVAL. There is not error returned from
> perf_event_open(), everything done seems right but failed at mmap(), and there is
> no clue in man open_event_open() as well.
Ok, but presumably they do that mmap() shortly after doing the relavant
perf_event_open() calls?
When do people hit this in practice? Do they actually see this when
deploying a workload, or just when developing code that uses sampling?
Mark.
Powered by blists - more mailing lists