Message ID | 20231016200755.287403-1-ubizjak@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3698260vqb; Mon, 16 Oct 2023 13:08:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEY93OT7WwRmbPltWwz3YyedICDRv4u8EoMNR8GvVHG0D29zVgejbE1GEIqUTsggGYtlLA X-Received: by 2002:a05:6a21:a5a0:b0:17a:e03f:38b7 with SMTP id gd32-20020a056a21a5a000b0017ae03f38b7mr73381pzc.6.1697486903588; Mon, 16 Oct 2023 13:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697486903; cv=none; d=google.com; s=arc-20160816; b=VTgzJwUAlGXnARwzQITqI1ilcExVghF5+n5ZjBn5UwIKM7db+eG9mAjUfz/SwuIwhD JP8YJJdNz44otpidYtTeOd8XuxROCZqapLW5MaKjPs8g2+SxfRaXWqSF2LfAjq0A1x08 ytYMz8xWebNXsOkdmZPH4IXEX6RP9Q4FE1ATw0QS58EZzOoAKrT9i19DPmeNMbi9n7DL UhRmqM70u01pQ2mh20l9Jtxtu72FUbu5e4XBR+PI0lHZwxO7A9QWmhy6UPiShBX1TPP5 wR+o1VQWC1s7rYp+dRADb+Wm4/3AFXPZcdm1nhHkeRX5lrdx4j1tkiaR1Z6DZlBuwCam Fjow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=3//5wXEK6wkrq5JXyoehSNgqGXcQbC5VyDpkqHpeQLs=; fh=BZuqF0bxLOoHpmsorgAowQln80CBe9e5Ji9LrGNnUlw=; b=ILXf4JjPz7nv2+HVggvqF7vBjXvYO8VhOi8a6gu+3TDOqfGslyPYqYSMt7NlgH3/rz wVaSsN6a1QHukBRLPCBaXaMiBqMMDndL1ZozUh708NSy9+QVOuou8vJT+JL5K8sXeIxY vFV8UpBAngVFs3v6XKsn07cd1iG5FOuGJiP2kbOHdfpoe4rW4H+MrN9UHJdXf/a3I+0A jf28kO8AKlfUG4Ml7wkhGx5armg7gV9Pvyg+HLPlXDtqvjfNSkLL9Q7GmtpWjk8LV12v ey6F8xWrbLLinR5McKdEqT6VWa2Wa+a1HIgkA4Jbgl/x37vmrwehf0baDgiO0hjl6vZ/ GeGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O2MZwPvf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s14-20020a170902ea0e00b001c9b20887afsi46050plg.431.2023.10.16.13.08.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:08:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O2MZwPvf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8AC0A80A4988; Mon, 16 Oct 2023 13:08:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbjJPUIJ (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 16:08:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232217AbjJPUII (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 16:08:08 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0578D83 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 13:08:06 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-53de0d1dc46so8615850a12.3 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 13:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697486884; x=1698091684; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3//5wXEK6wkrq5JXyoehSNgqGXcQbC5VyDpkqHpeQLs=; b=O2MZwPvfMJ+NKUX+knSxLhGnaHJAg36Q7r42AnzBIEfBiLp6THJtG4RDDM4NwTJjvq z+ieQm5MjHnySv6YBsmZtEJB9IZYxJuDy5IQMhQZtXKeXC2jLWhMxi086yKAAkxtBBhV XXnBXnAvqrKdporJmxpxxwHJs1X0f7jkh/rbCG7INpj8bZmYDUlNO8wqDSPuQeShxQZ6 Eb8ELlun6pSzMB8lLWORmg5uxOfcoZ5Rq8Y+myd3JSoOsy/7XrLCQHe1NZUWl6yDW8BW oKanAy9Ue3fLB+fCndzszNM67ByWqtcCvGrV8r32zqHku0gQjE3Roc8OUOz0haE+q+b/ mNLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697486884; x=1698091684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3//5wXEK6wkrq5JXyoehSNgqGXcQbC5VyDpkqHpeQLs=; b=FIC72tYXASOMfzq90d/8NZ0g82+pY6mzqD2ztrLcOIwVVKv8N1+LeLv98rRS2H7noQ B7p5bMaFlQFeTWWyfKGRNv6JkwXV4Wu2dJE4Ta29xfCI2myY/5SQ2x5nrnmjKuGgL4d3 D67hWAGLiTjiOfW1Vn/bKJR05s2DSwNnC685zUTZ03WSIeipP81QKU3cQpH56pOm3kjL BNJ7LBusDM5pFdgcHSpXOCZMLdx4FxWWWKak76ajuooi94YqonRO82veSjePUXMFuLr8 t3Tfhp82FbaKoaFf/rV3M+iNtzHDa/7CDjtB4SUOIyRV1t5rkH8ilCHQ1Ld/CdbLPXVW 0SoQ== X-Gm-Message-State: AOJu0YyJXVcqriYvdYXZ1e/F1DSWXetlDE4O7EcMTNb6T5aon55NIeWR gMUNPTzWabGAqJHbMwjlL9s= X-Received: by 2002:a17:907:31cd:b0:9ae:6ad0:f6db with SMTP id xf13-20020a17090731cd00b009ae6ad0f6dbmr69308ejb.71.1697486884051; Mon, 16 Oct 2023 13:08:04 -0700 (PDT) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a13-20020a170906368d00b0099cf9bf4c98sm4571040ejc.8.2023.10.16.13.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 13:08:03 -0700 (PDT) From: Uros Bizjak <ubizjak@gmail.com> To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak <ubizjak@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com> Subject: [PATCH] x86/percpu: Use correct asm operand modifier in percpu_stable_op Date: Mon, 16 Oct 2023 22:07:30 +0200 Message-ID: <20231016200755.287403-1-ubizjak@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 13:08:21 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779944027250592784 X-GMAIL-MSGID: 1779944027250592784 |
Series |
x86/percpu: Use correct asm operand modifier in percpu_stable_op
|
|
Commit Message
Uros Bizjak
Oct. 16, 2023, 8:07 p.m. UTC
"P" asm operand modifier is a x86 target-specific modifier. When used
for a constant, it drops all syntax-specific prefixes and issues the
bare constant. This modifier is not correct for address handling,
in this case a generic "a" operand modifier should be used.
"a" asm operand modifier substitutes a nemory reference, with the
actual operand treated as address. For x86_64, when a symbol is
provided, the "a" modifier emits "sym(%rip)" instead of "sym",
enabling shorter %rip-relative addressing.
Clang allows only "i" and "r" opreand constraints with "a" modifier,
so the patch normalizes the modifier/constraint pair to "a"/"i"
which is consistent between both compilers.
The patch reduces code size of a test build for 4072 bytes:
25519196 4388300 808452 30715948 1d4b02c vmlinux-new.o
25523268 4388300 808452 30720020 1d4c014 vmlinux-old.o
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
---
arch/x86/include/asm/percpu.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 54746903b8c3..ac3220aeb779 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -194,9 +194,9 @@ do { \ #define percpu_stable_op(size, op, _var) \ ({ \ __pcpu_type_##size pfo_val__; \ - asm(__pcpu_op2_##size(op, __force_percpu_arg(P[var]), "%[val]") \ + asm(__pcpu_op2_##size(op, __force_percpu_arg(a[var]), "%[val]") \ : [val] __pcpu_reg_##size("=", pfo_val__) \ - : [var] "p" (&(_var))); \ + : [var] "i" (&(_var))); \ (typeof(_var))(unsigned long) pfo_val__; \ })