Re: [PATCH v11 3/4] x86/cpu: Do a sanity check on required feature bits

From: Maciej Wieczor-Retman

Date: Tue Mar 31 2026 - 04:19:07 EST


On 2026-03-30 at 22:24:24 +0100, David Laight wrote:
>On Mon, 30 Mar 2026 10:09:47 +0000
>Maciej Wieczor-Retman <m.wieczorretman@xxxxx> wrote:
>
>> On 2026-03-27 at 18:52:30 -0700, H. Peter Anvin wrote:
>...
>> >One thing that matters here is that these bitmaps are *already* accessed using
>> >bitop operations. Therefore, if this is a problem *here*, then it is a problem
>> >*everywhere*.
>>
>> I think for example the set_bit()/clear_bit() bitops are not problematic while
>> for_each_set_bit() is, specfically used in this context. Most operations seem to
>> not affect or not be affected by the potential unaligned 32-bit.
>
>Oh they are...
>Look up 'split lock'.
>
>You must not cast int[] to long[] for the 'bit' functions.
>
>Basically if the 'long' gets split over a cache-line boundary the cpu
>has to do an 'old fashioned' lock of the inter-cpu bus in order to
>perform the locked memory accesses.
>That is both slow and kills the rest of the machine.
>
> David

Oh, right, that is a problem. So the approach of declaring the long bitmap and
then copying over data there makes the most sense. Thanks for explaining!

--
Kind regards
Maciej Wieczór-Retman