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 v5 1/2] ring-buffer: Introducing ring-buffer mapping functions
Date: Thu, 3 Aug 2023 10:52:42 -0400 [thread overview]
Message-ID: <20230803105242.2df8831d@gandalf.local.home> (raw)
In-Reply-To: <ZMuCg/J8gwbb0PXd@google.com>
On Thu, 3 Aug 2023 11:33:39 +0100
Vincent Donnefort <vdonnefort@google.com> wrote:
> [...]
>
> > > 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?
> > >
> >
> > Is poll an issue? It requires user space to do a system call to see if
> > there's more data? But I guess that's not too much of an issue, as it needs
> > to do the ioctl to get the reader page.
>
> I don't think there's any problem with this approach, beside the extra system
> call...
>
> >
> > We could also add an option to the ioctl to block, or have the ioctl honor
> > the NON_BLOCK flags of the fd?
>
> ... but indeed, we could block there. The userspace interface would be even simpler.
> How about?
>
> +++ b/kernel/trace/trace.c
> @@ -8499,12 +8499,22 @@ static long tracing_buffers_ioctl(struct file *file, unsigned int cmd, unsigned
> {
> struct ftrace_buffer_info *info = file->private_data;
> struct trace_iterator *iter = &info->iter;
> + int err;
> +
> + if (cmd == TRACE_MMAP_IOCTL_GET_READER_PAGE) {
> + if (!(file->f_flags & O_NONBLOCK)) {
> + err = ring_buffer_wait(iter->array_buffer->buffer,
> + iter->cpu_file,
> + iter->tr->buffer_percent);
> + if (err)
> + return err;
> + }
>
> - if (cmd == TRACE_MMAP_IOCTL_GET_READER_PAGE)
> return ring_buffer_map_get_reader_page(iter->array_buffer->buffer,
> iter->cpu_file);
>
Looks good to me.
-- Steve
next prev parent reply other threads:[~2023-08-03 14:52 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
2023-08-02 15:13 ` Steven Rostedt
2023-08-03 10:33 ` Vincent Donnefort
2023-08-03 14:52 ` Steven Rostedt [this message]
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=20230803105242.2df8831d@gandalf.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).