Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp63259lqp; Tue, 11 Jun 2024 14:56:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhkOy2gt0OL5RRZ3H9FD+fWLrCcLE1iTjnylgCa1muGE91OUZCvLQiWZSwzkySXYJ51XFzsB+fyviR6u8UP3Z+wVtoYflby6fJ1FZsJg== X-Google-Smtp-Source: AGHT+IH0sS93kpD+ak4nbrZcYlvZnG+GsHJhbb9OEBoqDYJV+iM5p2MScKzA3kfawR8T1Hiliqly X-Received: by 2002:a05:6214:468c:b0:6b0:7fcf:36b8 with SMTP id 6a1803df08f44-6b07fcf391bmr83558236d6.53.1718142971987; Tue, 11 Jun 2024 14:56:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718142971; cv=pass; d=google.com; s=arc-20160816; b=arBz35If93IXvxHGSx08pqvLm8uoGpYG+l+uwBcmJC5LmfFoqkHSnVcOHyoEWwE6LS rkLqrEM+ps4AooRL/jDUVfL/l0wPsHz9/X0L7srVvgUvYTxgrtSvd2OLqjfCtmkaoXPO tTXbw+5Gc5UlUN9f71MttLeRQQLS5uGU9Z77stC7drFYyUAji/qtdYZiWhSXRYbpCgK+ WwEL2p9fr/Qv92PM2UYqNDrwMHKbzc4Np7dPYqx4lss8IqZWLCKCK/2tjgxPu//hzXrL J3VCi2BdsQ9lzhk0l7hKmtzClJUM6ZcWtJ2LMkJLkGy5chOQXQZGDjmR5Z1XOVR3RTQo 2ixA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KeVwiWXIGBr3YUaybtBv3A7xFPf1GLQKVDGJMatiR/g=; fh=pRn1dCCCDMYFjvWA3G+g8ETmqk49SnxJqcrd5w2g+yU=; b=qplBHh6M5lwqMzT1YnqKTelXbbqXfMBj5I290QiBSZ6lJ6LmPzP/yI64jFiWiFP+7S b+OsFwBC55n4Tye0Lj6Vxhyv3elO28tlKGtlrKC2tA3ZYaYHH77P0lcEgoiKWFHou0cx SRk3OiDSKffeJmom4CEo39eJHKc5HRVibxuBJOGLTlcoEkuy06LUsi+ObPlBvkxsxyby SW5rkmTKb6ZJuxs83dUr0L/M3Zb+j9r8PsPSOYxCOdVGPv0IYLOAqaaLwKAmvtxLPfuF z8sTFwdmDsao90bTW1OAE3j32Av7tGY9Y8Wrrxxyqb3r1o/0cGsgFmncWhHcnuz8n2vd 0krg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uJL3IIlI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6b078665cbbsi68162426d6.491.2024.06.11.14.56.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 14:56:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uJL3IIlI; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-210635-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210635-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B5D6B1C22EBD for ; Tue, 11 Jun 2024 21:56:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 630D6154C00; Tue, 11 Jun 2024 21:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uJL3IIlI" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 867FD153BE2; Tue, 11 Jun 2024 21:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718142959; cv=none; b=gqRUdR2X0YAZbGcvi6lCQHYstUTCCjasQR21DAKe9SRl9nXR5XdCnyP9x33lO0gqqF4CuRSCNDB0DnnDYs/DKgPxI6cv4OMjmUH6KLxGp2cg3hnmSxsb8cO+90AKXLROwZND5GczobqyNInzXu2y21ZOMD/mnjKwpjUSxULTfpw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718142959; c=relaxed/simple; bh=aHnNpOpxBam7cV7S26yxOrl6yEGYk9YSZ3F06NWlAdo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JcV/ptWuCGSNX8PBeSsy1+9iW8TeijXwRO2PtjdrwlEzcyVuhPd/+71pBf5o2Jl9WXBzHRYoKtR3aYdQMfImEvhlo3aey18bbj7GP/ScBDGq8XUmFAeVh9WWX/lLTt3g/GEbb0Xpr9ARE/6hS15/yS44Kailxxp6J+CcvTy7BiQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uJL3IIlI; arc=none smtp.client-ip=10.30.226.201 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240610204821.230388-7-torvalds@linux-foundation.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