Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1734846rdb; Tue, 20 Feb 2024 05:40:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2l/PddhuMfzYum9Sf3zh+7vlBa5JDqPa3n2IkQWuKUhYEOeIzqioYHOfZE1XOUuLRRZG00amDX1YW88doS5GoE7aVnpVJrNru5UYE8w== X-Google-Smtp-Source: AGHT+IGj4HLToQGbelOtP/YtdKZKN4V37dKuBEl4//T1azZKhEAxIJ4t2QadsTDJ8Vmv2srnn2Es X-Received: by 2002:ac2:4a85:0:b0:512:9325:d8fa with SMTP id l5-20020ac24a85000000b005129325d8famr7210548lfp.21.1708436451235; Tue, 20 Feb 2024 05:40:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708436451; cv=pass; d=google.com; s=arc-20160816; b=NkKdRyT03htzM2/FTgcvjuNwKzX43WD7USgpKgGhoWL+XZYWSde/A0dfFQ4VM6nTTW Or2S46qQJToNJ95ssO+yNn1QjMsNj6WriFnytTFV+D9Cyxj9gfWsGhFW1rNw9t+tGHaK TqEmgBX6rZ/LDAULXMl3BuHUMPio17266soRWRWqqiUULQlh1cexVJNqdZ6VRSbbEQUq eZvI33DmOzMXAN9TXdXGroNyy/lwBdD8S1D9HHUbsLYG+6sIjLPw8Jlkn2HURaiq0Pc3 HhtEHUzIO/jF4pLucqNl4Ax8W2agQRas8+FXeFvLkFfQocjhkyIt7HYYotv9fcRAe3kL /dNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=tUNCPB50P1rX3p8Teffq8D6tJFdvHFMUfbzJAdeq7Go=; fh=ScDN+67I+/L7UJd6OQgaXeUPp6tUJJ5qFWVaMHFE/qU=; b=DHZrNfkXZ1DAqE7tQrBqnFXF5V8Ho6SeHubwB2UfobR9kRpKB02UlCnENA/IhkFf37 7vWyKIcqdqtWGyhAbCUL/xF1RKUD8N7bA1Y6hGz8YyXZQ1VDodyFkv31bbQvp2Plbf9h YQv6WgURU5hQylGupT5JPu/R8MmUpTHl56JF/3fWTnl7I5HFsgJIJ7/r9j+c5V3Qx4Rk WgxaLOJL3Dvb6QvAJaYjMhuCl/iLT7l79sl5Ae713ZBan6PxUMR25xM1ZsnzM2npn9Gg eacrZrHObCOgAoELiUXImfc70WQm3D2UcwnRJ4u/lSXuJ3I7SQPxNpMkUvvMhwt0+q/Z /VlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rLArZT+q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-73087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73087-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kl9-20020a170907994900b00a3d2e0d30fesi3343406ejc.658.2024.02.20.05.40.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 05:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rLArZT+q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-73087-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73087-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 am.mirrors.kernel.org (Postfix) with ESMTPS id EDB8C1F249F7 for ; Tue, 20 Feb 2024 13:40:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CFDA96A35C; Tue, 20 Feb 2024 13:40:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rLArZT+q" 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 EA1AE6A352; Tue, 20 Feb 2024 13:40:15 +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=1708436416; cv=none; b=d++mkchmLJ4puqaGtgy1fOfOdpxYDG8utNPN4EoPvrX5rOHrZ2zA/IoqFGO91r/CFrh9SzJkuNNo0eDSvObd4UmY3krWc4afNb3vD9kY4q44JoaMmkoYSfz2yrIloQPOH7VV2we3f6kN6m6hH5M/ZYiGUZHbCurdIu2S+k7wbes= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708436416; c=relaxed/simple; bh=JDJQNjVw0veG1VaCbbXgYBFSju4HC6XVDS/PqNxBn1k=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=amprxO7RUNPQv7fzMDmyx5qQKMVRTfj04sIbqeGIUh/+j1MMy+TXAnU+t7rSRx0k7KYpEk7J3eEz1IPHwTIVePMN34ldxVjm5AOkHe3Oute/DjXPPHwMK29Zt4bJhpNligYT98Na3lroFJoZt4+w6Ul3+vSyNZo+QsRNHl1nTe8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rLArZT+q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64DB3C433F1; Tue, 20 Feb 2024 13:40:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708436415; bh=JDJQNjVw0veG1VaCbbXgYBFSju4HC6XVDS/PqNxBn1k=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=rLArZT+qc+TFAcJdTODc0UbjE8Ongzr4+cb0ZJxf2TN1Ka+D5pZJFuHPrzb0pc9dO 6UyOwJABmhW7fuWo0gNNceBhgT/q5UuWm4M3mZQGdHAPtNy9z6Vlm1IUSJ1Drn+mm0 S9NfiPcK4NMifLJTfTTLms7lik6lkhByCWG41uXYRVK5H5SKfxE84OwSzstJQZp0BZ fA+m303Ekn9A+Pr4cWI6n6HFPlx05lwCzceXLp4LuUpBDN8cxSVn2l6vDbFCw8HbnZ DDynf9AOAm2wy3CHk7t/y6w/BwXeuTSZ2k5RTD2tnAKC9u2npE55UerLmvb3LoGQbJ 95UXpH1wXk2ZA== Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-512be87a0f3so1780276e87.3; Tue, 20 Feb 2024 05:40:15 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCW5dCYik3k6C9COKWfHSSBgcq8zGeuTPtDShDi5yCeJ9HodRiqp8nN46RtRAUIOHa9vcAYciFS4GS5myQ4XJ3d+QNZnMq207+8OZlz6TDPMT+bx3tw5Zk8BvTyFmQubQFgp0+da/jmAExL0 X-Gm-Message-State: AOJu0YxYN+z/9TnmYC34zBi8srGC0jJ9+4q6DrLSBrNLk/dn0jz1n5eQ nA67RHb1K83b3K0YQh2gTrNFK4LiySBaknHXkg7STasR8tEAKYkz1iY3i7X9Q0kVx/19fmpakwG b/uz6nawKjZpUxRX3dw2xRwHLkAo= X-Received: by 2002:ac2:505c:0:b0:512:a59d:27b3 with SMTP id a28-20020ac2505c000000b00512a59d27b3mr5068137lfm.14.1708436413895; Tue, 20 Feb 2024 05:40:13 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240215151642.8970-1-petr.pavlu@suse.com> In-Reply-To: <20240215151642.8970-1-petr.pavlu@suse.com> From: Masahiro Yamada Date: Tue, 20 Feb 2024 22:39:37 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kbuild: Use -fmin-function-alignment when available To: Petr Pavlu Cc: nathan@kernel.org, nicolas@fjasle.eu, mark.rutland@arm.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Feb 16, 2024 at 12:16=E2=80=AFAM Petr Pavlu w= rote: > > GCC recently added option -fmin-function-alignment, which should appear > in GCC 14. Unlike -falign-functions, this option causes all functions to > be aligned at the specified value, including the cold ones. > > Detect availability of -fmin-function-alignment and use it instead of > -falign-functions when present. Introduce CC_HAS_SANE_FUNCTION_ALIGNMENT > and make the workarounds for the broken function alignment conditional > on this setting. > > Signed-off-by: Petr Pavlu > --- [snip] > index dfb963d2f862..5a6fed4ad3df 100644 > --- a/kernel/exit.c > +++ b/kernel/exit.c > @@ -1920,7 +1920,10 @@ EXPORT_SYMBOL(thread_group_exited); > * > * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88345#c11 > */ > -__weak __function_aligned void abort(void) > +#ifndef CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT > +__function_aligned > +#endif > +__weak void abort(void) > { > BUG(); __function_aligned is conditionally defined in include/linux/compiler_types.h, and then it is conditionally used in kernel/exit.c This is unreadable. You may want to move CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT to include/linux/compiler_types.h, as this is more aligned with what you did for __cold. if !defined(CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT) && \ CONFIG_FUNCTION_ALIGNMENT > 0 #define __function_aligned __aligned(CONFIG_FUNCTION_ALIGNMENT) #else #define __function_aligned #endif However, an even more elegant approach is to unify the two #ifdef blocks because __cold and __function_aligned are related to each other. #if defined(CONFIG_CC_HAS_SANE_FUNCTION_ALIGNMENT) || \ (CONFIG_FUNCTION_ALIGNMENT =3D=3D 0) #define __cold __attribute__((__cold__)) #define __function_aligned #else #define __cold #define __function_aligned __aligned(CONFIG_FUNCTION_ALIGNMENT) #endif -- Best Regards Masahiro Yamada