public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Sudeep Holla <sudeep.holla@arm.com>, linux-kernel@vger.kernel.org
Cc: Atish Patra <atishp@atishpatra.org>,
	Atish Patra <atishp@rivosinc.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Morten Rasmussen <morten.rasmussen@arm.com>,
	Qing Wang <wangqing@vivo.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-riscv@lists.infradead.org, Rob Herring <robh+dt@kernel.org>
Subject: Re: [PATCH v3 07/16] arch_topology: Use the last level cache information from the cacheinfo
Date: Thu, 2 Jun 2022 16:26:00 +0200	[thread overview]
Message-ID: <0bf199a0-251d-323c-974a-bfd4e26f4cce@arm.com> (raw)
In-Reply-To: <20220525081416.3306043-8-sudeep.holla@arm.com>

On 25/05/2022 10:14, Sudeep Holla wrote:
> The cacheinfo is now initialised early along with the CPU topology
> initialisation. Instead of relying on the LLC ID information parsed
> separately only with ACPI PPTT elsewhere, migrate to use the similar
> information from the cacheinfo.
> 
> This is generic for both DT and ACPI systems. The ACPI LLC ID information
> parsed separately can now be removed from arch specific code.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/base/arch_topology.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 765723448b10..4c486e4e6f2f 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -663,7 +663,8 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
>  		/* not numa in package, lets use the package siblings */
>  		core_mask = &cpu_topology[cpu].core_sibling;
>  	}
> -	if (cpu_topology[cpu].llc_id != -1) {
> +
> +	if (last_level_cache_is_valid(cpu)) {
>  		if (cpumask_subset(&cpu_topology[cpu].llc_sibling, core_mask))
>  			core_mask = &cpu_topology[cpu].llc_sibling;
>  	}
> @@ -694,7 +695,7 @@ void update_siblings_masks(unsigned int cpuid)
>  	for_each_online_cpu(cpu) {
>  		cpu_topo = &cpu_topology[cpu];
>  
> -		if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {
> +		if (last_level_cache_is_shared(cpu, cpuid)) {
>  			cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
>  			cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
>  		}

I tested v3 on a Kunpeng920 (w/o CONFIG_NUMA) and it looks
like that last_level_cache_is_shared() isn't working as
expected.

I instrumented cpu_coregroup_mask() like:

const struct cpumask *cpu_coregroup_mask(int cpu)
{
        const cpumask_t *core_mask = cpumask_of_node(cpu_to_node(cpu));

        if (cpumask_subset(&cpu_topology[cpu].core_sibling, core_mask)) {
                core_mask = &cpu_topology[cpu].core_sibling;
                (1)
        }

	(2)

        if (last_level_cache_is_valid(cpu)) {
                if (cpumask_subset(&cpu_topology[cpu].llc_sibling, core_mask))
                        core_mask = &cpu_topology[cpu].llc_sibling;
                        (3)
        }

        if (IS_ENABLED(CONFIG_SCHED_CLUSTER) &&
            cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling))
                core_mask = &cpu_topology[cpu].cluster_sibling;
                (4)

        (5)
        return core_mask;
}

and got:

(A) v3 patch-set:

[   11.561133] (1) cpu_coregroup_mask[0]=0-47
[   11.565670] (2) last_level_cache_is_valid(0)=1
[   11.570587] (3) cpu_coregroup_mask[0]=0    <-- llc_sibling=0 (should be 0-23)
[   11.574833] (4) cpu_coregroup_mask[0]=0-3  <-- Altra hack kicks in!
[   11.579275] (5) cpu_coregroup_mask[0]=0-3

# cat /sys/kernel/debug/sched/domains/cpu0/domain*/name
CLS
DIE

# cat /proc/schedstat | awk '{print $1 " " $2 }' | grep ^[cd] | head -3
cpu0 0
domain0 00000000,00000000,0000000f
domain1 ffffffff,ffffffff,ffffffff

So the MC domain is missing.

(B) mainline as reference (cpu_coregroup_mask() slightly different):

[   11.585008] (1) cpu_coregroup_mask[0]=0-47
[   11.589544] (3) cpu_coregroup_mask[0]=0-23 <-- !!!
[   11.594079] (5) cpu_coregroup_mask[0]=0-23

# cat /sys/kernel/debug/sched/domains/cpu0/domain*/name
CLS
MC                                            <-- !!!
DIE

# cat /proc/schedstat | awk '{print $1 " " $2 }' | grep ^[cd] | head -4
cpu0 0
domain0 00000000,00000000,0000000f
domain1 00000000,00000000,00ffffff            <-- !!!
domain2 ffffffff,ffffffff,ffffffff

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2022-06-02 14:26 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25  8:14 [PATCH v3 00/16] arch_topology: Updates to add socket support and fix cluster ids Sudeep Holla
2022-05-25  8:14 ` [PATCH v3 01/16] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Sudeep Holla
2022-05-25  8:14   ` [PATCH v3 02/16] cacheinfo: Add helper to access any cache index for a given CPU Sudeep Holla
2022-05-25  8:14     ` [PATCH v3 03/16] cacheinfo: Move cache_leaves_are_shared out of CONFIG_OF Sudeep Holla
2022-05-25  8:14       ` [PATCH v3 04/16] cacheinfo: Add support to check if last level cache(LLC) is valid or shared Sudeep Holla
2022-05-25  8:14         ` [PATCH v3 05/16] cacheinfo: Allow early detection and population of cache attributes Sudeep Holla
2022-05-25  8:14           ` [PATCH v3 06/16] arch_topology: Add support to parse and detect " Sudeep Holla
2022-05-25  8:14             ` [PATCH v3 07/16] arch_topology: Use the last level cache information from the cacheinfo Sudeep Holla
2022-05-25  8:14               ` [PATCH v3 08/16] arm64: topology: Remove redundant setting of llc_id in CPU topology Sudeep Holla
2022-05-25  8:14                 ` [PATCH v3 09/16] arch_topology: Drop LLC identifier stash from the " Sudeep Holla
2022-05-25  8:14                   ` [PATCH v3 10/16] arch_topology: Set thread sibling cpumask only within the cluster Sudeep Holla
2022-05-25  8:14                     ` [PATCH v3 11/16] arch_topology: Check for non-negative value rather than -1 for IDs validity Sudeep Holla
2022-05-25  8:14                       ` [PATCH v3 12/16] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Sudeep Holla
2022-05-25  8:14                         ` [PATCH v3 13/16] arch_topology: Don't set cluster identifier as physical package identifier Sudeep Holla
2022-05-25  8:14                           ` [PATCH v3 14/16] arch_topology: Drop unnecessary check for uninitialised package_id Sudeep Holla
2022-05-25  8:14                             ` [PATCH v3 15/16] arch_topology: Set cluster identifier in each core/thread from /cpu-map Sudeep Holla
2022-05-25  8:14                               ` [PATCH v3 16/16] arch_topology: Add support for parsing sockets in /cpu-map Sudeep Holla
2022-06-03 12:30                               ` [PATCH v3 15/16] arch_topology: Set cluster identifier in each core/thread from /cpu-map Dietmar Eggemann
2022-06-06 10:21                                 ` Sudeep Holla
2022-06-10 10:08                                   ` Vincent Guittot
2022-06-10 10:27                                     ` Sudeep Holla
2022-06-13  9:19                                       ` Dietmar Eggemann
2022-06-13 11:17                                         ` Sudeep Holla
2022-06-16 16:02                                           ` Dietmar Eggemann
2022-06-17 11:16                                             ` Sudeep Holla
2022-06-20 13:27                                               ` Dietmar Eggemann
2022-06-21 16:00                                                 ` Sudeep Holla
2022-06-14 17:59                                       ` Vincent Guittot
2022-06-15 17:00                                         ` Sudeep Holla
2022-06-15 22:44                                           ` Vincent Guittot
2022-06-15 22:45                                           ` Vincent Guittot
2022-06-01  3:40                         ` [PATCH v3 12/16] arch_topology: Avoid parsing through all the CPUs once a outlier CPU is found Gavin Shan
2022-06-01  3:38                       ` [PATCH v3 11/16] arch_topology: Check for non-negative value rather than -1 for IDs validity Gavin Shan
2022-06-01  3:36                     ` [PATCH v3 10/16] arch_topology: Set thread sibling cpumask only within the cluster Gavin Shan
2022-06-01  3:35                   ` [PATCH v3 09/16] arch_topology: Drop LLC identifier stash from the CPU topology Gavin Shan
2022-06-01 12:06                     ` Sudeep Holla
2022-06-02  6:44                       ` Gavin Shan
2022-06-02  6:42                   ` Gavin Shan
2022-06-02  6:42                 ` [PATCH v3 08/16] arm64: topology: Remove redundant setting of llc_id in " Gavin Shan
2022-06-01  3:31               ` [PATCH v3 07/16] arch_topology: Use the last level cache information from the cacheinfo Gavin Shan
2022-06-02 14:26               ` Dietmar Eggemann [this message]
2022-06-06  9:54                 ` Sudeep Holla
2022-06-01  3:29             ` [PATCH v3 06/16] arch_topology: Add support to parse and detect cache attributes Gavin Shan
2022-06-01  3:25           ` [PATCH v3 05/16] cacheinfo: Allow early detection and population of " Gavin Shan
2022-06-01  3:20         ` [PATCH v3 04/16] cacheinfo: Add support to check if last level cache(LLC) is valid or shared Gavin Shan
2022-06-01  2:51       ` [PATCH v3 03/16] cacheinfo: Move cache_leaves_are_shared out of CONFIG_OF Gavin Shan
2022-06-01  2:44     ` [PATCH v3 02/16] cacheinfo: Add helper to access any cache index for a given CPU Gavin Shan
2022-06-01 12:45       ` Sudeep Holla
2022-06-01  2:45   ` [PATCH v3 01/16] cacheinfo: Use of_cpu_device_node_get instead cpu_dev->of_node Gavin Shan
2022-06-01  3:49 ` [PATCH v3 00/16] arch_topology: Updates to add socket support and fix cluster ids Gavin Shan
2022-06-01 12:03   ` Sudeep Holla

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=0bf199a0-251d-323c-974a-bfd4e26f4cce@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=atishp@atishpatra.org \
    --cc=atishp@rivosinc.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=morten.rasmussen@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=wangqing@vivo.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