Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp137844rwb; Thu, 12 Jan 2023 04:33:09 -0800 (PST) X-Google-Smtp-Source: AMrXdXvAH2EsZo424rB1wANHgMLlR25mdTfbvZedGRjw38C4prjG6RxzoiS5TXR3VNh/WWMGgqNK X-Received: by 2002:a17:907:6ea9:b0:7c0:e7ad:5296 with SMTP id sh41-20020a1709076ea900b007c0e7ad5296mr83298565ejc.55.1673526789292; Thu, 12 Jan 2023 04:33:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673526789; cv=none; d=google.com; s=arc-20160816; b=iuxYmzNq+56+wZFmhzZaDypCoDgrvlAB8J5LiCaLBTfmzq7ArpjCQ7+oy6ICrnHDku WwbJgBDf8BJOBToho81RUs1WaRzmxReMSmmi+8sqBT5rPBphAbzl0Vmw8fUE2cb+JeaP 1Orw3TKsgM7EzU+qUqGgRefnbZFHc/rTk629N3zuJrx2gGUFrCYXrwrUp5z46TzmYB4P YYpz+0yUCTm9zybtO82FPND1BGwET2McEQg88p2Y3dHWdohcBDrbXAqpqBmrH2Qdj9CY MpjPEjiNtw/hfLWVVaLTvQ0Bdmu1dP4+M0v3dx66Uk8veofCDk6r2XrPNuvpCCxSiHc/ TfJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=eCtocMAywvX0RN8pRuv/y3L6HJLFcpxtDSWRxjT19UQ=; b=uFFQl8ZKP++MLi9MoWXRxGtBkR9Egkuc1ZGi9x+SuOCjSn1eiWXddpF71RZP3u1XBP 2irf2knlfBED9TLJp78nySA9+f4rdrGFID9oiHSEXJPlGUDd42okFL4lbtQPsp54+qmW r76GHfx52bF1EP7Akuuhw295ziPsjbw47pvR5p4nEuFN4aeH1EsooG3+Bn3BRy+s4D8S fyw8x/SW9zJ5eNIWCOKw93Aix7U3AZvUUOEIuRJ9kaOa14QMxxlCBsqjeWYZfoV0Py2f g9bM/6Ve3xJv0kQTqSgPHKRWu0H+xX9Hq4UMWeyq19IKJBTdNijP2hCUaEEhzLBYrqLm rbzQ== 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 xf10-20020a17090731ca00b0084d34face2dsi13383437ejb.490.2023.01.12.04.32.57; Thu, 12 Jan 2023 04:33:09 -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 S230040AbjALLtp (ORCPT + 49 others); Thu, 12 Jan 2023 06:49:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230273AbjALLtH (ORCPT ); Thu, 12 Jan 2023 06:49:07 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7CFD55E09D; Thu, 12 Jan 2023 03:38:22 -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 423D5AD7; Thu, 12 Jan 2023 03:39:04 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.43.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E04923F67D; Thu, 12 Jan 2023 03:38:19 -0800 (PST) Date: Thu, 12 Jan 2023 11:38:17 +0000 From: Mark Rutland To: Miguel Ojeda Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, 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: Re: [PATCH 1/8] Compiler attributes: GCC function alignment workarounds Message-ID: References: <20230109135828.879136-1-mark.rutland@arm.com> <20230109135828.879136-2-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Wed, Jan 11, 2023 at 06:27:53PM +0000, Mark Rutland wrote: > On Mon, Jan 09, 2023 at 03:43:16PM +0100, Miguel Ojeda wrote: > > On Mon, Jan 9, 2023 at 2:58 PM Mark Rutland wrote: > > > > > > As far as I can tell, GCC doesn't respect '-falign-functions=N': > > > > > > * When the __weak__ attribute is used > > > > > > GCC seems to forget the alignment specified by '-falign-functions=N', > > > but will respect the '__aligned__(N)' function attribute. Thus, we can > > > work around this by explciitly setting the alignment for weak > > > functions. > > > > > > * When the __cold__ attribute is used > > > > > > GCC seems to forget the alignment specified by '-falign-functions=N', > > > and also doesn't seem to respect the '__aligned__(N)' function > > > attribute. The only way to work around this is to not use the __cold__ > > > attibute. > > > > If you happen to have a reduced case, then it would be nice to link it > > in the commit. A bug report to GCC would also be nice. > > > > I gave it a very quick try in Compiler Explorer, but I couldn't > > reproduce it, so I guess it depends on flags, non-trivial functions or > > something else. > > So having spent today coming up with tests, it turns out it's not quite as I > described above, but in a sense worse. I'm posting a summary here for > posterity; I'll try to get this to compiler folk shortly. I've added the cold bits to an existing ticket: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345 I have not been able to reproduce the issue with __weak__, so I'll go dig into that some more; it's likely I was mistaken there. Thanks, Mark.