From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E7C5DC27C65 for ; Tue, 11 Jun 2024 21:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KeVwiWXIGBr3YUaybtBv3A7xFPf1GLQKVDGJMatiR/g=; b=pSRifZ1lZUGDP4K3Tet2zLUsv9 pnqeFQ2kYSjCXHrW7w3cud4P6FlX5W8msMSWxZTUoFyo8vxQJWRIfXxLsyUzMaCDGSryjPIrr3AT8 Bkb7QSYREmHtB+g7oKns1K9RtHfhWDdQnIO3EplTtXZVCnsuoBnE1i40tENGOdCA9GdBGrkuu9vPf ttQ/vdq7nTXszD5jDBj6b6jR6J+sYIAhAT3dpQfEGR3bgrOWaYBPOBzuYZHzxqcyoSPPmaNekWyWr XnwZxhbPxPS28dC8QeO9+Wtq9U3OnrkDEWuLWqjeSu2EMSD6ZLUmdwN/9IVTzbizMAGMytyucByBv a50KlGWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH9TI-0000000AKsN-0B7y; Tue, 11 Jun 2024 21:56:04 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sH9TE-0000000AKoZ-2pzd for linux-arm-kernel@lists.infradead.org; Tue, 11 Jun 2024 21:56:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5A7FF611D9; Tue, 11 Jun 2024 21:55:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CC0AC4AF52; Tue, 11 Jun 2024 21:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718142959; bh=aHnNpOpxBam7cV7S26yxOrl6yEGYk9YSZ3F06NWlAdo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uJL3IIlIE1K7zmXV5J+jP9tGO8NIuwCZW5RvE3fY57eUex6fgR30LSUGzyguhx6Qb N/kaVdrftLpPK2Rx2kCxzQPpDZhJqAysZJ78lRqlQXcoKRQFW0XuvsyixIdgdYlT2N MvTeH15XMuLy80H5liDy2T39OaTzVao3Wb3Ww0tQ50K6rsw0NsoQmg5ffzP1fdWgVc om1juoiZnlZf4kIRjtC6I8OOD6bgJmBOqaJCa6fz4W9QLolALYxTDw6qoiO7j9a0jS HCqV91LLhTWdlsymXDN7/EZSENm4VKkqWoOtl7phdsh2+vF2aGbXn2TPEo9me1d8OU kdBZUnWNnK4Zg== Date: Tue, 11 Jun 2024 14:55:56 -0700 From: Nathan Chancellor To: Linus Torvalds Cc: Peter Anvin , Ingo Molnar , Borislav Petkov , Thomas Gleixner , Rasmus Villemoes , Josh Poimboeuf , Catalin Marinas , Will Deacon , Linux Kernel Mailing List , the arch/x86 maintainers , linux-arm-kernel@lists.infradead.org, linux-arch Subject: Re: [PATCH 6/7] arm64: start using 'asm goto' for put_user() when available Message-ID: <20240611215556.GA3021057@thelio-3990X> References: <20240610204821.230388-1-torvalds@linux-foundation.org> <20240610204821.230388-7-torvalds@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240610204821.230388-7-torvalds@linux-foundation.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240611_145600_842875_5BFAF647 X-CRM114-Status: GOOD ( 17.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 > --- > 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