[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZCRUYQHORVund9PC@google.com>
Date: Wed, 29 Mar 2023 16:08:17 +0100
From: Vincent Donnefort <vdonnefort@...gle.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: mhiramat@...nel.org, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, kernel-team@...roid.com
Subject: Re: [PATCH v2 1/2] ring-buffer: Introducing ring-buffer mapping
functions
On Wed, Mar 29, 2023 at 02:55:41PM +0100, Vincent Donnefort wrote:
> On Wed, Mar 29, 2023 at 09:36:46AM -0400, Steven Rostedt wrote:
> > On Wed, 29 Mar 2023 14:31:07 +0100
> > Vincent Donnefort <vdonnefort@...gle.com> wrote:
> >
> > > We can say we update cpu_buffer->reader_page->read on the get_reader_page ioctl,
> > > to the most recent value possible, which will have the consequence of actually
> > > "flushing" those events?
> >
> > Yes. It should be no different than doing a normal read of the
> > trace_pipe_raw file, which does the same.
> >
> > >
> > > If the reader decides to read events past this value then it just can't expect
> > > them to not be duplicated?
> > >
> > > I suppose it'd be down the reader to store meta->read somehwere?
> > >
> > > prev_read = meta->read
> > > ioctl(fd, TRACE_MMAP_IOCTL_GET_READER_PAGE)
> > > /* read events from prev_read to meta->read */
> >
> > Yes, in fact it shouldn't need to call the ioctl until after it read it.
> >
> > Maybe, we should have the ioctl take a parameter of how much was read?
> > To prevent races?
>
> Races would only be with other consuming readers. In that case we'd probably
> have many other problems anyway as I suppose nothing would prevent another one
> of swapping the page while our userspace reader is still processing it?
>
> I don't know if this is worth splitting the ABI between the meta-page and the
> ioctl parameters for this?
>
> Or maybe we should say the meta-page contains things modified by the writer and
> parameters modified by the reader are passed by the get_reader_page ioctl i.e.
> the reader page ID and cpu_buffer->reader_page->read? (for the hyp tracing, we
> have up to 4 registers for the HVC which would replace in our case the ioctl)
Or we can keep everything in the meta-page but update the "reader bits" only
during the get_reader_page ioctl.
I can prepare something around those lines for the v3.
>
> >
> > That is, it should pass in the page->commit that it used to to read the
> > pages.
> >
> > -- Steve
Powered by blists - more mailing lists