RE: [PATCH v6 04/20] x86/split_lock: Align x86_capability to unsigned long to avoid split locked access

From: David Laight
Date: Fri Apr 05 2019 - 05:22:56 EST


From: Thomas Gleixner [mailto:tglx@xxxxxxxxxxxxx]
>
> On Thu, 4 Apr 2019, David Laight wrote:
...
> bitops operate on unsigned long arrays, so the RMW on the affected array
> member has to be atomic vs. other RMW operations on the same array
> member. If we make the bitops 32bit wide on x86/64 we break that.
>
> So selecting 64bit access (REX.W prefix) is correct and has to stay.

Even if the lock had a fine granularity it shouldn't matter whether
two RMW operations on different parts of the same 'long' happened
at the same time.
ISTR some of the 'constant bit offset' are done with byte sized
locked transfers.

The problem here is that the bitmap is defined as __u32[] not
unsigned long[].

- __u32 x86_capability[NCAPINTS + NBUGINTS];
+ /* Unsigned long alignment to avoid split lock in atomic bitmap ops */
+ __u32 x86_capability[NCAPINTS + NBUGINTS]
+ __aligned(sizeof(unsigned long));

Somewhere there is a cast.....

David

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