From: Breno Leitao <leitao@debian.org>
To: Marco Elver <elver@google.com>, paulmck@kernel.org
Cc: paulmck@kernel.org, Bart Van Assche <bvanassche@acm.org>,
Jens Axboe <axboe@kernel.dk>,
"open list:BLOCK LAYER" <linux-block@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] block: Annotate a racy read in blk_do_io_stat()
Date: Wed, 15 May 2024 05:48:41 -0700 [thread overview]
Message-ID: <ZkSvKbWj1lhGZvLE@gmail.com> (raw)
In-Reply-To: <CANpmjNMqRUNUs1mZEhrOSyK0Hk+PdGOi+VAs22qYD+1zTkwfhg@mail.gmail.com>
On Wed, May 15, 2024 at 09:58:35AM +0200, Marco Elver wrote:
> On Wed, 15 May 2024 at 01:47, Paul E. McKenney <paulmck@kernel.org> wrote:
> > On Mon, May 13, 2024 at 10:13:49AM +0200, Marco Elver wrote:
> > +Use of volatile and __data_racy
> > +-------------------------------
> > +
> > +Adding the volatile keyword to the declaration of a variable causes both
> > +the compiler and KCSAN to treat all reads from that variable as if they
> > +were protected by READ_ONCE() and all writes to that variable as if they
> > +were protected by WRITE_ONCE().
> "volatile" isn't something we encourage, right? In which case, I think
> to avoid confusion we should not mention volatile. After all we have
> this: Documentation/process/volatile-considered-harmful.rst
Since you mentioned this document, the other day I was reading
volatile-considered-harmful.rst document, and I was surprised that there
is no reference for READ_ONCE() primitive at all (same for WRITE_ONCE).
# grep -c READ_ONCE Documentation/process/volatile-considered-harmful.rst
0
From my perspective, READ_ONCE() is another way of doing real memory
read (volatile) when you really need, at the same time keeping the
compiler free to optimize and reuse the value that was read.
Should volatile-considered-harmful.rst be also expanded to cover
READ_ONCE()?
Thanks!
--breno
next prev parent reply other threads:[~2024-05-15 12:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 14:19 [PATCH] block: Annotate a racy read in blk_do_io_stat() Breno Leitao
2024-05-10 14:28 ` Bart Van Assche
2024-05-10 14:57 ` Breno Leitao
2024-05-10 15:41 ` Paul E. McKenney
2024-05-10 16:20 ` Bart Van Assche
2024-05-10 17:08 ` Paul E. McKenney
2024-05-10 20:30 ` Bart Van Assche
2024-05-10 22:35 ` Paul E. McKenney
2024-05-10 23:22 ` Bart Van Assche
2024-05-11 0:41 ` Paul E. McKenney
2024-05-13 8:13 ` Marco Elver
2024-05-14 23:47 ` Paul E. McKenney
2024-05-15 7:58 ` Marco Elver
2024-05-15 12:48 ` Breno Leitao [this message]
2024-05-15 13:20 ` Marco Elver
2024-05-15 15:57 ` Paul E. McKenney
2024-05-15 17:40 ` Marco Elver
2024-05-15 21:51 ` Paul E. McKenney
2024-05-16 6:35 ` Marco Elver
2024-05-20 18:05 ` Paul E. McKenney
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=ZkSvKbWj1lhGZvLE@gmail.com \
--to=leitao@debian.org \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=elver@google.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.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