From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 0B77FC54E94 for ; Tue, 24 Jan 2023 17:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KMfGWKI3HpzsLTb8rLdi/RRGJ9EIJODq/j2MWg4JPNU=; b=iE5jBxFyuCH5iUh5e8ciqH/awr +vN/Nt2ETW7USJTairt99+jOrr+Tn3nQHf3JD+dcErarmv13HZAXiS5TcQFcHB0jygvKsa4ajT7KT XWVlPV+I4+kWe4nbvCmCVA2kOGuRL247lK95llFveKSL2Tb00ufVqJ8v1jpJe8kJcFbLPtWOuu0u8 aF/UYSsiMka0UhVrS11hVoE6EM5TyvW11Ib+FlJoO0XgaTABVVtdonGACbm7grwpuN9wnrQelGz4M aKHOEmMDY1Za8ZzLubnDeLyJ1z/UuHfpTojZ2pnnoO1r5OP85+o1RIclZR3kAP32pctRRsPPu1Wxu yzq6Rc9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKMtO-004moT-V9; Tue, 24 Jan 2023 17:15:31 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pKMtL-004mnl-2m for linux-arm-kernel@lists.infradead.org; Tue, 24 Jan 2023 17:15:29 +0000 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 75709B815E8; Tue, 24 Jan 2023 17:15:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B8C1C433D2; Tue, 24 Jan 2023 17:15:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674580524; bh=wKvlYv5MLbM587ZQe0pRKBkwTxNoL4bwXuRQfuT4NHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Qj3luYUncno5jJfr6SLoF+rwSBiURG6vl3iGXneH6Ok87J4XZRkSxK4vnshRFb7e6 +Bm4a7DddIRBDhYEsR6RAb+0mYODt+MJTOlKIhAH/GHlpoJ1JMGYh228NApZi2yxJw EXiPj1hr0jQ4yLgv9A8TnCOpmfv02cQdQ2S7mouJnG3Q1R2Jv4+jA7bsSnLVxEDuZn tAE9M4jarmrhU+QMxBJ7OxeXA1iyuQ8RWu4K97UsFN1KL0qBB1/lCnvfDsBB/DQdxn MtPwH8fmSQmVtsJWSGOMmXEgM1wwySnamv/dUXWTbOtTr45AzJZymGoQgf8C49zV5v nwpKQcdW6rFrg== Date: Tue, 24 Jan 2023 17:15:18 +0000 From: Conor Dooley To: Pierre Gondois Cc: linux-kernel@vger.kernel.org, Geert Uytterhoeven , Conor Dooley , Dan Carpenter , Catalin Marinas , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Akihiko Odaki , Palmer Dabbelt , Gavin Shan , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH -next v2 2/3] cacheinfo: Make default acpi_get_cache_info() return an error Message-ID: References: <20230124154053.355376-1-pierre.gondois@arm.com> <20230124154053.355376-3-pierre.gondois@arm.com> MIME-Version: 1.0 In-Reply-To: <20230124154053.355376-3-pierre.gondois@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230124_091527_439754_4B9E8EBA X-CRM114-Status: GOOD ( 29.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2618378378744696581==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============2618378378744696581== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="SHrM4lZTmcwll7Yv" Content-Disposition: inline --SHrM4lZTmcwll7Yv Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 24, 2023 at 04:40:47PM +0100, Pierre Gondois wrote: > commit bd500361a937 ("ACPI: PPTT: Update acpi_find_last_cache_level() > to acpi_get_cache_info()") > updates the prototype of acpi_get_cache_info(). The cache 'levels' > is update through a pointer and not the return value of the function. >=20 > If CONFIG_ACPI_PPTT is not defined, acpi_get_cache_info() doesn't > update its *levels and *split_levels parameters and returns 0. > This can lead to a faulty behaviour. >=20 > Make acpi_get_cache_info() return an error code if CONFIG_ACPI_PPTT > is not defined. > Also, >=20 > In init_cache_level(), if no PPTT is present or CONFIG_ACPI_PPTT is > not defined, instead of aborting if acpi_get_cache_info() returns an > error code, just continue. This allows to try fetching the cache > information from clidr_el1. Again, dunno jack about clidr_el1. But the change here seems sane once more? I was going to suggest throwing away ret entirely and just initialising fw_level to zero, since the function inside acpi_get_cache_level() that actually modifies it comes after the last error return anyway - but that probably would just leave you exposed to a change in the core code that doesn't also update the callsites. Plus this looks more deliberate IMO. On that basis, LGTM. > Signed-off-by: Pierre Gondois > --- > arch/arm64/kernel/cacheinfo.c | 2 +- > include/linux/cacheinfo.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c > index d3fe9542c370..bf348b8d321f 100644 > --- a/arch/arm64/kernel/cacheinfo.c > +++ b/arch/arm64/kernel/cacheinfo.c > @@ -59,7 +59,7 @@ int init_cache_level(unsigned int cpu) > } else { > ret =3D acpi_get_cache_info(cpu, &fw_level, NULL); > if (ret < 0) > - return ret; > + fw_level =3D 0; > } > =20 > if (fw_level < 0) > diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h > index dfef57077cd0..908e19d17f49 100644 > --- a/include/linux/cacheinfo.h > +++ b/include/linux/cacheinfo.h > @@ -100,7 +100,7 @@ static inline > int acpi_get_cache_info(unsigned int cpu, > unsigned int *levels, unsigned int *split_levels) > { > - return 0; > + return -ENOENT; > } > #else > int acpi_get_cache_info(unsigned int cpu, > --=20 > 2.25.1 >=20 --SHrM4lZTmcwll7Yv Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCY9ASJgAKCRB4tDGHoIJi 0kCAAPwM3UDd3wrW0Ki90PSY0KOZP5nvSwQFHugxZ9qRKiq+rgEA8Ps9R0lLiliq mzMeShNEiuc5jE9G3Fkdi+l/pLHCAgA= =42pH -----END PGP SIGNATURE----- --SHrM4lZTmcwll7Yv-- --===============2618378378744696581== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============2618378378744696581==--