Message ID | 20230413091436.230134-4-pierre.gondois@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp901083vqo; Thu, 13 Apr 2023 02:26:21 -0700 (PDT) X-Google-Smtp-Source: AKy350YE2FSKBETYW0RjdpKHPlSWnos9mx51xNoBnLgfIMkSk2uVKRWLwpTv/fZLBMK1IylH4Gth X-Received: by 2002:aa7:d3d6:0:b0:505:879:b54f with SMTP id o22-20020aa7d3d6000000b005050879b54fmr1787282edr.37.1681377981573; Thu, 13 Apr 2023 02:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681377981; cv=none; d=google.com; s=arc-20160816; b=o8dL1oRWRr5C5qkAoQRDmn6sIoNi9/9wunvdmlWJvqTZr/CHTL3oOKOg6rexkEBBbq 2P7wOgYlpjkdeoIsKM3Zl1fPZdt8bLT0iFhLUtGjnGgLMApQFU4K6mnaYcYCBYOd5H/T nzYXHJaJrDKtEphSmS7i5HuQAf41zUz3ET0ha+SlYa1HyCL2CzcgFLqxFnybuz9iCIVU Z9buRpElHgJ4ScaozJiEDUl88/d6y+GMrPeslUNyxuIm+6pDKb7/PEAWHRTZQMToYJHF 2kgG7oL49tjbTMk0oFWeoCE22ol7iPhr6Sk88IHsKuemTUOvEd46xWQZBv0x7qalIQ8g aoaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vyh+Z3p5FH+60z2QrHUnhOLI+BilfGmS0e7cNQdqmks=; b=AXuiKXeuI3HnNRg87zMaeRniKrZBLbCTW6FbzaDu6NOrtO54M8c81sbaj3YdVXOuhL 75h1p18tkC7Bd7a4jSvCWy2Wwe0THjso6i1At3eBcmtPBaGDiPS1LYZcJMTjAKLOlEU8 UMx5gnq0qOLtKG310FYMmcoTuqMFPNSpMv1f82l6TgZ2yPUQPXVe57Odmp6AGrsHwSat wMMfJDKIu5UnGpkoyynKHB0wzh+I5sYUd6kR6kEC0gCOFs1CNtrTXkppTl90B9GYwlZ4 rzs2K2xdIAm7YDhwt0YEB5EmqA34/o2Rz1eOHgA/Y/hUzi2Pi5SNrsJFwe/zSbKREUj4 tDbA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a056402038b00b00504c246e84csi1441501edv.601.2023.04.13.02.25.57; Thu, 13 Apr 2023 02:26:21 -0700 (PDT) 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 S229913AbjDMJP0 (ORCPT <rfc822;peter110.wang@gmail.com> + 99 others); Thu, 13 Apr 2023 05:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjDMJPS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Apr 2023 05:15:18 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6CC0C6199 for <linux-kernel@vger.kernel.org>; Thu, 13 Apr 2023 02:15:10 -0700 (PDT) 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 8708C13D5; Thu, 13 Apr 2023 02:15:54 -0700 (PDT) Received: from pierre123.nice.arm.com (pierre123.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 427923F6C4; Thu, 13 Apr 2023 02:15:08 -0700 (PDT) From: Pierre Gondois <pierre.gondois@arm.com> To: linux-kernel@vger.kernel.org Cc: Radu Rendec <rrendec@redhat.com>, Alexandre Ghiti <alexghiti@rivosinc.com>, Conor Dooley <conor.dooley@microchip.com>, Will Deacon <will@kernel.org>, Pierre Gondois <pierre.gondois@arm.com>, Conor Dooley <conor@kernel.org>, Sudeep Holla <sudeep.holla@arm.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Palmer Dabbelt <palmer@rivosinc.com>, Gavin Shan <gshan@redhat.com> Subject: [PATCH v3 3/4] arch_topology: Remove early cacheinfo error message Date: Thu, 13 Apr 2023 11:14:33 +0200 Message-Id: <20230413091436.230134-4-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230413091436.230134-1-pierre.gondois@arm.com> References: <20230413091436.230134-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763052598677815711?= X-GMAIL-MSGID: =?utf-8?q?1763052598677815711?= |
Series |
cacheinfo: Correctly fallback to using clidr_el1's information
|
|
Commit Message
Pierre Gondois
April 13, 2023, 9:14 a.m. UTC
fetch_cache_info() tries to get the number of cache leaves/levels
for each CPU in order to pre-allocate memory for cacheinfo struct.
Allocating this memory later triggers a:
'BUG: sleeping function called from invalid context'
in PREEMPT_RT kernels.
If there is no cache related information available in DT or ACPI,
fetch_cache_info() fails and an error message is printed:
'Early cacheinfo failed, ret = ...'
Not having cache information should be a valid configuration.
Remove the error message if fetch_cache_info() fails.
Suggested-by: Conor Dooley <conor@kernel.org>
Link: https://lore.kernel.org/all/20230404-hatred-swimmer-6fecdf33b57a@spud/
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
drivers/base/arch_topology.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
Comments
On Thu, Apr 13, 2023 at 11:14:33AM +0200, Pierre Gondois wrote: > fetch_cache_info() tries to get the number of cache leaves/levels > for each CPU in order to pre-allocate memory for cacheinfo struct. > Allocating this memory later triggers a: > 'BUG: sleeping function called from invalid context' > in PREEMPT_RT kernels. > > If there is no cache related information available in DT or ACPI, > fetch_cache_info() fails and an error message is printed: > 'Early cacheinfo failed, ret = ...' > > Not having cache information should be a valid configuration. > Remove the error message if fetch_cache_info() fails. > > Suggested-by: Conor Dooley <conor@kernel.org> Not that it really matters for suggested-by, and there's no way really for you to know, but the corporate overlords prefer: s/conor@kernel.org/conor.dooley@microchip.com/ > Link: https://lore.kernel.org/all/20230404-hatred-swimmer-6fecdf33b57a@spud/ > Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> > --- > drivers/base/arch_topology.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > index b1c1dd38ab01..1f071eaede5b 100644 > --- a/drivers/base/arch_topology.c > +++ b/drivers/base/arch_topology.c > @@ -843,10 +843,8 @@ void __init init_cpu_topology(void) > > for_each_possible_cpu(cpu) { > ret = fetch_cache_info(cpu); > - if (ret) { > - pr_err("Early cacheinfo failed, ret = %d\n", ret); Hmm do you really want to remove the print altogether? This can fail with -EINVAL and -ENOMEM too, so should we just check for | if (ret && ret != -ENOENT) instead, since in the other cases it really did fail? Cheers, Conor.
On Thu, Apr 13, 2023 at 11:02:49AM +0100, Conor Dooley wrote: > On Thu, Apr 13, 2023 at 11:14:33AM +0200, Pierre Gondois wrote: > > fetch_cache_info() tries to get the number of cache leaves/levels > > for each CPU in order to pre-allocate memory for cacheinfo struct. > > Allocating this memory later triggers a: > > 'BUG: sleeping function called from invalid context' > > in PREEMPT_RT kernels. > > > > If there is no cache related information available in DT or ACPI, > > fetch_cache_info() fails and an error message is printed: > > 'Early cacheinfo failed, ret = ...' > > > > Not having cache information should be a valid configuration. > > Remove the error message if fetch_cache_info() fails. > > > > Suggested-by: Conor Dooley <conor@kernel.org> > > Not that it really matters for suggested-by, and there's no way really > for you to know, but the corporate overlords prefer: > s/conor@kernel.org/conor.dooley@microchip.com/ > > > Link: https://lore.kernel.org/all/20230404-hatred-swimmer-6fecdf33b57a@spud/ > > Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> > > --- > > drivers/base/arch_topology.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c > > index b1c1dd38ab01..1f071eaede5b 100644 > > --- a/drivers/base/arch_topology.c > > +++ b/drivers/base/arch_topology.c > > @@ -843,10 +843,8 @@ void __init init_cpu_topology(void) > > > > for_each_possible_cpu(cpu) { > > ret = fetch_cache_info(cpu); > > - if (ret) { > > - pr_err("Early cacheinfo failed, ret = %d\n", ret); > > Hmm do you really want to remove the print altogether? This can fail > with -EINVAL and -ENOMEM too, so should we just check for > | if (ret && ret != -ENOENT) > instead, since in the other cases it really did fail? To save Sudeep (potentially) waiting for me when you resubmit, with that change: Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Thanks, Conor.
On 4/13/23 12:02, Conor Dooley wrote: > On Thu, Apr 13, 2023 at 11:14:33AM +0200, Pierre Gondois wrote: >> fetch_cache_info() tries to get the number of cache leaves/levels >> for each CPU in order to pre-allocate memory for cacheinfo struct. >> Allocating this memory later triggers a: >> 'BUG: sleeping function called from invalid context' >> in PREEMPT_RT kernels. >> >> If there is no cache related information available in DT or ACPI, >> fetch_cache_info() fails and an error message is printed: >> 'Early cacheinfo failed, ret = ...' >> >> Not having cache information should be a valid configuration. >> Remove the error message if fetch_cache_info() fails. >> >> Suggested-by: Conor Dooley <conor@kernel.org> > > Not that it really matters for suggested-by, and there's no way really > for you to know, but the corporate overlords prefer: > s/conor@kernel.org/conor.dooley@microchip.com/ > >> Link: https://lore.kernel.org/all/20230404-hatred-swimmer-6fecdf33b57a@spud/ >> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> >> --- >> drivers/base/arch_topology.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c >> index b1c1dd38ab01..1f071eaede5b 100644 >> --- a/drivers/base/arch_topology.c >> +++ b/drivers/base/arch_topology.c >> @@ -843,10 +843,8 @@ void __init init_cpu_topology(void) >> >> for_each_possible_cpu(cpu) { >> ret = fetch_cache_info(cpu); >> - if (ret) { >> - pr_err("Early cacheinfo failed, ret = %d\n", ret); > > Hmm do you really want to remove the print altogether? This can fail > with -EINVAL and -ENOMEM too, so should we just check for > | if (ret && ret != -ENOENT) > instead, since in the other cases it really did fail? I think [PATCH 2/4] requires the following update in this case: --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -288,8 +288,10 @@ int init_of_cache_level(unsigned int cpu) struct device_node *prev = NULL; unsigned int levels = 0, leaves, level; - if (!of_check_cache_nodes(np)) - goto err_out; + if (!of_check_cache_nodes(np)) { + of_node_put(np); + return -ENOENT; + } leaves = of_count_cache_leaves(np); if (leaves > 0) Is it ok to do this and keep your Reviewed-by ? Thanks for the review, Regards, Pierre
On Thu, Apr 13, 2023 at 05:25:25PM +0200, Pierre Gondois wrote:
> Is it ok to do this and keep your Reviewed-by ?
Yah, should be grand chief.
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index b1c1dd38ab01..1f071eaede5b 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -843,10 +843,8 @@ void __init init_cpu_topology(void) for_each_possible_cpu(cpu) { ret = fetch_cache_info(cpu); - if (ret) { - pr_err("Early cacheinfo failed, ret = %d\n", ret); + if (ret) break; - } } }