[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a6f974efad4453e9af7a3152ca0bbce@AcuMS.aculab.com>
Date: Tue, 21 Apr 2020 08:00:48 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Petko Manolov' <petko.manolov@...sulko.com>,
"Paul E. McKenney" <paulmck@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: RE: [RFC] WRITE_ONCE_INC() and friends
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)
Powered by blists - more mailing lists