Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2756293rwl; Mon, 27 Mar 2023 05:02:47 -0700 (PDT) X-Google-Smtp-Source: AK7set8CSdF7zjeTYb2gfmeFBEAHHdedPXo7ln4paKXDe67jsvEHwzmgRCWd0V/HGKr1XcNRPkqU X-Received: by 2002:a05:6a20:92a4:b0:db:d9b6:7fad with SMTP id q36-20020a056a2092a400b000dbd9b67fadmr10836095pzg.6.1679918566619; Mon, 27 Mar 2023 05:02:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679918566; cv=none; d=google.com; s=arc-20160816; b=fvOZcIH9QKDke3Oy7n+bvF9qhf+DH89d8aXFDF+3JlXgof/8rQmiS8kpIxepjsKfCE +AAKIrAtojFkDf+NBKBiXczjUTs0gcmCGes6kN10dS7csGi27o8x/F5LvD+SElrGNNwQ TBdr1ivo4/m9lakwzIYJfg6KFkKiT2MZekeOqydfvKlFsMclROn8K7HcSe/isGlWgv/k wx22uNxlijUz9vjspY5mZWKS3YJy0js+0lKap8BI8Gldi2NggQFofbHivU+iE4MU4GhA rp5jjyTys1EVt5ZgS9fRp9nx8ZHKKLd3Obeuzc7yVz1njCXyYEbkhiJ9Ynvh8MbT9Iws p6hg== 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=XTwt2K1oLwDilPtKiF15UxBp1utAW4RKpr6b/XNacfs=; b=DtIAPMY4lTNeCRkoHfvxMRL6ae46qMkxRTzW51ZNQDBkmYETR67ImqiY1Z8pVDa8hm 1uNWmssr3/qSwpbeZjivOSdjtFWHmqTsISV29+tE3vUN9Nzm1w/XBDZsdHHUidFDgjgV 38on8aYXjJjOZsK1W7I0Ye/ebhSOW5mXktd3EeI69Xpm/WnbGbDuX51aSk9UrWxeS22L Q+vgDIGflGK51n1OP1kLDLrW9wKV5kygLqs+WS729K5PMPQ2GBgZhiFC7vPJnYGKhsJ+ EbE1vhogrppOQVYyT2aXr+66bGIKtQBGVVDfkGIl2lGyyq3MTpi+KyV7zwf/Ve5aUrN3 ypYQ== 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 n7-20020a6543c7000000b004fbaad02597si26538432pgp.457.2023.03.27.05.02.34; Mon, 27 Mar 2023 05:02:46 -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 S231921AbjC0MA0 (ORCPT + 99 others); Mon, 27 Mar 2023 08:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232582AbjC0MAZ (ORCPT ); Mon, 27 Mar 2023 08:00:25 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 472DE3C1F for ; Mon, 27 Mar 2023 05:00:24 -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 40A00C14; Mon, 27 Mar 2023 05:01:08 -0700 (PDT) Received: from pierre123.arm.com (unknown [10.57.19.133]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6FFF83F663; Mon, 27 Mar 2023 05:00:21 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Radu Rendec , Pierre Gondois , Catalin Marinas , Will Deacon , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sudeep Holla , Oliver Upton , Akihiko Odaki , Palmer Dabbelt , Gavin Shan , linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] cacheinfo: Check sib_leaf in cache_leaves_are_shared() Date: Mon, 27 Mar 2023 13:59:49 +0200 Message-Id: <20230327115953.788244-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230327115953.788244-1-pierre.gondois@arm.com> References: <20230327115953.788244-1-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=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 If 'this_leaf' is a L2 cache (or higher) and 'sib_leaf' is a L1 cache, the caches are detected as shared. Indeed, cache_leaves_are_shared() only checks the cache level of 'this_leaf' when 'sib_leaf''s cache level should also be checked. Also update the comment: the function is called when populating 'shared_cpu_map'. Signed-off-by: Pierre Gondois --- drivers/base/cacheinfo.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index f6573c335f4c..4ca117574af1 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -38,11 +38,10 @@ static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, { /* * For non DT/ACPI systems, assume unique level 1 caches, - * system-wide shared caches for all other levels. This will be used - * only if arch specific code has not populated shared_cpu_map + * system-wide shared caches for all other levels. */ if (!(IS_ENABLED(CONFIG_OF) || IS_ENABLED(CONFIG_ACPI))) - return !(this_leaf->level == 1); + return (this_leaf->level != 1) || (sib_leaf->level != 1); if ((sib_leaf->attributes & CACHE_ID) && (this_leaf->attributes & CACHE_ID)) -- 2.25.1