Message ID | 20231214205506.310402-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-97-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8845103dys; Thu, 14 Dec 2023 12:55:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmwlv+JiTUpVMgk2XVUZtiUbhG0Za0WSrxvXDi52PnzGmMGjGKDjjW/+1WH0BQQC8SE15A X-Received: by 2002:ad4:41d0:0:b0:67e:fd7f:38e1 with SMTP id a16-20020ad441d0000000b0067efd7f38e1mr2941708qvq.62.1702587342388; Thu, 14 Dec 2023 12:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702587342; cv=none; d=google.com; s=arc-20160816; b=d4RNgo8Ly+Ldxqjrjt1AnjKl4Gixcpet3rBwkRqZklqs4wWgAH4ThLXJyUppOZhyTt 6u9uoCqW13v3isx4dOh7TIdCgSNxL16rH6DeLoLT8VssxuwcKAbnoKGKmQGcqqm9YmYi 20T1Igrv/hBFamPWY3WYagBYLRhJSQqeK/ksPoKYRcVxSksXBi017CH82BaPrsOfNTXz RdGYlpsSqH2YmoRRpCXB8qoZy1zuBRZX2qxS59wsVtPoD4uP6eGYQdaGAYnftVuQNTa+ JHnIjHXmAqzykrJa5OEnM5r61Nn5ZVdoUF5USL2kCrKTr5d7iawsmt33F1rOsYeQtKi9 wZ6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=wxExk1LgDiQQ+6EwBn/tlnGLR2DpqnsBwz6etW4gKZY=; fh=ja6VstOGfu3dNdxYL9ZMUNZ2jTnV8Yuul+3Qd8uvMI4=; b=UWjOnn2j3weIE+boAkzxXs2Qscegb/1PFuAgpI5Rb2kkW6nPysHKSdq5kQMggKpzFm uTMdsQI1fDThZ5ckK1ABM+DlmZhwcKLdj93z1wNFHDpFH89UYGMCGl5QWXOI937zFbuW xJb+CXU3WzAkQY8rZC9L7l1BNNLclzRysOAs3zFXxS1dWKXAhgQicm7z7Bzt0DyxCnbx ZhGsW9tLh7WARQDF058Jv5vYzp0ICqUP7/oTMdMVVdS0bXhzjRyMgM467C0n1PZh69+u 9t2Nv6dhkd4QawW+r9oYW1fY4lYVbTSFGMHH9KjHgAqFdbGBdmbQJu2yOOcyfx0Vfux7 bMVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eaHAZekm; spf=pass (google.com: domain of linux-kernel+bounces-97-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u16-20020a05621411b000b0067a9cfb87bcsi6466804qvv.331.2023.12.14.12.55.42 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 12:55:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eaHAZekm; spf=pass (google.com: domain of linux-kernel+bounces-97-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 31E281C21BD8 for <ouuuleilei@gmail.com>; Thu, 14 Dec 2023 20:55:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60E2954276; Thu, 14 Dec 2023 20:55:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eaHAZekm" X-Original-To: linux-kernel@vger.kernel.org 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 96A026E5A5; Thu, 14 Dec 2023 20:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0499BC433C8; Thu, 14 Dec 2023 20:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702587326; bh=sO1yA3MRFf7NVPe6oN00hj9uMaVI9YFdkLzhks1q7xs=; h=From:To:Cc:Subject:Date:From; b=eaHAZekmu/N5erIKFfGzhRDNO5t75fWETQ9YjN8yvzstAhL0Sqyi8dqcn7TknLe6a tMhh+Cw9ZSufkdTJeRJvFDrGpIX5CUR3WU6fFZQmPOpZm0N/E6snMfj4/gcmU03APc FOC3WJZxv7dQb7aMCWWm+rQs+rosQQ/6tsjx0wJzNGbcuV2t+N1egYm0eJIDr+IBxO 4t1r3LtLB6S25UU3CdzQZtie4f4BHV8ssLi4/VgP18muqnGCqqUI2utkFnWuBTuM4+ Ovf4DtpUfdlR4jor2kxIVRKU4vKjjCrV2B9uCCIZnb5BCcIT+q5hk+76gwXgT8njqP EnIRgEnAWiK3w== From: Arnd Bergmann <arnd@kernel.org> To: Andrew Morton <akpm@linux-foundation.org> Cc: Arnd Bergmann <arnd@arndb.de>, "kernelci . org bot" <bot@kernelci.org>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Zi Yan <ziy@nvidia.com>, Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mips: fix r3k_cache_init build regression Date: Thu, 14 Dec 2023 20:54:47 +0000 Message-Id: <20231214205506.310402-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785292225395643509 X-GMAIL-MSGID: 1785292225395643509 |
Series |
mips: fix r3k_cache_init build regression
|
|
Commit Message
Arnd Bergmann
Dec. 14, 2023, 8:54 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> My earlier patch removed __weak function declarations that used to be turned into wild branches by the linker, instead causing a link failure when the called functions are unavailable: mips-linux-ld: arch/mips/mm/cache.o: in function `cpu_cache_init': cache.c:(.text+0x670): undefined reference to `r3k_cache_init' The __weak method seems suboptimal, so rather than putting that back, make the function calls conditional on the Kconfig symbol that controls the compilation. Reported-by: kernelci.org bot <bot@kernelci.org> Fixes: 66445677f01e ("mips: move cache declarations into header") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- My broken patch is currently in linux-mm, so the fix should be applied on top. --- arch/mips/mm/cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Thu, 14 Dec 2023 20:54:47 +0000 Arnd Bergmann <arnd@kernel.org> wrote: > From: Arnd Bergmann <arnd@arndb.de> > > My earlier patch removed __weak function declarations that used to > be turned into wild branches by the linker, instead causing > a link failure when the called functions are unavailable: > > mips-linux-ld: arch/mips/mm/cache.o: in function `cpu_cache_init': > cache.c:(.text+0x670): undefined reference to `r3k_cache_init' > > The __weak method seems suboptimal, so rather than putting that > back, make the function calls conditional on the Kconfig symbol > that controls the compilation. Cool, thanks. > Reported-by: kernelci.org bot <bot@kernelci.org> Please don't forget the Closes: - they're sometimes handy. > Fixes: 66445677f01e ("mips: move cache declarations into header") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > My broken patch is currently in linux-mm, so the fix should > be applied on top. The mm-nonmm-stable branch of mm.git. So I'll queue this separately and we'll have a minor bisection hole. <git rant elided> > --- a/arch/mips/mm/cache.c > +++ b/arch/mips/mm/cache.c > @@ -205,14 +205,14 @@ static inline void setup_protection_map(void) > > void cpu_cache_init(void) > { > - if (cpu_has_3k_cache) { > + if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) { > r3k_cache_init(); > } > - if (cpu_has_4k_cache) { > + if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) { > r4k_cache_init(); > } > > - if (cpu_has_octeon_cache) { > + if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) { > octeon_cache_init(); > } I just can't help myself. --- a/arch/mips/mm/cache.c~mips-fix-r3k_cache_init-build-regression-fix +++ a/arch/mips/mm/cache.c @@ -205,16 +205,13 @@ static inline void setup_protection_map( void cpu_cache_init(void) { - if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) { + if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) r3k_cache_init(); - } - if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) { + if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) r4k_cache_init(); - } - if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) { + if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) octeon_cache_init(); - } setup_protection_map(); } The rest of the file doesn't do the over-bracing, so there.
Hi Arnd, On 14/12/23 21:54, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > My earlier patch removed __weak function declarations that used to > be turned into wild branches by the linker, instead causing > a link failure when the called functions are unavailable: > > mips-linux-ld: arch/mips/mm/cache.o: in function `cpu_cache_init': > cache.c:(.text+0x670): undefined reference to `r3k_cache_init' > > The __weak method seems suboptimal, so rather than putting that > back, make the function calls conditional on the Kconfig symbol > that controls the compilation. > > Reported-by: kernelci.org bot <bot@kernelci.org> > Fixes: 66445677f01e ("mips: move cache declarations into header") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > My broken patch is currently in linux-mm, so the fix should > be applied on top. > --- > arch/mips/mm/cache.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c > index e5d19f4a38ba..b7ce73fba998 100644 > --- a/arch/mips/mm/cache.c > +++ b/arch/mips/mm/cache.c > @@ -205,14 +205,14 @@ static inline void setup_protection_map(void) > > void cpu_cache_init(void) > { > - if (cpu_has_3k_cache) { > + if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) { > r3k_cache_init(); > } > - if (cpu_has_4k_cache) { > + if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) { Shouldn't we also check for CONFIG_CPU_SB1 enabled? (See commit 641e97f31887 "Replace SB1 cachecode with standard R4000 class cache code.") With that: Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > r4k_cache_init(); > } > > - if (cpu_has_octeon_cache) { > + if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) { > octeon_cache_init(); > } >
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c index e5d19f4a38ba..b7ce73fba998 100644 --- a/arch/mips/mm/cache.c +++ b/arch/mips/mm/cache.c @@ -205,14 +205,14 @@ static inline void setup_protection_map(void) void cpu_cache_init(void) { - if (cpu_has_3k_cache) { + if (IS_ENABLED(CONFIG_CPU_R3000) && cpu_has_3k_cache) { r3k_cache_init(); } - if (cpu_has_4k_cache) { + if (IS_ENABLED(CONFIG_CPU_R4K_CACHE_TLB) && cpu_has_4k_cache) { r4k_cache_init(); } - if (cpu_has_octeon_cache) { + if (IS_ENABLED(CONFIG_CPU_CAVIUM_OCTEON) && cpu_has_octeon_cache) { octeon_cache_init(); }