[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240611215556.GA3021057@thelio-3990X>
Date: Tue, 11 Jun 2024 14:55:56 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Anvin <hpa@...or.com>, Ingo Molnar <mingo@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
linux-arch <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 6/7] arm64: start using 'asm goto' for put_user() when
available
Hi Linus,
On Mon, Jun 10, 2024 at 01:48:20PM -0700, Linus Torvalds wrote:
> This generates noticeably better code with compilers that support it,
> since we don't need to test the error register etc, the exception just
> jumps to the error handling directly.
>
> Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> ---
> arch/arm64/include/asm/uaccess.h | 77 +++++++++++++++++++-------------
> 1 file changed, 46 insertions(+), 31 deletions(-)
>
> diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h
> index 23c2edf517ed..4ab3938290ab 100644
> --- a/arch/arm64/include/asm/uaccess.h
> +++ b/arch/arm64/include/asm/uaccess.h
> @@ -294,29 +294,41 @@ do { \
> } while (0); \
> } while (0)
>
> -#define __put_mem_asm(store, reg, x, addr, err, type) \
> +#ifdef CONFIG_CC_HAS_ASM_GOTO
This symbol was eliminated two years ago with commit a0a12c3ed057 ("asm
goto: eradicate CC_HAS_ASM_GOTO") since all supported compilers have
support for it.
> +#define __put_mem_asm(store, reg, x, addr, label, type) \
> + asm goto( \
> + "1: " store " " reg "0, [%1]\n" \
> + "2:\n" \
> + _ASM_EXTABLE_##type##ACCESS_ZERO(1b, %l2) \
> + : : "rZ" (x), "r" (addr) : : label)
> +#else
> +#define __put_mem_asm(store, reg, x, addr, label, type) do { \
> + int __pma_err = 0; \
> asm volatile( \
> "1: " store " " reg "1, [%2]\n" \
> "2:\n" \
> _ASM_EXTABLE_##type##ACCESS_ERR(1b, 2b, %w0) \
> - : "+r" (err) \
> - : "rZ" (x), "r" (addr))
> + : "+r" (__pma_err) \
> + : "rZ" (x), "r" (addr)); \
> + if (__pma_err) goto label; \
> +} while (0)
> +#endif
Cheers,
Nathan
Powered by blists - more mailing lists