Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp550915iob; Fri, 13 May 2022 07:28:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs6QHtAuFW/yB88Fxn/3p3+MTHWezsl4ZA6dqZj+7qKSSo7ZWcPh8qGaayXjYUkazAlv1X X-Received: by 2002:a17:907:9609:b0:6f4:d4d7:7c82 with SMTP id gb9-20020a170907960900b006f4d4d77c82mr4494347ejc.483.1652452091448; Fri, 13 May 2022 07:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652452091; cv=none; d=google.com; s=arc-20160816; b=0VDUWJJiCOqHOuZp2OC21PTCUEidMS+SohFe2i9npFD5rjO+aSz641lTgyRn5ToVf8 ec+VT+CchVomEAzomN1J5VqU54vkY4/E1NbmroX+Rs4ErZTe4GMud1y2UZfB2in9famT topomLrh43ulSBRY+ayQjGw3y6nwACWrjhLw6Pi5Kn4DbIRmsH1NvsHqujbGSqUPmR0M zI2K9EgxhVJTRiK2CfFVCUvqlFIeo+HWLo+XcG6DdnhG3mndLoDYxM3xIiArjOVP+EXB i1t/PC8L4dsTAd6zrjMKLyqoi8dbabbxJTwwXjfSBk8BhdTEXzvV+Dl7WbOgMLxH1m25 etVQ== 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:to:content-language:subject:user-agent:mime-version:date :message-id; bh=rIiCGOh5R8sE8qoDzvtElC+wex7X674sX07NpQmLQUY=; b=YgIQNiwdid35UtEnboFuAhOZ3lQ+1qygDvQON5kC//i1Td4pNlZswcfYrlni/6pyy0 R1fCK4NMZddI1g0rpK25WEvEXfkD04aEd0ZPHavhnxT/pxlFTX3ztr8GneamqeAxRB5C pwp0Kt/AVO39YHINck/NRGloRh3pmKDLgrLxgzt/XRl2pYynXdLKAYZ+uxSR8Ul28GXj X7rJchZnRp3d4b9IX/pZ00+XW2ATtx6sko9pcBpY6Zizl/o5VteCiu8Fb/HCbGwgXDRi sSRBBf0ym3suRxwEOAhA0WWVnWRtSGDZ/zwyV5HX0930QY8P4eYc2Zz6ZszJBcLTMF+M 6gKA== 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 dm2-20020a170907948200b006e8a0b9f086si1869779ejc.487.2022.05.13.07.27.44; Fri, 13 May 2022 07:28:11 -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 S1351894AbiELJwO (ORCPT + 99 others); Thu, 12 May 2022 05:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240932AbiELJwN (ORCPT ); Thu, 12 May 2022 05:52:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F348B3ED02 for ; Thu, 12 May 2022 02:52:11 -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 C94A0106F; Thu, 12 May 2022 02:52:11 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D23F53F66F; Thu, 12 May 2022 02:52:10 -0700 (PDT) Message-ID: Date: Thu, 12 May 2022 11:52:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] arch_topology: support parsing cluster_id from DT Content-Language: en-US To: =?UTF-8?B?546L5pOO?= , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , "linux-kernel@vger.kernel.org" References: <1651739735-51884-1-git-send-email-wangqing@vivo.com> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/2022 11:38, 王擎 wrote: > >>> From: Wang Qing [...] >> Would have to be cluster_id = -1. 0 is a valid 2. level cluster. >> Otherwise you're not removing the CLS data from CPU4 to CPU7 in the >> `Armv9 with L2 complexes` cpu-map example I used for testing: >> >>                 cpu-map { >>                         cluster0 { >>                                 cluster0 { >>                                         core0 { >>                                                 cpu = <&cpu0>; >>                                         }; >>                                         core1 { >>                                                 cpu = <&cpu1>; >>                                         }; >>                                 }; >>                                 cluster1 { >>                                         core0 { >>                                                 cpu = <&cpu2>; >>                                         }; >>                                         core1 { >>                                                 cpu = <&cpu3>; >>                                         }; >>                                 }; >>                         }; >>                         cluster1 { >>                                 core0 { >>                                         cpu = <&cpu4>; >>                                 }; >>                                 core1 { >>                                         cpu = <&cpu5>; >>                                 }; >>                                 core2 { >>                                         cpu = <&cpu6>; >>                                 }; >>                         }; >>                         cluster2 { >>                                 core0 { >>                                         cpu = <&cpu7>; >>                                 }; >>                         }; >>                 }; [...] >> Looks like you also need to adapt update_siblings_masks() to only set >> cpu in &cpu_topo->thread_sibling and &cpuid_topo->thread_sibling when >> `cpu_topo->thread_id != -1`. >> >> @@ -723,11 +723,11 @@ void update_siblings_masks(unsigned int cpuid) >>                 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; >> - >> -               cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling); >> -               cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling); >> +               if (cpu_topo->thread_id != -1 && >> +                   cpuid_topo->core_id == cpu_topo->core_id) { >> +                       cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling); >> +                       cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling); >> + > > This seems like another problem? I don't think so. If you run a system with the cpu-map mentioned above you get: # cat /sys/kernel/debug/sched/domains/cpu0/domain*/name SMT <-- !!! CLS MC root@e125579:~# cat /proc/schedstat | awk '{print $1 " " $2 }' | grep ^[cd] | head -5 cpu0 0 domain0 05 <-- !!! domain1 07 <-- !!! domain2 0f domain3 ff So you get an unwanted SMT level for CPU0-3 and messed-up cpumasks without this change.