Re: [PATCH -tip v3 3/4] x86/segment: Use ASM_INPUT_RM in __loadsegment_fs()

From: Nathan Chancellor

Date: Fri Mar 13 2026 - 21:46:35 EST


On Thu, Mar 12, 2026 at 10:58:57PM +0100, Uros Bizjak wrote:
> Use the ASM_INPUT_RM macro in __loadsegment_fs() to work around clang
> problems with "rm" asm constraint. clang seems to always chose the
> memory input, while it is almost always the worst choice.
>
> Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx>
> Acked-by: "Peter Zijlstra (Intel)" <peterz@xxxxxxxxxxxxx>

Acked-by: Nathan Chancellor <nathan@xxxxxxxxxx>

> Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
> Cc: Nathan Chancellor <nathan@xxxxxxxxxx>
> Cc: Nick Desaulniers <nick.desaulniers+lkml@xxxxxxxxx>
> Cc: Bill Wendling <morbo@xxxxxxxxxx>
> Cc: Justin Stitt <justinstitt@xxxxxxxxxx>
> ---
> arch/x86/include/asm/segment.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
> index 3fe3a310844c..0f4283dcd0c4 100644
> --- a/arch/x86/include/asm/segment.h
> +++ b/arch/x86/include/asm/segment.h
> @@ -335,7 +335,7 @@ static inline void __loadsegment_fs(unsigned short value)
>
> _ASM_EXTABLE_TYPE(1b, 2b, EX_TYPE_CLEAR_FS)
>
> - : : "rm" (value) : "memory");
> + : : ASM_INPUT_RM (value) : "memory");
> }
>
> /* __loadsegment_gs is intentionally undefined. Use load_gs_index instead. */
> --
> 2.53.0
>