Re: [kvm-unit-tests PATCH v1 2/2] s390x: firq: floating interrupt test

David Hildenbrand
2021-12-02T11:26:25Z

On 02.12.21 12:13, David Hildenbrand wrote:
>>> +static void wait_for_sclp_int(void)
>>> +{
>>> + /* Enable SCLP interrupts on this CPU only. */
>>> + ctl_set_bit(0, CTL0_SERVICE_SIGNAL);
>>> +
>>> + set_flag(1);
>>
>> why not just WRITE_ONCE/READ_ONCE?
>
> Because I shamelessly copied that from s390x/smp.c ;)

Oh, and also because WRITE_ONCE/READ_ONCE are semantically the wrong
thing to use:

"Prevent the compiler from merging or refetching reads or writes. The
compiler is also forbidden from reordering successive instances of
READ_ONCE and WRITE_ONCE"

We need memory barriers to prevent reordering with surrounding code.

--
Thanks,

David / dhildenb