Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6260412rwl; Mon, 9 Jan 2023 06:17:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1N4TEydacC/Ilu/+AJGtX+6zt28wLyhKf+q/4coJeTk2SGP0fyZNmfWKEBPTlzQZZVh2F X-Received: by 2002:a17:906:cd0b:b0:84d:463f:3787 with SMTP id oz11-20020a170906cd0b00b0084d463f3787mr3754991ejb.5.1673273862915; Mon, 09 Jan 2023 06:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673273862; cv=none; d=google.com; s=arc-20160816; b=clf/0S4pUJXCIEpw/FtUWpMMzDQxPu1EZi0CDiQ4074JwCMMakIIId88QWRA6GD/aW 1d+0SLZIqIY041fDqkyRHSUNGfwaqb6pWEeEkbgQYKzZDMVT5X3qrWRAGHRfkhfjTxST DnwP23vmMnWWvvcjwZ6TfwGBWwJ5d/06WrOtFTACvGmxivVE2bRdXwUwTuM+CkL+vv07 p4mrf1OZBnrHM1POP+KZUCrlDYrD8RE0zWDJc/NpcfuBIVX1QdRwTdnnIOe83BEhNpuv /wP993MAycZ/n6KJuxend9enRYAg8uJTO8vGVL2n3YIuvgNlaC3e/QKWTMo5LK2vJEv/ 4Vrw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uS6ssPWGHEZJFSKX4hxjdcKxWoVnBVtrpoOuY5hYNNg=; b=C8xTiSxjmCgoWBpPUHZ6+69DKR9SnpZ9FfBFJ0peAAX320K/Inl5BewtnaftyQsH9n QSSozgDtzEpoP7RivOAx/Qd74QRV9MeoLcQ2GJCodTqnjIjmUPYazMCq1p1UvgZl3HUN FSp8rurwVcWS1IlkH+ilzpUQEqtYvu9wnFZzV6uDxC79ildh3XhZaIToqn7FKM+VuGYO mNINF+wZmzuPlOJAfZKsEhI+zgYY434ZkIxd2NDN1ZJAkIaLe5ewro/28VpG29HieUvV 1xb7iKN7vPRP1bBC2s8UipRaPVh2ky2DxKk39DKL/22AucrqEJcphDul9RjyfhenCgCu 4kOA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a170906844500b0084b895b6a22si6837996ejy.947.2023.01.09.06.17.29; Mon, 09 Jan 2023 06:17:42 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237240AbjAIOAc (ORCPT + 55 others); Mon, 9 Jan 2023 09:00:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237264AbjAIN6r (ORCPT ); Mon, 9 Jan 2023 08:58:47 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 419D3F6F; Mon, 9 Jan 2023 05:58:46 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 05F2B176B; Mon, 9 Jan 2023 05:59:28 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 308803F23F; Mon, 9 Jan 2023 05:58:44 -0800 (PST) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com, mhiramat@kernel.org, ndesaulniers@google.com, ojeda@kernel.org, peterz@infradead.org, rafael.j.wysocki@intel.com, revest@chromium.org, robert.moore@intel.com, rostedt@goodmis.org, will@kernel.org Subject: [PATCH 3/8] arm64: Extend support for CONFIG_FUNCTION_ALIGNMENT Date: Mon, 9 Jan 2023 13:58:23 +0000 Message-Id: <20230109135828.879136-4-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230109135828.879136-1-mark.rutland@arm.com> References: <20230109135828.879136-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 On arm64 we don't align assembly funciton in the same way as C functions. This somewhat limits the utility of CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B for testing. Follow the example of x86, and align assembly functions in the same way as C functions. I've tested this by selecting CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B=y, building and booting a kernel, and looking for misaligned text symbols: Before: # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l 322 After: # grep ' [Tt] ' /proc/kallsyms | grep -iv '[048c]0 [Tt] ' | wc -l 115 The remaining unaligned text symbols are a combination of non-function labels in assembly and early position-independent code which is built with '-Os'. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Florent Revest Cc: Masami Hiramatsu Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Will Deacon --- arch/arm64/include/asm/linkage.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h index 1436fa1cde24d..df18a3446ce82 100644 --- a/arch/arm64/include/asm/linkage.h +++ b/arch/arm64/include/asm/linkage.h @@ -5,8 +5,14 @@ #include #endif -#define __ALIGN .align 2 -#define __ALIGN_STR ".align 2" +#if CONFIG_FUNCTION_ALIGNMENT > 0 +#define ARM64_FUNCTION_ALIGNMENT CONFIG_FUNCTION_ALIGNMENT +#else +#define ARM64_FUNCTION_ALIGNMENT 4 +#endif + +#define __ALIGN .balign ARM64_FUNCTION_ALIGNMENT +#define __ALIGN_STR ".balign " #ARM64_FUNCTION_ALIGNMENT /* * When using in-kernel BTI we need to ensure that PCS-conformant -- 2.30.2