• Nadav Amit's avatar
    x86/percpu: Use compiler segment prefix qualifier · 9a462b9e
    Nadav Amit authored
    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: default avatarNadav Amit <namit@vmware.com>
    Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
    Signed-off-by: default avatarIngo 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
    9a462b9e
percpu.h 21.4 KB