]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/percpu: Use compiler segment prefix qualifier
authorNadav Amit <namit@vmware.com>
Wed, 4 Oct 2023 14:49:43 +0000 (16:49 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 5 Oct 2023 07:01:52 +0000 (09:01 +0200)
commit9a462b9eafa6dda16ea8429b151edb1fb535d744
tree5a124efc314591a8d7aac4fe40dacd1ad21e11c3
parent1ca3683cc6d2c2ce4204df519c4e4730d037905a
x86/percpu: Use compiler segment prefix qualifier

Using a segment prefix qualifier is cleaner than using a segment prefix
in the inline assembly, and provides the compiler with more information,
telling it that __seg_gs:[addr] is different than [addr] when it
analyzes data dependencies. It also enables various optimizations that
will be implemented in the next patches.

Use segment prefix qualifiers when they are supported. Unfortunately,
gcc does not provide a way to remove segment qualifiers, which is needed
to use typeof() to create local instances of the per-CPU variable. For
this reason, do not use the segment qualifier for per-CPU variables, and
do casting using the segment qualifier instead.

Uros: Improve compiler support detection and update the patch
to the current mainline.

Signed-off-by: Nadav Amit <namit@vmware.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20231004145137.86537-4-ubizjak@gmail.com
arch/x86/include/asm/percpu.h
arch/x86/include/asm/preempt.h