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 24127C433EF for ; Thu, 16 Dec 2021 23:33:47 +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-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=48HhtANvsOWCV2VrX+qvTZHgNIQZaFIs4lp++uEMtdc=; b=B29JOov3z5+9li Bi4myZbH19tnijiCoLNHgJ2U4knhmfna+PBv2HssBSbsCYsOpRH6oVSNRxhk+6TthNhoWwoUd+0lo p/EHLaPXWOOwNniHeyaqHceytRybdmpEjd7wWPMVd/x5pNBL5HNlACYLBDttyX99mfMMzd2wVWW1C S9DHxEPt14bm96nwJ6wWgNxqJgsdME41mXpxBHdt4eaXXseIPm7GGxLOKa17AJV3vNsxuojS3bMu9 ssup0D/WnNGj7V/1Obi2vU8idZUzOsz9nuNTolFWAW7mWWs/gC5yPjrrKGooTd3YATP9lJfX/vTOu UjDaDVcWX1UWlfhRlfUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1my0Eb-007wX3-0A; Thu, 16 Dec 2021 23:32:25 +0000 Received: from mail-ot1-f41.google.com ([209.85.210.41]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1my0Dm-007wIU-L4 for linux-arm-kernel@lists.infradead.org; Thu, 16 Dec 2021 23:31:35 +0000 Received: by mail-ot1-f41.google.com with SMTP id 47-20020a9d0332000000b005798ac20d72so759720otv.9 for ; Thu, 16 Dec 2021 15:31:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ycz4c/Gy+gSmZUry4vxqmr8soODhiW4Pk4hS4ry0XPo=; b=3XbgjJyImfH4+k798qMPZtKtkwBjhkSNavNEcr8uLNQejsf+cT+H/fhfA2YeFXActN rSglMuYMamuYYXN4lK5m2GA8bFgjVD+Hfe1g+nicG5Gz6QX+rNYM+abLuBCL9L99fdW1 0EV9iMOHInD+9GJHuB4AYrAbxxTLWyVfP7QAOsMG+yFvm05uQu9TYPvlkbPO9b3HHCuY ftr7Z+uo1xIKj+xPgM6TrT7OdutWFdcgfUtXPZJYggDp4Ixxyjhq4rhD5o3WdzXZGvEN 6Vd9GuEhsWVywUlJkLEr0iae91jaLrGWmFvXDgULhg8ZfFPoCOVI5UEAUJbis6wi8Aea 7jrg== X-Gm-Message-State: AOAM530GlWPLs4nO1a4z0w72EWxF0S5CXK6B/A0a2Ih7+IikNbrc5CEq la9EvOpquXVVrRlKZ7LA15MTSjwSkQ== X-Google-Smtp-Source: ABdhPJyh4CVWOSFgpPwp/C989LpGlcZ4EDHX0BCRj+KlvLZBQOUm6n+RD5gWqzZBNKys7NRir5sPEQ== X-Received: by 2002:a9d:6001:: with SMTP id h1mr317714otj.257.1639697493658; Thu, 16 Dec 2021 15:31:33 -0800 (PST) Received: from xps15.herring.priv (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.googlemail.com with ESMTPSA id n11sm1256646oor.9.2021.12.16.15.31.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 15:31:33 -0800 (PST) From: Rob Herring To: Greg Kroah-Hartman , James Morse , Jeremy Linton Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Sudeep Holla , "Rafael J. Wysocki" , Len Brown , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org Subject: [PATCH 5/6] cacheinfo: Use cpu_affinity_map for populating shared_cpu_map Date: Thu, 16 Dec 2021 17:31:24 -0600 Message-Id: <20211216233125.1130793-6-robh@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211216233125.1130793-1-robh@kernel.org> References: <20211216233125.1130793-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211216_153134_718090_E085ABC5 X-CRM114-Status: GOOD ( 16.27 ) 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that we have a full map of possible shared CPUs, we can iterate over just the cache's cpu_affinity_map instead of all online CPUs to populate the shared_cpu_map. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: Rob Herring --- drivers/base/cacheinfo.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index c9e5b48fac42..d7129b2fa9dc 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -32,12 +32,6 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu) } #ifdef CONFIG_OF -static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, - struct cacheinfo *sib_leaf) -{ - return sib_leaf->fw_token == this_leaf->fw_token; -} - /* OF properties to query for a given cache type */ struct cache_type_info { const char *size_prop; @@ -228,16 +222,6 @@ static int cache_setup_of_node(unsigned int cpu) } #else static inline int cache_setup_of_node(unsigned int cpu) { return 0; } -static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, - struct cacheinfo *sib_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 - */ - return !(this_leaf->level == 1); -} #endif int __weak cache_setup_acpi(unsigned int cpu) @@ -274,16 +258,15 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) continue; cpumask_set_cpu(cpu, &this_leaf->shared_cpu_map); - for_each_online_cpu(i) { + for_each_cpu(i, &this_leaf->cpu_affinity_map) { struct cpu_cacheinfo *sib_cpu_ci = get_cpu_cacheinfo(i); if (i == cpu || !sib_cpu_ci->info_list) continue;/* skip if itself or no cacheinfo */ + sib_leaf = sib_cpu_ci->info_list + index; - if (cache_leaves_are_shared(this_leaf, sib_leaf)) { - cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); - cpumask_set_cpu(i, &this_leaf->shared_cpu_map); - } + cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); + cpumask_set_cpu(i, &this_leaf->shared_cpu_map); } /* record the maximum cache line size */ if (this_leaf->coherency_line_size > coherency_max_size) -- 2.32.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel