linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	 Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 joel@joelfernandes.org, linke li <lilinke99@qq.com>,
	Rabin Vincent <rabin@rab.in>
Subject: Re: [PATCH 0/6] tracing/ring-buffer: Fix wakeup of ring buffer waiters
Date: Fri, 8 Mar 2024 13:39:14 -0800	[thread overview]
Message-ID: <CAHk-=whaVBe14mbW4QWNuywBP_ZvGJYRZ3dbgx9-ebSxnNTXiQ@mail.gmail.com> (raw)
In-Reply-To: <20240308163528.3980c639@gandalf.local.home>

On Fri, 8 Mar 2024 at 13:33, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> There's two layers:
>
> 1) the ring buffer has the above simple producer / consumer.
>    Where the wake ups can happen at the point of where the buffer has
>    the amount filled that the consumer wants to start consuming with.
>
> 2) The tracing layer; Here on close of a file, the consumers need to be
>    woken up and not wait again. And just take whatever was there to finish
>    reading.
>
>    There's also another case that the ioctl() just kicks the current
>    readers out, but doesn't care about new readers.

But that's the beauty of just using the wait_event() model.

Just add that "exit" condition to the condition.

So the above "complexity" is *literally* just changing the

                  (new = atomic_read_acquire(&my->seq)) != old

condition to

                  should_exit ||
                  (new = atomic_read_acquire(&my->seq)) != old

(replace "should_exit" with whatever that condition is, of course) and
the wait_event() logic will take care of the rest.

             Linus

  reply	other threads:[~2024-03-08 21:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 18:38 [PATCH 0/6] tracing/ring-buffer: Fix wakeup of ring buffer waiters Steven Rostedt
2024-03-08 18:38 ` [PATCH 1/6] ring-buffer: Fix waking up ring buffer readers Steven Rostedt
2024-03-08 18:38 ` [PATCH 2/6] ring-buffer: Fix resetting of shortest_full Steven Rostedt
2024-03-08 18:38 ` [PATCH 3/6] tracing: Use .flush() call to wake up readers Steven Rostedt
2024-03-08 18:38 ` [PATCH 4/6] tracing: Fix waking up tracing readers Steven Rostedt
2024-03-08 19:13   ` Steven Rostedt
2024-03-08 18:38 ` [PATCH 5/6] ring-buffer: Restructure ring_buffer_wait() to prepare for updates Steven Rostedt
2024-03-08 18:38 ` [PATCH 6/6] tracing/ring-buffer: Fix wait_on_pipe() race Steven Rostedt
2024-03-08 20:39 ` [PATCH 0/6] tracing/ring-buffer: Fix wakeup of ring buffer waiters Linus Torvalds
2024-03-08 21:35   ` Steven Rostedt
2024-03-08 21:39     ` Linus Torvalds [this message]
2024-03-08 21:41       ` Linus Torvalds
2024-03-10 16:19         ` Steven Rostedt

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='CAHk-=whaVBe14mbW4QWNuywBP_ZvGJYRZ3dbgx9-ebSxnNTXiQ@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=joel@joelfernandes.org \
    --cc=lilinke99@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rabin@rab.in \
    --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;
as well as URLs for NNTP newsgroup(s).