linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Darren Hart <darren@os.amperecomputing.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	Will Deacon <will@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Arm <linux-arm-kernel@lists.infradead.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Catalin Marinas <Catalin.Marinas@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Barry Song <song.bao.hua@hisilicon.com>,
	Valentin Schneider <Valentin.Schneider@arm.com>,
	"D . Scott Phillips" <scott@os.amperecomputing.com>,
	Ilkka Koskinen <ilkka@os.amperecomputing.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] topology: make core_mask include at least cluster_siblings
Date: Tue, 8 Mar 2022 09:49:52 -0800	[thread overview]
Message-ID: <YieXQD7uG0+R5QBq@fedora> (raw)
In-Reply-To: <e91bcc83-37c8-dcca-e088-8b3fcd737b2c@arm.com>

On Tue, Mar 08, 2022 at 05:03:07PM +0100, Dietmar Eggemann wrote:
> On 08/03/2022 12:04, Vincent Guittot wrote:
> > On Tue, 8 Mar 2022 at 11:30, Will Deacon <will@kernel.org> wrote:
> 
> [...]
> 
> >>> ---
> >>> v1: Drop MC level if coregroup weight == 1
> >>> v2: New sd topo in arch/arm64/kernel/smp.c
> >>> v3: No new topo, extend core_mask to cluster_siblings
> >>>
> >>>  drivers/base/arch_topology.c | 8 ++++++++
> >>>  1 file changed, 8 insertions(+)
> >>>
> >>> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> >>> index 976154140f0b..a96f45db928b 100644
> >>> --- a/drivers/base/arch_topology.c
> >>> +++ b/drivers/base/arch_topology.c
> >>> @@ -628,6 +628,14 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
> >>>                       core_mask = &cpu_topology[cpu].llc_sibling;
> >>>       }
> >>>
> >>> +     /*
> >>> +      * For systems with no shared cpu-side LLC but with clusters defined,
> >>> +      * extend core_mask to cluster_siblings. The sched domain builder will
> >>> +      * then remove MC as redundant with CLS if SCHED_CLUSTER is enabled.
> 
> IMHO, if core_mask weight is 1, MC will be removed/degenerated anyway.
> 
> This is what I get on my Ampere Altra (I guess I don't have the ACPI
> changes which would let to a CLS sched domain):
> 
> # cat /sys/kernel/debug/sched/domains/cpu0/domain*/name
> DIE
> NUMA
> root@oss-altra01:~# zcat /proc/config.gz | grep SCHED_CLUSTER
> CONFIG_SCHED_CLUSTER=y

I'd like to follow up on this. Would you share your dmidecode BIOS
Information section?

Which kernel version?

> >>> +      */
> >>> +     if (cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling))
> >>> +             core_mask = &cpu_topology[cpu].cluster_sibling;
> >>> +
> >>
> >> Sudeep, Vincent, are you happy with this now?
> > 
> > I would not say that I'm happy because this solution skews the core
> > cpu mask in order to abuse the scheduler so that it will remove a
> > wrong but useless level when it will build its domains.
> > But this works so as long as the maintainer are happy, I'm fine

I did explore the other options and they added considerably more
complexity without much benefit in my view. I prefer this option which
maintains the cpu_topology as described by the platform, and maps it
into something that suits the current scheduler abstraction. I agree
there is more work to be done here and intend to continue with it.

> I do not have any better idea than this tweak here either in case the
> platform can't provide a cleaner setup.

I'd argue The platform is describing itself accurately in ACPI PPTT
terms. The topology doesn't fit nicely within the kernel abstractions
today. This is an area where I hope to continue to improve things going
forward.

> Maybe the following is easier to read but then we use
> '&cpu_topology[cpu].llc_sibling' in cpu_coregroup_mask() already ...
> 
> @@ -617,6 +617,7 @@ EXPORT_SYMBOL_GPL(cpu_topology);
>  const struct cpumask *cpu_coregroup_mask(int cpu)
>  {
>         const cpumask_t *core_mask = cpumask_of_node(cpu_to_node(cpu));
> +       const cpumask_t *cluster_mask = cpu_clustergroup_mask(cpu);
> 
>         /* Find the smaller of NUMA, core or LLC siblings */
>         if (cpumask_subset(&cpu_topology[cpu].core_sibling, core_mask)) {
> @@ -628,6 +629,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
>                         core_mask = &cpu_topology[cpu].llc_sibling;
>         }
> 
> +       if (cpumask_subset(core_mask, cluster_mask))
> +               core_mask = cluster_mask;
> +

Either works for me. I felt the version I sent was parallel to the
existing implementation, but have no preference either way.

>         return core_mask;
>  }
> 
> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
> 

Thanks for the review Dietmar.

-- 
Darren Hart
Ampere Computing / OS and Kernel

  reply	other threads:[~2022-03-08 17:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 17:01 [PATCH v3] topology: make core_mask include at least cluster_siblings Darren Hart
2022-03-08 10:30 ` Will Deacon
2022-03-08 10:45   ` Sudeep Holla
2022-03-08 11:04   ` Vincent Guittot
2022-03-08 16:03     ` Dietmar Eggemann
2022-03-08 17:49       ` Darren Hart [this message]
2022-03-09 12:50         ` Dietmar Eggemann
2022-03-09 18:26           ` Darren Hart
2022-03-14  9:37             ` Dietmar Eggemann
2022-03-14 16:56               ` Darren Hart
2022-03-16 14:42                 ` Dietmar Eggemann
2022-03-14 16:35             ` Dietmar Eggemann
2022-03-14 16:54               ` Darren Hart
2022-03-16 14:48                 ` Dietmar Eggemann
2022-03-16 15:20                   ` Darren Hart
2022-03-16 15:55                     ` Sudeep Holla
2022-03-21 14:30                       ` Will Deacon
2022-03-21 15:56                         ` Greg Kroah-Hartman
2022-03-14 21:29               ` [PATCH] arch_topology: Swap MC & CLS SD mask if MC weight==1 & kernel test robot
2022-03-14 23:02               ` kernel test robot
2022-03-17  6:10 ` [PATCH v3] topology: make core_mask include at least cluster_siblings Barry Song

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=YieXQD7uG0+R5QBq@fedora \
    --to=darren@os.amperecomputing.com \
    --cc=Catalin.Marinas@arm.com \
    --cc=Valentin.Schneider@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilkka@os.amperecomputing.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=scott@os.amperecomputing.com \
    --cc=song.bao.hua@hisilicon.com \
    --cc=stable@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=will@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).