public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Valentin Schneider <valentin.schneider@arm.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Quentin Perret <qperret@google.com>,
	peterz@infradead.org, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, morten.rasmussen@arm.com
Subject: Re: [PATCH v4 03/10] sched/topology: Propagate SD_ASYM_CPUCAPACITY upwards
Date: Thu, 06 Aug 2020 17:19:26 +0100	[thread overview]
Message-ID: <jhj5z9viw6p.mognet@arm.com> (raw)
In-Reply-To: <20200806142025.GD2077896@gmail.com>


On 06/08/20 15:20, Ingo Molnar wrote:
> * Valentin Schneider <valentin.schneider@arm.com> wrote:
>
>> We currently set this flag *only* on domains whose topology level exactly
>> match the level where we detect asymmetry (as returned by
>> asym_cpu_capacity_level()). This is rather problematic.
>>
>> Say there are two clusters in the system, one with a lone big CPU and the
>> other with a mix of big and LITTLE CPUs (as is allowed by DynamIQ):
>>
>> DIE [                ]
>> MC  [             ][ ]
>>      0   1   2   3  4
>>      L   L   B   B  B
>>
>> asym_cpu_capacity_level() will figure out that the MC level is the one
>> where all CPUs can see a CPU of max capacity, and we will thus set
>> SD_ASYM_CPUCAPACITY at MC level for all CPUs.
>>
>> That lone big CPU will degenerate its MC domain, since it would be alone in
>> there, and will end up with just a DIE domain. Since the flag was only set
>> at MC, this CPU ends up not seeing any SD with the flag set, which is
>> broken.
>>
>> Rather than clearing dflags at every topology level, clear it before
>> entering the topology level loop. This will properly propagate upwards
>> flags that are set starting from a certain level.
>>
>> Reviewed-by: Quentin Perret <qperret@google.com>
>> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
>> ---
>>  kernel/sched/topology.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
>> index 865fff3ef20a..42b89668e1e4 100644
>> --- a/kernel/sched/topology.c
>> +++ b/kernel/sched/topology.c
>> @@ -1985,11 +1985,10 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
>>      /* Set up domains for CPUs specified by the cpu_map: */
>>      for_each_cpu(i, cpu_map) {
>>              struct sched_domain_topology_level *tl;
>> +		int dflags = 0;
>>
>>              sd = NULL;
>>              for_each_sd_topology(tl) {
>> -			int dflags = 0;
>> -
>>                      if (tl == tl_asym) {
>>                              dflags |= SD_ASYM_CPUCAPACITY;
>>                              has_asym = true;
>
> I'd suggest ordering all patches with potential side effects at the
> end, to make them easier to bisect.
>
> I.e. I'd reorder this series to do:
>
>  - Obviously correct renamings & cleanups
>
>  - Convert the code over to the new instrumented sd-flags method. This
>    will presumably spew a few warnings for problems the new debugging
>    checks catch in existing topologies.
>
>  - Do all the behavioral changes and fixes like this patch, even if we
>    think that they have no serious side effects.
>
> In that sense it might make sense to order the two ARM patches to the
> later stage as well - but I suppose it's OK to do those two first as
> well.
>

This does sound sensible; I can shuffle this around for v5.

FWIW the reason I had this very patch before the instrumentation is that
IMO it really wants to be propagated and could thus directly be tagged with
SDF_SHARED_PARENT when the instrumentation hits. It's a minor thing, but
having it after the instrumentation means that I'll first have to tag it
without any hierarchical metaflag, and then tag it with SDF_SHARED_PARENT
in the propagation fix.

If that sounds fine by you, I'll do just that.

> Nice series otherwise, these new checks look really useful and already
> caught bugs.
>

Thanks!

> Thanks,
>
>       Ingo

  reply	other threads:[~2020-08-06 16:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-31 11:54 [PATCH v4 00/10] sched: Instrument sched domain flags Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 01/10] ARM, sched/topology: Remove SD_SHARE_POWERDOMAIN Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 02/10] ARM: Revert back to default scheduler topology Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 03/10] sched/topology: Propagate SD_ASYM_CPUCAPACITY upwards Valentin Schneider
2020-08-06 14:20   ` Ingo Molnar
2020-08-06 16:19     ` Valentin Schneider [this message]
2020-08-06 16:46       ` Ingo Molnar
2020-07-31 11:54 ` [PATCH v4 04/10] sched/topology: Split out SD_* flags declaration to its own file Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 05/10] sched/topology: Define and assign sched_domain flag metadata Valentin Schneider
2020-08-04 11:08   ` peterz
2020-08-04 11:12     ` Valentin Schneider
2020-08-06 14:07   ` Ingo Molnar
2020-08-06 16:18     ` Valentin Schneider
2020-08-08  0:19       ` Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 06/10] sched/topology: Verify SD_* flags setup when sched_debug is on Valentin Schneider
2020-07-31 11:54 ` [PATCH v4 07/10] sched/topology: Add more flags to the SD degeneration mask Valentin Schneider
2020-08-06 13:57   ` Ingo Molnar
2020-07-31 11:55 ` [PATCH v4 08/10] sched/topology: Remove SD_SERIALIZE degeneration special case Valentin Schneider
2020-07-31 11:55 ` [PATCH v4 09/10] sched/topology: Introduce SD metaflag for flags needing > 1 groups Valentin Schneider
2020-07-31 11:55 ` [PATCH v4 10/10] sched/topology: Use prebuilt SD flag degeneration mask Valentin Schneider
2020-08-06 11:25 ` [PATCH v4 00/10] sched: Instrument sched domain flags Dietmar Eggemann

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=jhj5z9viw6p.mognet@arm.com \
    --to=valentin.schneider@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=vincent.guittot@linaro.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