Re: [PATCH v2 -tip] x86/percpu: Use C for arch_raw_cpu_ptr()

From: Linus Torvalds
Date: Wed Oct 18 2023 - 14:16:26 EST


On Wed, 18 Oct 2023 at 11:08, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>
> But loads from non-const memory work like the above.

Yes, I'm certainly ok with the move to use plain loads from __seg_gs
for the percpu accesses. If they didn't honor the memory clobber, we
could never use it at all.

I was just saying that the 'const' alias trick isn't useful for
anything else than 'current', because everything else needs to at
least honor our existing barriers.

(And yes, there's the other user of this_cpu_read_stable() -
'top_of_stack', but as mentioned that doesn't really matter).

Linus