Re: [PATCH 1/1] x86: In x86-64 barrier_nospec can always be lfence

From: Rik van Riel
Date: Sun Feb 09 2025 - 20:10:35 EST


On Sun, 2025-02-09 at 13:57 -0800, Linus Torvalds wrote:
>
> So on x86, both read and write barriers are complete no-ops, because
> all reads are ordered, and all writes are ordered.

Given that this thread started with a reference
to rdtsc, it may be worth keeping in mind that
rdtsc reads themselves do not always appear to
be ordered.

Paul and I spotted some occasionaly "backwards
TSC values" from the CSD lock instrumentation code, 
which went away when using ordered TSC reads:

https://lkml.iu.edu/hypermail/linux/kernel/2410.1/03202.html

I guess maybe a TSC read does not follow all the same
rules as a memory read, sometimes?

--
All Rights Reversed.