Re: [PATCH] libtracefs: Update the kbuf for previous read in trace_mmap_load_subbuf()

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

 



On Tue, 23 Jan 2024 17:41:59 +0000
Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote:

> On Tue, Jan 23, 2024 at 12:33:37PM -0500, Steven Rostedt wrote:
> > From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
> > 
> > The trace_mmap() checks if the mmapped data has any previously read data
> > (the reader.read value of the meta page is non-zero), then it will pre-read
> > the kbuf to move its internal reader pointer to the same value.
> > 
> > But when tracefs_cpu_read_buf() calls trace_mmap_load_subbuf(), its
> > kbuf->subbuffer will not be the same as the mapped data and
> > kbuffer_load_subbuffer() is called on it and it is returned. But that means
> > its read pointer has not been updated, and the read data will restart again.
> > 
> > When the kbuf is updated in trace_mmap_load_subbuf() check the tmap->kbuf to
> > see if it already read any of the data, and move the kbuffer forward just
> > like the trace_mmap() does.
> > 
> > Link: https://lore.kernel.org/linux-trace-devel/Za-Md51snPcIoYFn@xxxxxxxxxx/
> > 
> > Fixes: 2ed14b59 ("libtracefs: Add ring buffer memory mapping APIs")
> > Reported-by: Vincent Donnefort <vdonnefort@xxxxxxxxxx>
> > Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>  
> 
> That fixes fast-forward, event already read are now skipped.

Can I also add your "Tested-by" tag then?

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux