Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1777453rwl; Thu, 6 Apr 2023 00:40:02 -0700 (PDT) X-Google-Smtp-Source: AKy350YaOEy2XEj169Tr2XrA7KXWe7jBTIEsOeIgA6Br4mDumgSrkneltsOmQKzW8LZJb6neTSuK X-Received: by 2002:aa7:9a07:0:b0:62b:47fc:a968 with SMTP id w7-20020aa79a07000000b0062b47fca968mr8116283pfj.8.1680766802566; Thu, 06 Apr 2023 00:40:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680766802; cv=none; d=google.com; s=arc-20160816; b=KA0H6W3Oypkv1eITvWuE/sOeWjblQv7c+l9VxP3s5nNrAI8pJ8ZJXcYQGUzOPlmMBB QPiHBOjp9Ou6hNDNrtDbp3GMpFQAvhAi2QDa3D8LeZiS9sccVK7VkC95KiwIN88Co/6P sQWPENGiwL5GH1H1AYJya2y7GwsOMT+Fj66xP63G5QIikh+dz4N3NLjLo7ltdKB1DUdU D9ZJNhRuyXpPzDsrwgDsChXS6YY/y7Fjl+UK8vlBd/xY5LgNvwVM48/tbSoCR18pOgFv UTShdsRnK8D/GfNPbBHn71t/yzozEzIoWndoEMn05qX7Qh2Y03xLf3h0bkQthlKwtT9h aLlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=9oGuTf1TAAMPc7Oa16paYt7a7P3ZwkvZh6wmRecJkwE=; b=0MikNqCBxqFOfyXOB6d0+d0/5h0yv8rtuokcumhBD2z2n3a8XBU4+odAfSGi9Nv5Co sd9+yecwOacfGINrK8oWj7zT2HPM7v8zl9SS73gOIwJcR14WReHK76RsGmTZcGokzXVO 2UcBJCZuWEnbvVwCNiapZuOnQJF3lAlX66Dz5w92QpJ2bvBNFlcxh0pxzamFXogjqERQ lDucL+vRbfIUGtgw3o6dp7hmYbRVBNYtAo1UmkFdtAA28rn/pdjyfvbAU07wmmvQafed 2oliZIU+c7tYHx5VQ1J5MiBe8w3BPcAYEhDx0kFSeq0yuESKAbgrWaE+68EwpVXZTL5t ZuPw== 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 w4-20020a656944000000b00513776b1d30si663233pgq.460.2023.04.06.00.39.50; Thu, 06 Apr 2023 00:40:02 -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 S235520AbjDFHbr (ORCPT + 99 others); Thu, 6 Apr 2023 03:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235697AbjDFHbp (ORCPT ); Thu, 6 Apr 2023 03:31:45 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6311C76BD for ; Thu, 6 Apr 2023 00:31:42 -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 3224016F8; Thu, 6 Apr 2023 00:32:26 -0700 (PDT) Received: from [192.168.1.12] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 616F83F73F; Thu, 6 Apr 2023 00:31:39 -0700 (PDT) Message-ID: <43d05005-052e-dd32-cf1e-17c569ebe2d9@arm.com> Date: Thu, 6 Apr 2023 09:31:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 2/3] cacheinfo: Check cache properties are present in DT Content-Language: en-US To: Conor Dooley Cc: linux-kernel@vger.kernel.org, Radu Rendec , Catalin Marinas , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Akihiko Odaki , Palmer Dabbelt , Gavin Shan , Jeremy Linton , linux-arm-kernel@lists.infradead.org, Alexandre Ghiti References: <20230327115953.788244-1-pierre.gondois@arm.com> <20230327115953.788244-3-pierre.gondois@arm.com> <20230404-hatred-swimmer-6fecdf33b57a@spud> From: Pierre Gondois In-Reply-To: <20230404-hatred-swimmer-6fecdf33b57a@spud> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Hello Conor, On 4/4/23 21:29, Conor Dooley wrote: > Hey Pierre, > > On Mon, Mar 27, 2023 at 01:59:50PM +0200, Pierre Gondois wrote: >> If a Device Tree (DT) is used, the presence of cache properties is >> assumed. Not finding any is not considered. For arm64 platforms, >> cache information can be fetched from the clidr_el1 register. >> Checking whether cache information is available in the DT >> allows to switch to using clidr_el1. >> >> init_of_cache_level() >> \-of_count_cache_leaves() >> will assume there a 2 cache leaves (L1 data/instruction caches), which >> can be different from clidr_el1 information. >> >> cache_setup_of_node() tries to read cache properties in the DT. >> If there are none, this is considered a success. Knowing no >> information was available would allow to switch to using clidr_el1. >> > > Alex reported seeing a bunch of messages in his boot log in QEMU since > -rc1 which appears to be the fault of, as far as I can tell, e0df442ee49 > ("cacheinfo: Check 'cache-unified' property to count cache leaves") > like: > cacheinfo: Unable to detect cache hierarchy for CPU N > > The RISC-V QEMU virt machine doesn't define any cache properties of any > sort in the dtb, and unlike the arm64 virt machine I tried (a72) doesn't > have some registers that cache info is discoverable from. > When we call of_count_cache_leaves() from init_of_cache_level() and > there are of course no reasons to increment leaves, we hit the return 2 > case you mention above, setting num_leaves to 2. > > As you mention, when we hit cache_setup_of_node(), levels is not going > to be set to one, so we trigger the condition (this_leaf->level != 1) > and, as there are no cache nodes, break out of the loop without > incrementing index. Index is therefore less than 2, and thus we return > -ENOENT. > This is of course propagated back out to detect_cache_attributes() and > triggers the "Unable to detect..." printout :( > > With this patch(set), the spurious error prints go away, but we are left > with a "Early cacheinfo failed, ret = -22" which will need to be fixed. > > So I think this also needs to be: > Fixes: de0df442ee49 ("cacheinfo: Check 'cache-unified' property to count cache leaves") > > Probably also needs a: > Reported-by: Alexandre Ghiti > since he's found an actual, rather than theoretical, problem! Ok yes indeed, I will do this and the other comments you made, Regards, Pierre > > Cheers, > Conor. >