Re: [PATCH 19/20] x86/uaccess: Use alternative_io() in __untagged_addr()
From: Uros Bizjak
Date: Sat Mar 15 2025 - 05:13:16 EST
On Fri, Mar 14, 2025 at 10:42 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> Use the standard alternative_io() interface.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> ---
> arch/x86/include/asm/uaccess_64.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
> index c52f0133425b..b507d5fb5443 100644
> --- a/arch/x86/include/asm/uaccess_64.h
> +++ b/arch/x86/include/asm/uaccess_64.h
> @@ -26,10 +26,10 @@ extern unsigned long USER_PTR_MAX;
> */
> static inline unsigned long __untagged_addr(unsigned long addr)
> {
> - asm (ALTERNATIVE("",
> - "and " __percpu_arg([mask]) ", %[addr]", X86_FEATURE_LAM)
> - : [addr] "+r" (addr)
> - : [mask] "m" (__my_cpu_var(tlbstate_untag_mask)));
> + alternative_io("",
No, alternative_io() declares asm as volatile. Please define
alternative_io_nv (or something like that) that will not use
volatile. You will penalize the above asm unnecessarily with volatile.
Thanks,
Uros.