Message ID | 170023296234.391.6891224487945079423.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp584715vqn; Fri, 17 Nov 2023 06:56:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRkErjAd1ul0xmxDnHWM14hUpIrA4wJ1ovk8xauCQWVy9uiFNFKjFP7g0efcw23yahfJnP X-Received: by 2002:a05:6a20:7da2:b0:187:e71d:ab41 with SMTP id v34-20020a056a207da200b00187e71dab41mr4596428pzj.19.1700232997383; Fri, 17 Nov 2023 06:56:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700232997; cv=none; d=google.com; s=arc-20160816; b=ELh/rhi2lgRsTR2aN0DmPVVsCky/AaODuuyRTRpT5xTFRTyGGx65aSVM/fYhsPJcGG cZjwKDa6bKrq8PjM/0trl718Mz/j21Rg/m+MzFdvKC7Rkw3hNJbuYGZcLWdC62m8hktv 4MYKS1n9QofDUSH3AEtk5gUdsUF649VdHhBPJ9XbTZMr+fBNqp4dy3Yj22vxr4ErMtuZ gPZuWVPNU/96WViUUg8UBTaLMpzB1+kAjAQUhSYy9Ot1DvwFkPqb5BW+mU6XG/xUzSyq jHYZqABzIBhAeyLNYFeQu87O9MG7Y0AK90GK2h6efEWE0Cw6kYCf/0yjkxvhU9lId88V vU6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:cc:subject:to:reply-to:sender:from :dkim-signature:dkim-signature:date; bh=KEHIeQZ3G9vznPEBdGw4NHDfFJdLPaFTS3rqt0y9BFM=; fh=Yp/5gEwxgKLFZsFMSxQy1c8GuJOzNkfTozXQS+Nu5A4=; b=Dh18GkyGaZlDSyi3qDq2hUh2vTbbDLaD46NLyRw5lbcHYqShZtuJAcPYdvRz86qNX4 eXNEw5inJwvaOwkknDsAdCZvPv6MxE0de+e6l30TiSF/WrDt0afs5LZVZzZ+NGZ/fjBa Osuv3poQ/J48/91pECYg3wAsweg9l0CFmwz0Nh4qVGB8qf1yy+xOV8lwewsLSAeS50VX fATcZxRFCq7FMcSSBwMh97i8W6BXqR8IKIlPexpkn0fVG+/K2oxlqKnA+WrxbkhiOpWq XRoYtllTtnhYebje6USa0mjth0oEDhkyLJwFmlLwhQ3NMVoKouI3jTUpuIc2g0DrkwcC 7t1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PU0zCbJ9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="g/RIa53c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ix21-20020a170902f81500b001c74d844254si1908800plb.101.2023.11.17.06.56.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 06:56:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PU0zCbJ9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="g/RIa53c"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CDBF380204B7; Fri, 17 Nov 2023 06:56:34 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231442AbjKQO4L (ORCPT <rfc822;jaysivo@gmail.com> + 30 others); Fri, 17 Nov 2023 09:56:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbjKQO4K (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 17 Nov 2023 09:56:10 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47CEA130; Fri, 17 Nov 2023 06:56:05 -0800 (PST) Date: Fri, 17 Nov 2023 14:56:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700232963; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KEHIeQZ3G9vznPEBdGw4NHDfFJdLPaFTS3rqt0y9BFM=; b=PU0zCbJ9bg28EjT6y1UqX3TvSBsMCyifjslipAnn0GcSmZTakQaMvfNJIoOwZlXvWj7cE6 oD729wLdvFZs8K6DefWDsKTEQq2iGgWcgk0SHqVCLcDHHUves2TtCJRFgFtdlEmSYpswLF TrSfNvoenWIPKgb63WinOMpegOcYqYiRlC+KFS9oSQT+NZwqcEH1FCRmfAiKb9bsDDZ/LL nWqdq/G+7CPGIj5TWDKpvLb6n3IFDTPPoOULcfZPLMHOj6EUR1njCu1xsjRydsc1kRuEfd O0VNhqaZIACs14gzta9qGwrTUdtKSzTBhwOLROxJfkNdF904LRxCh0BUngHj0w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700232963; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KEHIeQZ3G9vznPEBdGw4NHDfFJdLPaFTS3rqt0y9BFM=; b=g/RIa53cWpEFlnoCvob/a4cd6T1MoYZgFdoCHmjsGlLcT1zbWEnaL52W2dLuX1pmr6oWeH Fd241nI6JVeAIwBA== From: "tip-bot2 for Uros Bizjak" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/mm: Use %RIP-relative address in untagged_addr() Cc: Uros Bizjak <ubizjak@gmail.com>, Dave Hansen <dave.hansen@linux.intel.com>, "Peter Zijlstra (Intel)" <peterz@infradaed.org>, "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>, x86@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Message-ID: <170023296234.391.6891224487945079423.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 06:56:34 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782823515196080425 X-GMAIL-MSGID: 1782823515196080425 |
Series |
[tip:,x86/mm] x86/mm: Use %RIP-relative address in untagged_addr()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
Nov. 17, 2023, 2:56 p.m. UTC
The following commit has been merged into the x86/mm branch of tip: Commit-ID: bc5607d7777423b742f5b0f7a760d074154c613f Gitweb: https://git.kernel.org/tip/bc5607d7777423b742f5b0f7a760d074154c613f Author: Uros Bizjak <ubizjak@gmail.com> AuthorDate: Thu, 16 Nov 2023 20:10:59 +01:00 Committer: Dave Hansen <dave.hansen@linux.intel.com> CommitterDate: Fri, 17 Nov 2023 06:27:29 -08:00 x86/mm: Use %RIP-relative address in untagged_addr() %RIP-relative addresses are nowadays correctly handled in alternative instructions, so remove misleading comment and improve assembly to use %RIP-relative address. Also, explicitly using %gs: prefix will segfault for non-SMP builds. Use macros from percpu.h which will DTRT with segment prefix register as far as SMP/non-SMP builds are concerned. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradaed.org> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Link: https://lore.kernel.org/all/20231116191127.3446476-1-ubizjak%40gmail.com --- arch/x86/include/asm/uaccess_64.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
Comments
On Fri, Nov 17, 2023 at 3:56 PM tip-bot2 for Uros Bizjak <tip-bot2@linutronix.de> wrote: > > The following commit has been merged into the x86/mm branch of tip: > > Commit-ID: bc5607d7777423b742f5b0f7a760d074154c613f > Gitweb: https://git.kernel.org/tip/bc5607d7777423b742f5b0f7a760d074154c613f > Author: Uros Bizjak <ubizjak@gmail.com> > AuthorDate: Thu, 16 Nov 2023 20:10:59 +01:00 > Committer: Dave Hansen <dave.hansen@linux.intel.com> > CommitterDate: Fri, 17 Nov 2023 06:27:29 -08:00 > > x86/mm: Use %RIP-relative address in untagged_addr() > > %RIP-relative addresses are nowadays correctly handled in alternative > instructions, so remove misleading comment and improve assembly to > use %RIP-relative address. > > Also, explicitly using %gs: prefix will segfault for non-SMP builds. > Use macros from percpu.h which will DTRT with segment prefix register > as far as SMP/non-SMP builds are concerned. > > Signed-off-by: Uros Bizjak <ubizjak@gmail.com> > Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> > Acked-by: Peter Zijlstra (Intel) <peterz@infradaed.org> > Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> > Link: https://lore.kernel.org/all/20231116191127.3446476-1-ubizjak%40gmail.com I would just like to point out that this change depends on x86/percpu branch in tip. So, the x86/mm has to come after x86/percpu. Uros.
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h index f2c02e4..01455c0 100644 --- a/arch/x86/include/asm/uaccess_64.h +++ b/arch/x86/include/asm/uaccess_64.h @@ -11,6 +11,7 @@ #include <asm/alternative.h> #include <asm/cpufeatures.h> #include <asm/page.h> +#include <asm/percpu.h> #ifdef CONFIG_ADDRESS_MASKING /* @@ -18,14 +19,10 @@ */ static inline unsigned long __untagged_addr(unsigned long addr) { - /* - * Refer tlbstate_untag_mask directly to avoid RIP-relative relocation - * in alternative instructions. The relocation gets wrong when gets - * copied to the target place. - */ asm (ALTERNATIVE("", - "and %%gs:tlbstate_untag_mask, %[addr]\n\t", X86_FEATURE_LAM) - : [addr] "+r" (addr) : "m" (tlbstate_untag_mask)); + "and " __percpu_arg([mask]) ", %[addr]", X86_FEATURE_LAM) + : [addr] "+r" (addr) + : [mask] "m" (__my_cpu_var(tlbstate_untag_mask))); return addr; }