mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 王擎 <wangqing@vivo.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] arch_topology: support parsing cluster_id from DT
Date: Thu, 12 May 2022 12:52:24 +0000	[thread overview]
Message-ID: <SL2PR06MB308257AED496B4E8D10DB6A5BDCB9@SL2PR06MB3082.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <bd746cf0-0fdd-1ee6-d394-67fffb5d9b58@arm.com>


>> 
>>>> From: Wang Qing <wangqing@vivo.com>
>
>[...]
>
>>> 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

Here is not enough, cpu0,1,4,5 will make up SMT below:
cluster0 {
        cluster0 {
                core0 {
                        thread0 {
                                 cpu = <&CPU0>;
                                };
                        thread1 {
                                 cpu = <&CPU1>;
                                };
                      };
                };
                core1 {
                        thread0 {
                                 cpu = <&CPU2>;
                                };
                        thread1 {
                                 cpu = <&CPU3>;
                                };
                      };
                };
        cluster1 {
                core0 {
                        thread0 {
                                 cpu = <&CPU4>;
                                };
                        thread1 {
                                 cpu = <&CPU5>;
                                };
                      };
                };
                core1 {
                        thread0 {
                                 cpu = <&CPU6>;
                                };
                        thread1 {
                                 cpu = <&CPU7>;
                                };
                      };
                };
...
I will handle this.

Thanks,
Qing

>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.

      reply	other threads:[~2022-05-12 12:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-05  8:35 Qing Wang
2022-05-10 17:21 ` Dietmar Eggemann
2022-05-11  9:38   ` 王擎
2022-05-12  9:52     ` Dietmar Eggemann
2022-05-12 12:52       ` 王擎 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SL2PR06MB308257AED496B4E8D10DB6A5BDCB9@SL2PR06MB3082.apcprd06.prod.outlook.com \
    --to=wangqing@vivo.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sudeep.holla@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®