From patchwork Mon Oct 17 14:54:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 3552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1494806wrs; Mon, 17 Oct 2022 07:59:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6S90FoZqX5Sksrwems9FAmDIx8aM6fbXjmu5CMXYLjwIHSYXWgCBhFuNWChXVzajCRANVB X-Received: by 2002:a17:902:ea10:b0:185:41c2:a71e with SMTP id s16-20020a170902ea1000b0018541c2a71emr12389651plg.21.1666018794284; Mon, 17 Oct 2022 07:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666018794; cv=none; d=google.com; s=arc-20160816; b=LRJY4jN4OvcnG/6hdQO7yfiaFUWqTYg5qD/nEnEy5TePzoIVuHY84IB97WBkXWXWvd 8GhIHCuXpI2GkLnUAKmuae29G4S3hlul0r6ctRZRhkLNIjsZIeHHSM4sqp/R9oBV1obJ MV+lnZcGshC711Zkz55Vl2AVJClrpgToO3j1AJvViFKsW1uoR6qD25hsYPk8JMPoUp37 CklfcDljTGAcEEUAkQL9fWodivQgnK/gWMKCWFPg7kslo1GjOAId0liELkMgBOYRJu0r 9v1wjULa6+X2binRCOOINDJ9Ld2vN0tmsGUjQIJ3yTprAw2437YR1Z+z5o3rWVH6TDMU v1Wg== 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:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=WYc+Bwyqcd+mMAZkehzGWiKcVAn9xuZmXYCp07jjxYs=; b=eu20gL7rHke2nZJM3AW3NyK54wpBxpWaZjf+9g2A36T9eqjzixGHGPaqj524rHh7Se xkjqfAJFf8jLgz0nCqxFj4+NOfR84PPs9Sek88NpLWabGpI3EkR3qwftVHaq6Uo3i42d wnObklTjrH40dhED526lrUZDIE8XlqToZVYvllK7YoOddFRl/PTfUhizDn/rZOceADsx Wv9mvt+1qBQaw3evcZaVGEiOH91DuM1samO26kGBm3ViVXImW797wP27sboGlBqTHnue Jzq4HykfUj0b7jmyLxT3UJYI7toop9YA1/Guqhqf4hj+uuDknbNI2XgyOgHJa4vSCImh LgoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RV6hU5sf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020a170903405400b0016c058d72b2si9954080pla.238.2022.10.17.07.59.41; Mon, 17 Oct 2022 07:59:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=RV6hU5sf; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbiJQO7W (ORCPT + 99 others); Mon, 17 Oct 2022 10:59:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230322AbiJQO6Q (ORCPT ); Mon, 17 Oct 2022 10:58:16 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B3196AA22; Mon, 17 Oct 2022 07:55:26 -0700 (PDT) Date: Mon, 17 Oct 2022 14:54:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666018464; 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: in-reply-to:in-reply-to:references:references; bh=WYc+Bwyqcd+mMAZkehzGWiKcVAn9xuZmXYCp07jjxYs=; b=RV6hU5sfb6z2cVPPwRBP5fdxYYzDP4RBZhzFVSmaYDTplGGgsDisStBo7p/JgcVlwAdABk tDYuwAAQT4qQS11xHVbEe9GkMBLDD6+W3xsHWfJOsFfmnzXr4ToxL1wOJ1gxCYGSlIjnb7 oZiW77q49f0bE+GyDXIhtazuUG6X36axCETn97c6ojO11pR8hVtCsSYIwJflctYjAyoDmU SBQbg/Lr88D2IY5w0UyAfQmY+FwpuTb1tJRWh+uUAcxRnUTZ/w8IoPu4hnZET9UXtWvYYy Qv/Ik8os2vfevLop28lIjNF3HAko4zK7/w2ifTIJ8oOR1rcruR4CVF8HhFcQpg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666018464; 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: in-reply-to:in-reply-to:references:references; bh=WYc+Bwyqcd+mMAZkehzGWiKcVAn9xuZmXYCp07jjxYs=; b=2SZhIUNiNSazfWYNdEjHEfcwNQN3jnNw22/rgl0Ft6kleGT8ibRCtRKeuVcsTPx4TFf3Ad +PY/DOH3+WKppYAg== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/core] x86/asm: Differentiate between code and function alignment Cc: Thomas Gleixner , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220915111143.824822743@infradead.org> References: <20220915111143.824822743@infradead.org> MIME-Version: 1.0 Message-ID: <166601846350.401.9004588340970794658.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746947323000088800?= X-GMAIL-MSGID: =?utf-8?q?1746947323000088800?= The following commit has been merged into the x86/core branch of tip: Commit-ID: 8eb5d34e77c63fde8af21c691bcf6e3cd87f7829 Gitweb: https://git.kernel.org/tip/8eb5d34e77c63fde8af21c691bcf6e3cd87f7829 Author: Thomas Gleixner AuthorDate: Thu, 15 Sep 2022 13:10:48 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 17 Oct 2022 16:40:58 +02:00 x86/asm: Differentiate between code and function alignment Create SYM_F_ALIGN to differentiate alignment requirements between SYM_CODE and SYM_FUNC. This distinction is useful later when adding padding in front of functions; IOW this allows following the compiler's patchable-function-entry option. [peterz: Changelog] Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Link: https://lore.kernel.org/r/20220915111143.824822743@infradead.org --- arch/x86/include/asm/linkage.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h index 9ee0e28..c2d6e27 100644 --- a/arch/x86/include/asm/linkage.h +++ b/arch/x86/include/asm/linkage.h @@ -12,11 +12,15 @@ #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) #endif /* CONFIG_X86_32 */ -#ifdef __ASSEMBLY__ - #define __ALIGN .balign CONFIG_FUNCTION_ALIGNMENT, 0x90; #define __ALIGN_STR __stringify(__ALIGN) +#define ASM_FUNC_ALIGN __ALIGN_STR +#define __FUNC_ALIGN __ALIGN +#define SYM_F_ALIGN __FUNC_ALIGN + +#ifdef __ASSEMBLY__ + #if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO) #define RET jmp __x86_return_thunk #else /* CONFIG_RETPOLINE */ @@ -55,7 +59,7 @@ /* SYM_FUNC_START -- use for global functions */ #define SYM_FUNC_START(name) \ - SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ + SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \ ENDBR /* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */ @@ -65,7 +69,7 @@ /* SYM_FUNC_START_LOCAL -- use for local functions */ #define SYM_FUNC_START_LOCAL(name) \ - SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) \ + SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN) \ ENDBR /* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */ @@ -75,7 +79,7 @@ /* SYM_FUNC_START_WEAK -- use for weak functions */ #define SYM_FUNC_START_WEAK(name) \ - SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) \ + SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN) \ ENDBR /* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */