Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Paul E. McKenney
On Thu, Dec 04, 2014 at 09:45:46PM +, One Thousand Gnomes wrote: > > anywhere in that translation unit. After all, any non-static function > > in that translation unit might be called from some other translation > > unit that -did- use locking or whatever. > > > > I will let you know how it g

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread One Thousand Gnomes
> anywhere in that translation unit. After all, any non-static function > in that translation unit might be called from some other translation > unit that -did- use locking or whatever. > > I will let you know how it goes. ;-) It breaks DEC10 ;-) If there is kickback over things like optimisat

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Paul E. McKenney
On Thu, Dec 04, 2014 at 12:00:52PM -0800, Paul E. McKenney wrote: [ . . . ] > So any compiler that clobbers some adjacent non-bitfield variable or > field that is accessible by other threads is not just despicable, it > fails to conform to the standard. > > Whew! ;-) And part of the reason for

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Paul E. McKenney
On Thu, Dec 04, 2014 at 11:18:17AM -0800, Linus Torvalds wrote: > On Thu, Dec 4, 2014 at 10:36 AM, Paul E. McKenney > wrote: > > > > I have to ask... Does this mean we can remove the current > > restrictions against 8-bit and 16-bit access from smp_load_acquire() > > and smp_store_release()? > >

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Linus Torvalds
On Thu, Dec 4, 2014 at 10:36 AM, Paul E. McKenney wrote: > > I have to ask... Does this mean we can remove the current > restrictions against 8-bit and 16-bit access from smp_load_acquire() > and smp_store_release()? I'd certainly be ok with it. Alpha doesn't have acquire/release semantics anywa

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Paul E. McKenney
On Thu, Dec 04, 2014 at 10:02:14AM -0800, Linus Torvalds wrote: > On Wed, Dec 3, 2014 at 11:02 PM, Paul E. McKenney > wrote: > > On Wed, Dec 03, 2014 at 10:40:45PM -0800, Linus Torvalds wrote: > >> On Dec 3, 2014 10:31 PM, "Linus Torvalds" > >> wrote: > >> > > >> > So no, no, no. C got this wrong

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-04 Thread Linus Torvalds
On Wed, Dec 3, 2014 at 11:02 PM, Paul E. McKenney wrote: > On Wed, Dec 03, 2014 at 10:40:45PM -0800, Linus Torvalds wrote: >> On Dec 3, 2014 10:31 PM, "Linus Torvalds" >> wrote: >> > >> > So no, no, no. C got this wrong. Volatile data structures are a >> fundamental mistake and a bug. >> >> BTW,

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-03 Thread Paul E. McKenney
On Wed, Dec 03, 2014 at 10:40:45PM -0800, Linus Torvalds wrote: > On Dec 3, 2014 10:31 PM, "Linus Torvalds" > wrote: > > > > So no, no, no. C got this wrong. Volatile data structures are a > fundamental mistake and a bug. > > BTW, I'm not at all interested in language lawyering and people who say

Re: [PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-03 Thread Paul E. McKenney
One point of the patch is "one more thing to watch for" in generated code, namely temporary clobbering of synchronization variables, locks included, due to overzealous optimization. If this happens to the kernel, I guess that the other quick workaround is to add alignment directives or padding. (A

[PATCH RFC] locking: Add volatile to arch_spinlock_t structures

2014-12-03 Thread Paul E. McKenney
More concern about compilers... Most architectures mark the fields in their arch_spinlock_t structures as volatile, which forces the compiler to respect the integrity of those fields. Without volatile markings, the compiler is within its rights to overwrite these fields, for example, by using a w