mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Petko Manolov' <petko.manolov@konsulko.com>,
	"Paul E. McKenney" <paulmck@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: RE: [RFC] WRITE_ONCE_INC() and friends
Date: Tue, 21 Apr 2020 08:00:48 +0000	[thread overview]
Message-ID: <3a6f974efad4453e9af7a3152ca0bbce@AcuMS.aculab.com> (raw)
In-Reply-To: <20200420163215.GA43378@carbon>

From: Petko Manolov
> Sent: 20 April 2020 17:32
...
> > But one downside of declaring variables volatile is that it can prevent KCSAN
> > from spotting violations of the concurrency design for those variables.
> 
> Which would be unfortunate.
> 
> I just wish there was C type declaration that would force the compiler to do
> what READ/WRITE_ONCE() does now, but i also know this is too naive... :)

It does, it is called 'volatile'.

All READ_ONCE() does is force the access through a volatile pointer.

The thing to do is mark the structure elements 'volatile'
rather than using a 'pointer to volatile structure'.

I'm sure KASAN could be taught about volatile structure members.

	David.

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  reply	other threads:[~2020-04-21  8:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-19  9:44 Petko Manolov
2020-04-19 18:02 ` David Laight
2020-04-19 18:29   ` Petko Manolov
2020-04-19 21:37     ` David Laight
2020-04-20 15:05       ` Paul E. McKenney
2020-04-20 16:32         ` Petko Manolov
2020-04-21  8:00           ` David Laight [this message]
2020-04-21  9:30             ` Petko Manolov
2020-04-20 22:57         ` Marco Elver
2020-04-20 23:12           ` Paul E. McKenney
2020-04-21  9:33             ` Marco Elver
2020-04-21 13:19               ` 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=3a6f974efad4453e9af7a3152ca0bbce@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=petko.manolov@konsulko.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

Powered by JetHome