From: Vincent Donnefort <vdonnefort@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v5 1/2] ring-buffer: Introducing ring-buffer mapping functions
Date: Wed, 2 Aug 2023 13:30:56 +0100 [thread overview]
Message-ID: <ZMpMgA85+DyGirXa@google.com> (raw)
In-Reply-To: <20230802074526.2fa479ab@gandalf.local.home>
On Wed, Aug 02, 2023 at 07:45:26AM -0400, Steven Rostedt wrote:
> On Tue, 1 Aug 2023 13:26:03 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > > +
> > > + if (READ_ONCE(cpu_buffer->mapped)) {
> > > + /* Ensure the meta_page is ready */
> > > + smp_rmb();
> > > + WRITE_ONCE(cpu_buffer->meta_page->pages_touched,
> > > + local_read(&cpu_buffer->pages_touched));
> > > + }
> >
> > I was thinking instead of doing this in the semi fast path, put this logic
> > into the rb_wakeup_waiters() code. That is, if a task is mapped, we call
> > the irq_work() to do this for us. It could even do more, like handle
> > blocked mapped waiters.
>
> I was thinking how to implement this, and I worry that it may cause an irq
> storm. Let's keep this (and the other locations) as is, where we do the
> updates in place. Then we can look at seeing if it is possible to do it in
> a delayed fashion another time.
I actually looking at this. How about:
On the userspace side, a simple poll:
static void wait_entries(int fd)
{
struct pollfd pollfd = {
.fd = fd,
.events = POLLIN,
};
if (poll(&pollfd, 1, -1) == -1)
pdie("poll");
}
And on the kernel side, just a function to update the "writer fields" of the
meta-page:
static void rb_wake_up_waiters(struct irq_work *work)
{
struct rb_irq_work *rbwork = container_of(work, struct rb_irq_work, work);
+ struct ring_buffer_per_cpu *cpu_buffer =
+ container_of(rbwork, struct ring_buffer_per_cpu, irq_work);
+
+ rb_update_meta_page(cpu_buffer);
wake_up_all(&rbwork->waiters);
That would rate limit the number of updates to the meta-page without any irq storm?
>
> -- Steve
next prev parent reply other threads:[~2023-08-02 12:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 16:47 [PATCH v5 0/2] Introducing trace buffer mapping by user-space Vincent Donnefort
2023-07-28 16:47 ` [PATCH v5 1/2] ring-buffer: Introducing ring-buffer mapping functions Vincent Donnefort
2023-07-29 1:09 ` kernel test robot
2023-07-29 3:44 ` kernel test robot
2023-08-01 17:26 ` Steven Rostedt
2023-08-02 11:45 ` Steven Rostedt
2023-08-02 12:30 ` Vincent Donnefort [this message]
2023-08-02 15:13 ` Steven Rostedt
2023-08-03 10:33 ` Vincent Donnefort
2023-08-03 14:52 ` Steven Rostedt
2023-07-28 16:47 ` [PATCH v5 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=ZMpMgA85+DyGirXa@google.com \
--to=vdonnefort@google.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
/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