Re: [PATCH v10 0/2] Introducing trace buffer mapping by user-space

From: Vincent Donnefort
Date: Tue Jan 09 2024 - 08:48:12 EST


On Tue, Jan 09, 2024 at 08:20:57AM -0500, Steven Rostedt wrote:
>
> Hi Masami, thanks for looking at this.
>
> On Tue, 9 Jan 2024 22:04:45 +0900
> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
>
> > > The tracing ring-buffers can be stored on disk or sent to network
> > > without any copy via splice. However the later doesn't allow real time
> > > processing of the traces. A solution is to give userspace direct access
> > > to the ring-buffer pages via a mapping. An application can now become a
> > > consumer of the ring-buffer, in a similar fashion to what trace_pipe
> > > offers.
> >
> > I think this is very nice feature. But this series seems just a feature,
> > no document and no example code. Can you add 2 patches to add those?
> > I know libtracefs already provide a support code, but I think it is
> > better to have a test code under tools/testing/selftests/ring_buffer.
>
> Yeah, we should have sample code and a test.

Ack. I will recycle what I had in the cover letter in a ring_buffer selftest.

>
> >
> > I also wonder what happen if other operation (e.g. taking snapshot) happens
> > while mmaping the ring buffer.
>
> Hmm, good point. We should disable snapshots when mapped, and also prevent
> mapping with latency tracer if we are not already doing that.

ring_buffer_swap_cpu() is already disabled when mapped as well as
resize_disabled set. Is something else necessary?

>
> -- Steve