Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1009626iob; Fri, 13 May 2022 19:29:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB1mzfyF23up6NthEVoRdINsmElMayGJsXa6a9uTywlTx3D05xP0qdtBMBFuJo6wsLc3xz X-Received: by 2002:a05:600c:3549:b0:394:89ba:e1be with SMTP id i9-20020a05600c354900b0039489bae1bemr6881632wmq.181.1652495342317; Fri, 13 May 2022 19:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652495342; cv=none; d=google.com; s=arc-20160816; b=acYuLJXmKLpwvm0MyUUiCcLXECUnJSDb7e8p2+ItNmDhRf9ddeLeP1e6lkFYqYT6YR mZ90cHI6zjtlx7g8okGeLlSG0Pkei06XgHt54hNW2wjVOGN3q1HmvxmL0LOxvo8lL0AS isuRMRKSZEhuEOBwKje12tY6ABXzbXQlaHAJMq49VtSDKdZewySVM9GvQn2GVG4/WA4r 9X2j8J6KSj+Rn0zU6/Iqjf2DmVRYdKKeBMI9qeA3VM08xPj0E1viUJAfZHo+UdNtXysz QfwKaPNx8s/KuXrXiMTOuJhFNvx4grbllAVK1D6VDSRr5M2VZjblU06W59RtPmOz+1Rk wAlg== 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=I6TAdnx9K9B2DIm62/zCgLAz4cnBRsQhKjSuQ7jd6q8=; b=XSu1IxWy53v2CeSK3VjEcaqOgLUewTc0eXp1ikGuJJ8TpgvknsGJcs0/tPuuKtEuVX xaFPwdQKBbLWwwt6ENWLhnv7N12nCUn1hChosV5nBHwMjiKkH80+YKRcJmMRTEd9aO3P dLIrOXxDzd+Q6M2CWqiq6VA7XaA6MmOd9clJhx4NmR3nahnbb76DgXl5IY5c3JSu2Q30 0gazfwYXRZTBkO7Q9XGmcn9ium0KQIWJ6fG+L6RcAmf/CJhwaUEn/zAK7HINPiMMDnsf poKL8/bmMjiNrERJWhE2AvrkIuI8kr4O7Gz6fBzhJ5QKG7yS65sXO9RRFjQJwub7bLA6 a4Gg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j10-20020adfa54a000000b0020c61ef93f5si3442799wrb.493.2022.05.13.19.29.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:29:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E0E0315E9A; Fri, 13 May 2022 17:43:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382651AbiEMQvV (ORCPT + 99 others); Fri, 13 May 2022 12:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382695AbiEMQvA (ORCPT ); Fri, 13 May 2022 12:51:00 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E67C55253A for ; Fri, 13 May 2022 09:50:53 -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 65C6F113E; Fri, 13 May 2022 09:50:53 -0700 (PDT) Received: from usa.arm.com (e103737-lin.cambridge.arm.com [10.1.197.49]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1E9E33F73D; Fri, 13 May 2022 09:50:52 -0700 (PDT) From: Sudeep Holla To: Atish Patra , Atish Patra , linux-kernel@vger.kernel.org Cc: Sudeep Holla , Atish Patra , Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Qing Wang Subject: [UPDATED] [PATCH 2/4] arch_topology: Set thread sibling cpumask only within the cluster Date: Fri, 13 May 2022 17:50:41 +0100 Message-Id: <20220513165041.1163308-1-sudeep.holla@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220513095559.1034633-3-sudeep.holla@arm.com> References: <20220513095559.1034633-3-sudeep.holla@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Currently the cluster identifier is not set on the DT based platforms. The reset or default value is -1 for all the CPUs. Once we assign the cluster identifier values correctly that imay result in getting the thread siblings wrongs as the core identifiers can be same for 2 different CPUs belonging to 2 different cluster. So, in order to get the thread sibling cpumasks correct, we need to update them only if the cores they belong are in the same cluster within the socket. Let us skip updation of the thread sibling cpumaks if the cluster identifier doesn't match. This change won't affect even if the cluster identifiers are not set currently but will avoid any breakage once we set the same correctly. Signed-off-by: Sudeep Holla --- drivers/base/arch_topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) I seem to have not included the fix I did after testing the patches. This version is updated to fix the issue with the original 2/4 diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 44f733b365cc..7f5aa655c1f4 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -697,15 +697,17 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->package_id != cpu_topo->package_id) continue; - if (cpuid_topo->cluster_id == cpu_topo->cluster_id && - cpuid_topo->cluster_id != -1) { + cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); + cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); + + if (cpuid_topo->cluster_id != cpu_topo->cluster_id) + continue; + + if (cpuid_topo->cluster_id != -1) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } - cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); - cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); - if (cpuid_topo->core_id != cpu_topo->core_id) continue; -- 2.36.1