From patchwork Wed Jul 20 18:52:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 12924405 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B313C433EF for ; Wed, 20 Jul 2022 18:53:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id D94DC16C7; Wed, 20 Jul 2022 20:52:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D94DC16C7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1658343218; bh=GCDUfLB7H+z3SYkt1egzk1J5ZvWGPLsC7cxT/eSNkNk=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=ljM80lX6rvR2m6Oygnf8PeRlc1iIC+KDZrfSSvcdQU6mFWnaocgtDRI3RMAbe4faF uZ+Oon4Jh9j1UeCUPqrSLml8R4QgIi2st3wygnm1nH9oE2XWrExeavU6SOMVHqkzjV HqVH9H0T00fsU966+VUQCI6YOFvlaUryBrxICZKY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 75EA5F80139; Wed, 20 Jul 2022 20:52:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2B44DF80169; Wed, 20 Jul 2022 20:52:47 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D6091F80125 for ; Wed, 20 Jul 2022 20:52:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D6091F80125 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fYS0qQr8" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97B41B821C8; Wed, 20 Jul 2022 18:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53E43C3411E; Wed, 20 Jul 2022 18:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658343160; bh=GCDUfLB7H+z3SYkt1egzk1J5ZvWGPLsC7cxT/eSNkNk=; h=From:To:Cc:Subject:Date:From; b=fYS0qQr8pQDEM7YmELk7Pwi49Oc5RmKt/wQVx4ema8Qh4kM19y5SV6b9rLDgTHB7e zz4ohCy8OGMDr1Z2PXyjzjXVV6pnggMtEM/D895O6IAqEPYaHFf+/0iMrJ0MkxqobI HpvCYb1kqEyce29M+KMk+9ugzfK96CgxTD27j0Nk8OHVJJTjlsKd36HYYl4DvbeG1f 1sG+qvZsCRCHT8vSs/vsaWdELt0DuLr4SCwQ5Qr3XCCnQxUJ9uMnDRA3gcdQOr2NgX jlTqTHyw8BOQqNw84BwG4T5Xx78xKxS8fmkdMKiorZAS72McZeiY945myd/zfuVIGM Qg1sEfJGIh6Uw== From: Nathan Chancellor To: Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown Subject: [PATCH] ASoC: Intel: avs: Mark avs_path_module_type_create() as noinline Date: Wed, 20 Jul 2022 11:52:28 -0700 Message-Id: <20220720185228.3182663-1-nathan@kernel.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Tom Rix , llvm@lists.linux.dev, Nick Desaulniers , linux-kernel@vger.kernel.org, patches@lists.linux.dev, Nathan Chancellor X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" When building ARCH=arm64 allmodconfig with clang, there is a warning about high stack usage in avs_path_create(), which breaks the build due to CONFIG_WERROR=y: sound/soc/intel/avs/path.c:815:18: error: stack frame size (2176) exceeds limit (2048) in 'avs_path_create' [-Werror,-Wframe-larger-than] struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id, ^ 1 error generated. This warning is also visible with allmodconfig on other architectures. The minimum set of configs that triggers this on top of ARCH=arm64 allnoconfig: CONFIG_COMPILE_TEST=y CONFIG_FORTIFY_SOURCE=y CONFIG_KASAN=y CONFIG_PCI=y CONFIG_SOUND=y CONFIG_SND=y CONFIG_SND_SOC=y CONFIG_SND_SOC_INTEL_AVS=y When CONFIG_FORTIFY_SOURCE is enabled, memcmp() (called from guid_equal()) becomes a wrapper to do compile time checking, which interacts poorly with inlining plus CONFIG_KASAN=y. With ARCH=arm64 allmodconfig + CONFIG_KASAN=n + CONFIG_FRAME_WARN=128, the stack usage is much better: sound/soc/intel/avs/path.c:815:18: warning: stack frame size (624) exceeds limit (128) in 'avs_path_create' [-Wframe-larger-than] struct avs_path *avs_path_create(struct avs_dev *adev, u32 dma_id, ^ sound/soc/intel/avs/path.c:873:5: warning: stack frame size (144) exceeds limit (128) in 'avs_path_bind' [-Wframe-larger-than] int avs_path_bind(struct avs_path *path) ^ 2 warnings generated. To avoid this warning, mark avs_path_module_type_create() as noinline_for_stack, which redistributes the stack usage across multiple functions, regardless of CONFIG_KASAN. With ARCH=arm64 allmodconfig + CONFIG_FRAME_WARN=128, the warnings show: avs_path_create(): 192 avs_path_bind(): 272 avs_path_module_type_create(): 416 avs_mux_create(): 160 avs_updown_mix_create(): 160 avs_aec_create(): 176 avs_asrc_create(): 144 With ARCH=arm64 allmodconfig + CONFIG_FRAME_WARN=128 + CONFIG_KASAN=n, the warnings show: avs_path_create(): 192 avs_path_bind(): 144 avs_path_module_type_create(): 416 avs_mux_create(): 176 avs_updown_mix_create(): 176 avs_src_create(): 144 avs_aec_create(): 192 avs_asrc_create(): 144 avs_wov_create(): 144 Link: https://github.com/ClangBuiltLinux/linux/issues/1642 Signed-off-by: Nathan Chancellor --- sound/soc/intel/avs/path.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: ff6992735ade75aae3e35d16b17da1008d753d28 diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index 3d46dd5e5bc4..ec2aa0001f91 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -449,7 +449,8 @@ static int avs_modext_create(struct avs_dev *adev, struct avs_path_module *mod) return ret; } -static int avs_path_module_type_create(struct avs_dev *adev, struct avs_path_module *mod) +static noinline_for_stack int avs_path_module_type_create(struct avs_dev *adev, + struct avs_path_module *mod) { const guid_t *type = &mod->template->cfg_ext->type;