Hello, I'm very sorry for the corrupt patch formatting, and also for sending this to you twice (I initially forgot to CC the linux-man address), this is my first time submitting contributions this way, and I'm still learning how to do it properly. You can find the fixed patch below. Signed-off-by: Mikołaj Kołek <kolek.mikolaj@xxxxxxxxx> --- man/man2/perf_event_open.2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/man/man2/perf_event_open.2 b/man/man2/perf_event_open.2 index 15411027d..72d8fd797 100644 --- a/man/man2/perf_event_open.2 +++ b/man/man2/perf_event_open.2 @@ -1027,6 +1027,10 @@ .SS Arguments .I read_format values, such as .BR PERF_FORMAT_GROUP . +Additionally, using it together with +.I cpu == \-1 +prevents the creation of the mmap ring-buffer used for +logging asynchronous events in sampled mode. .TP .I pinned The -- 2.45.2 On Fri, Jun 28, 2024 at 1:02 PM Alejandro Colomar <alx@xxxxxxxxxx> wrote: > > Hi Mikołaj, > > On Sun, Jun 23, 2024 at 02:02:36AM GMT, Mikołaj Kołek wrote: > > After calling perf_event_open() with cpus == -1 and the inherit bit, > > using mmap on the perf file descriptor to create a ring-buffer fails > > with EINVAL. This behavior wasn't previously documented in the man > > page and is caused by the following lines in the perf_mmap function in > > kernel/events/core.c: > > /* > > * Don't allow mmap() of inherited per-task counters. This would > > * create a performance issue due to all children writing to the > > * same rb. > > */ > > if (event->cpu == -1 && event->attr.inherit) > > return -EINVAL; > > Thanks for the detailed commit message! > > > Signed-off-by: Mikołaj Kołek <kolek.mikolaj@xxxxxxxxx> > > --- > > man/man2/perf_event_open.2 | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/man/man2/perf_event_open.2 b/man/man2/perf_event_open.2 > > index 2f345ff5b..15a5972d0 100644 > > --- a/man/man2/perf_event_open.2 > > +++ b/man/man2/perf_event_open.2 > > @@ -1025,6 +1025,10 @@ .SS Arguments > > .I read_format > > Applying: perf_event_open.2: document combining inherit and cpus = -1 preventing the use of mmap > error: corrupt patch at line 10 > Patch failed at 0001 perf_event_open.2: document combining inherit and cpus = -1 preventing the use of mmap > hint: Use 'git am --show-current-patch=diff' to see the failed patch > hint: When you have resolved this problem, run "git am --continue". > hint: If you prefer to skip this patch, run "git am --skip" instead. > hint: To restore the original branch and stop patching, run "git am --abort". > hint: Disable this message with "git config advice.mergeConflict false" > Press any key to continue... > > The patch seems to be corrupt. Context lines should begin with a space. > Can you fix that on your end? Otherwise, I'll manually apply the patch. > > > values, such as > > .BR PERF_FORMAT_GROUP . > > +Additionally, using it together with > > +.BR "cpu == -1" > > Please make this > > .I cpu == \-1 > > > +prevents the creation of the mmap ring-buffer used for > > +logging asynchronous events in sampled mode. > > .TP > > .I pinned > > The > > -- > > 2.45.2 > > Have a lovely day! > Alex > > > > > -- > <https://www.alejandro-colomar.es/>