Re: [PATCH 3/7] x86: make CX8 usage unconditional

From: Arnd Bergmann

Date: Mon Nov 09 2026 - 05:21:28 EST



>> - asm_inline qual ( \
>> - ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
>> - "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
>> - : ALT_OUTPUT_SP([var] "+m" (__my_cpu_var(_var)), \
>> - "+a" (old__.low), "+d" (old__.high)) \
>> + asm_inline qual ("cmpxchg8b " __percpu_arg([var]) \
>
> This can be plain "asm" instead of "asm_inline"; there is only one asm
> instruction in the asm template.
>
>> + : [var] "+m" (__my_cpu_var(_var)), \
>> + "+a" (old__.low), "+d" (old__.high) \
>> : "b" (new__.low), "c" (new__.high), \
>> "S" (&(_var)) \
>
> The line above was needed to force address of _var in %esi. This is not
> needed anymore.
>> : "memory"); \
>> @@ -359,10 +357,8 @@ do { \
>> old__.var = *_oval; \
>> new__.var = _nval; \
>> \
>> - asm_inline qual ( \
>> - ALTERNATIVE("call this_cpu_cmpxchg8b_emu", \
>> - "cmpxchg8b " __percpu_arg([var]), X86_FEATURE_CX8) \
>> - : ALT_OUTPUT_SP("=@ccz" (success), \
>> + asm_inline qual ("cmpxchg8b " __percpu_arg([var]) \
>
> Also here, use "asm" and remove "S" constraint. Please see [1].
>
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git/commit/?h=WIP.x86/cpu&id=8cfdd354dae90a3db46c351d15c801dfbf76fc5a
>

Hi Uros,

Thanks for the suggestions, I changed it all as you suggested now.

Arnd