public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: paulmck@kernel.org, Waiman Long <llong@redhat.com>
Cc: Daniel Xu <dxu@dxuuu.xyz>,
	mingo@redhat.com, will@kernel.org, peterz@infradead.org,
	boqun.feng@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] seqlock: Use WRITE_ONCE() when updating sequence
Date: Wed, 18 Dec 2024 15:09:19 -0500	[thread overview]
Message-ID: <93eea003-052d-4a9d-b8e8-a77043f59912@redhat.com> (raw)
In-Reply-To: <b00e0fb8-7cd3-4e00-b1ea-92a82681fb99@paulmck-laptop>


On 12/18/24 1:52 PM, Paul E. McKenney wrote:
>> If the compiler really uses the variable as a scratch storage, it will be a
>> problem if the variable can be accessed concurrently from multiple CPUs. It
>> is a new compiler optimization strategy that I am aware before. In that
>> case, we may really need a way to mark these variables as not suitable for
>> such advanced optimization.
> These markings already exist, namely, the "volatile" keyword, READ_ONCE(),
> WRITE_ONCE(), and hopefully soon INC_ONCE().  These last three use
> volatile accesses internally.
>
> The scratch-storage possibility exists only just before a normal
> C-language store, not before volatile accesses.  So a compiler is
> forbidden from doing that scratch-value-store trick before a volatile
> store.

I am aware of that in READ_ONCE() and WRITE_ONCE() and I am looking 
forward to have a INC_ONCE() and maybe DEC_ONCE() soon.

Cheers,
Longman


  reply	other threads:[~2024-12-18 20:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 23:17 [PATCH] seqlock: Use WRITE_ONCE() when updating sequence Daniel Xu
2024-12-18  3:30 ` Waiman Long
2024-12-18 15:45   ` Paul E. McKenney
2024-12-18 16:10     ` Waiman Long
2024-12-18 16:57       ` Paul E. McKenney
2024-12-18 18:38         ` Waiman Long
2024-12-18 18:52           ` Paul E. McKenney
2024-12-18 20:09             ` Waiman Long [this message]
2024-12-18 10:30 ` Peter Zijlstra
2024-12-18 15:43   ` Paul E. McKenney
2024-12-18 16:23     ` Peter Zijlstra
2024-12-18 16:29       ` Peter Zijlstra
2024-12-18 16:59         ` Paul E. McKenney
2024-12-18 17:12           ` Peter Zijlstra
2024-12-18 19:15             ` Paul E. McKenney
2024-12-18 19:56             ` Florian Weimer
2024-12-19 16:10               ` Paul E. McKenney
2024-12-19 16:45                 ` Florian Weimer
2024-12-19 17:48                   ` Paul E. McKenney
2024-12-19 17:53                   ` Peter Zijlstra
2024-12-19 16:34             ` Will Deacon
2024-12-19 17:53               ` Paul E. McKenney
2024-12-19 17:58                 ` Will Deacon
2024-12-19 18:06                   ` Paul E. McKenney
2024-12-19 18:31                     ` Will Deacon
2024-12-20 17:40                       ` Paul E. McKenney
2025-01-25  0:31 ` Daniel Xu

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=93eea003-052d-4a9d-b8e8-a77043f59912@redhat.com \
    --to=llong@redhat.com \
    --cc=boqun.feng@gmail.com \
    --cc=dxu@dxuuu.xyz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=will@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