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 09:11:07 -0400 [thread overview]
Message-ID: <20230329091107.408d63a8@rorschach.local.home> (raw)
In-Reply-To: <ZCQ2jW5Jl/cWCG7s@google.com>
On Wed, 29 Mar 2023 14:01:01 +0100
Vincent Donnefort <vdonnefort@google.com> wrote:
> > Oh, I guess we should also expose the amount read on the reader page,
> > that gets updated on the ioctl. That is, if the first time we read the
> > reader page and the page is not full and unmap the pages, and then new
> > events were added to the reader page, we should not re-read the events
> > that were read previously.
> >
> > That is, expose cpu_buffer->reader_page->read
>
> Couldn't it be an issue of updating cpu_buffer->reader_page->read during the
> ioctl? I guess we would write the value of the current written events on that
> page, hopping for the userspace reader to read it all.
>
> But then if new events are written, the reader doesn't need the ioctl to read
> them, it can just check the meta->entries field or the commit field in the
> reader_page header?
>
> So it's much likely cpu_buffer->reader_page->read will go out of sync?
Here's the issue I found during testing:
write 10 events to ring buffer (all go into the reader page)
Run application that maps the pages, and reads the 10 events, and exits.
Write 10 more events to ring buffer (all are appended to the reader page)
Run application that maps the pages and reads 20 events, and exits.
It read the 10 previous events, but should not have. It should have
only read the last 10 that were not read previously.
-- Steve
next prev parent reply other threads:[~2023-03-29 13:11 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
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 [this message]
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=20230329091107.408d63a8@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).