From: Steven Rostedt <rostedt@goodmis.org>
To: Vincent Donnefort <vdonnefort@google.com>
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v2 1/2] ring-buffer: Introducing ring-buffer mapping functions
Date: Wed, 29 Mar 2023 08:47:35 -0400 [thread overview]
Message-ID: <20230329084735.6c4a9229@rorschach.local.home> (raw)
In-Reply-To: <ZCQtpbyWrjliJkdg@google.com>
On Wed, 29 Mar 2023 13:23:01 +0100
Vincent Donnefort <vdonnefort@google.com> wrote:
> On Wed, Mar 29, 2023 at 07:03:53AM -0400, Steven Rostedt wrote:
> > On Wed, 29 Mar 2023 10:19:44 +0100
> > Vincent Donnefort <vdonnefort@google.com> wrote:
> >
> > > > I've been playing with this a bit, and I'm thinking, do we need the
> > > > data_pages[] array on the meta page?
> > > >
> > > > I noticed that I'm not even using it.
> > > >
> > > > Currently, we need to do a ioctl every time we finish with the reader page,
> > > > and that updates the reader_page in the meta data to point to the next page
> > > > to read. When do we need to look at the data_start section?
> > >
> > > This is for non-consuming read, to get all the pages in order.
> >
> > Yeah, I was trying to see how a non consuming read would work, and was
> > having issues figuring that out without the tail page being updated.
>
> Would the userspace really need to know where is the tail page? It can just stop
> whenever it finds out a page doesn't have any events, and make sure it does not
> loop once back to the head?
I'm trying to come up with a possible algorithm that doesn't need
ioctls. It would need to know if the writer moved or not. Probably need
a counter that gets incremented every time the writer goes to a new page.
Having the tail page was just a convenient way to know where the end is.
>
> >
> > >
> > > If we remove this section we would lose this ability ... but we'd also simplify
> > > the code by a good order of magnitude (don't need the update ioctl anymore, no
> > > need to keep those pages in order and everything can fit a 0-order meta-page).
> > > And the non-consuming read doesn't bring much to the user over the pipe version.
> > >
> > > This will although impact our hypervisor tracing which will only be able to
> > > expose trace_pipe interfaces. But I don't think it is a problem, all userspace
> > > tools only relying on consuming read anyway.
> > >
> > > So if you're happy dropping this support, let's get rid of it.
> >
> > I don't really want to get rid of it, but perhaps break it up where we
> > don't have it in the first release, but add it in a second one. That will
> > also make sure that we can expand the API if necessary (one reason I wanted
> > the "data_start" in the first place).
> >
> > Let's drop it for now, but be able to add it later, an have the current
> > structure be:
>
> Ok, I will prepare a V3 accordingly.
>
> >
> > struct ring_buffer_meta_page_header {
> > #if __BITS_PER_LONG == 64
> > __u64 entries;
> > __u64 overrun;
> > #else
> > __u32 entries;
> > __u32 overrun;
> > #endif
> > __u32 pages_touched;
> > __u32 meta_page_size;
> > __u32 reader_page; /* page ID for the reader page */
> > __u32 nr_data_pages; /* doesn't take into account the reader_page */
> > };
> >
> > BTW, shouldn't the nr_data_pages take into account the reader page? As it
> > is part of the array we traverse isn't it?
>
> It depends if the reader page has ever been swapped out. If yes, the reader
> would have to start from reader_page and then switch to the data_pages.
> Which sounds like a fiddly interface for the userspace.
>
> So yeah, consuming-read only feels like a better start.
>
I agree. I'd like to get something in that can be extended, but simple
enough that it's not too much of a barrier wrt getting the API correct.
-- Steve
next prev parent reply other threads:[~2023-03-29 12:47 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 10:22 [PATCH v2 0/2] Introducing trace buffer mapping by user-space Vincent Donnefort
2023-03-22 10:22 ` [PATCH v2 1/2] ring-buffer: Introducing ring-buffer mapping functions Vincent Donnefort
2023-03-29 2:44 ` Steven Rostedt
2023-03-29 9:19 ` Vincent Donnefort
2023-03-29 11:03 ` Steven Rostedt
2023-03-29 12:07 ` Steven Rostedt
2023-03-29 12:27 ` Vincent Donnefort
2023-03-29 12:23 ` Vincent Donnefort
2023-03-29 12:47 ` Steven Rostedt [this message]
2023-03-29 13:10 ` Vincent Donnefort
2023-03-29 13:14 ` Steven Rostedt
2023-03-30 14:48 ` Vincent Donnefort
2023-03-29 12:51 ` Steven Rostedt
2023-03-29 13:01 ` Vincent Donnefort
2023-03-29 13:11 ` Steven Rostedt
2023-03-29 13:31 ` Vincent Donnefort
2023-03-29 13:36 ` Steven Rostedt
2023-03-29 13:55 ` Vincent Donnefort
2023-03-29 15:08 ` Vincent Donnefort
2023-03-29 15:32 ` Steven Rostedt
2023-03-30 10:30 ` Vincent Donnefort
2023-03-30 15:21 ` Steven Rostedt
2023-03-22 10:22 ` [PATCH v2 2/2] tracing: Allow user-space mapping of the ring-buffer Vincent Donnefort
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230329084735.6c4a9229@rorschach.local.home \
--to=rostedt@goodmis.org \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=vdonnefort@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).