Re: [PATCH RFC] timekeeping: don't use seqcount loop in ktime_mono_to_any on 64-bit arch

From: Thomas Gleixner
Date: Tue Sep 10 2024 - 11:40:27 EST


On Tue, Sep 10 2024 at 08:32, Jeff Layton wrote:
> On Tue, 2024-09-10 at 13:58 +0200, Thomas Gleixner wrote:
>> > +#if BITS_PER_LONG == 64
>> > +ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs)
>> > +{
>> > + ktime_t *offset = offsets[offs];
>> > +
>> > + return ktime_add(tmono, READ_ONCE(*offset));
>>
>> Where is the corresponing WRITE_ONCE()?
>>
> I'll just make it do a simple fetch without READ_ONCE.

Which will make KCSAN complain ...

So yes, READ_ONCE() is the correct thing todo, but then we want to have
the counterpart at the write sides.

Thanks,

tglx