Re: [PATCH v6] Documentation: userspace-api: Document perf ring buffer mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Namhyung,

On Sat, Aug 26, 2023 at 07:45:15AM -0700, Namhyung Kim wrote:

[...]

> > > >   The combination is supported in perf tool:
> > > >
> > > >   ---+------------+-----------
> > > >      |  Forward   | Backward
> > > >   ---+------------+-----------
> > > >   rw |  Yes       |   No
> > > >   ---+------------+-----------
> > > >   ro |  X         |   Yes
> > > >   ---+------------+-----------
> > > >
> > > >   Yes: is supported
> > > >   No: is not supported
> > > >   X: is not feasible
> > >
> > > I think they are all supported.  You can use rw mode with backward
> > > direction but it's just not intuitive.  Also ro mode with forward direction
> > > is working but there's a chance to miss the start position of the
> > > previous event.
> >
> > I am a bit confused for the all four modes are supported.
> >
> > From the code [1], we can see there have only two combinations:
> >
> > - overwrite + read-only mode (PROT_READ);
> > - no-overwrite + read-write mode (PROT_READ | PROT_WRITE);
> >
> > And I think perf tool must use the backward writing for "overwrite",
> > and use the forward writing for "non-overwrite" mode.  I think the
> > code [2] can help us to conclude this.
>
> I mean the kernel supports all the combinations but perf tool uses
> the selected two.  IIUC you are describing the kernel behavior, right?

You are right.  I read the kernel code again and get the same conclusion
with you.

The kernel code is general enough, which supports forward and backward
writing directions and doesn't assume the direction is bound to any
specific ring buffer mode.  On the other hand, the perf tool selects
the combinations of the direction and mapping property for two modes:
one is the non-overwrite mode and another is the overwritable mode.

In the next spin, I'd like to add a subsection "Ring buffer modes" to
describe the implementation in the kernel and userspace respectively,
hope this can avoid confusion.

Thanks a lot for suggestion!


Leo



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux