public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
To: Juri Lelli <juri.lelli@redhat.com>
Cc: Jon Hunter <jonathanh@nvidia.com>,
	Christian Loehle <christian.loehle@arm.com>,
	Thierry Reding <treding@nvidia.com>,
	Waiman Long <longman@redhat.com>, Tejun Heo <tj@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Koutny <mkoutny@suse.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Phil Auld <pauld@redhat.com>, Qais Yousef <qyousef@layalina.io>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Suleiman Souhlal <suleiman@google.com>,
	Aashish Sharma <shraash@google.com>,
	Shin Kawamura <kawasin@google.com>,
	Vineeth Remanan Pillai <vineeth@bitbyteword.org>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH v2 3/2] sched/deadline: Check bandwidth overflow earlier for hotplug
Date: Wed, 19 Feb 2025 10:29:03 +0100	[thread overview]
Message-ID: <a0f03e3e-bced-4be7-8589-1e65042b39aa@arm.com> (raw)
In-Reply-To: <Z7SWvr86RXlBbJlw@jlelli-thinkpadt14gen4.remote.csb>

On 18/02/2025 15:18, Juri Lelli wrote:
> On 18/02/25 15:12, Dietmar Eggemann wrote:
>> On 18/02/2025 10:58, Juri Lelli wrote:
>>> Hi!
>>>
>>> On 17/02/25 17:08, Juri Lelli wrote:
>>>> On 14/02/25 10:05, Jon Hunter wrote:

[...]

>> Yeah, looks like suspend/resume behaves differently compared to CPU hotplug.
>>
>> On my Juno [L b b L L L]
>>                 ^^^
>>                 isolcpus=[2,3]
>>
>> # ps2 | grep DLN
>>    98    98 S 140      0   - DLN sugov:0
>>    99    99 S 140      0   - DLN sugov:1
>>
>> # taskset -p 98; taskset -p 99
>> pid 98's current affinity mask: 39
>> pid 99's current affinity mask: 6
>>
>>
>> [   87.679282] partition_sched_domains() called
>> ...
>> [   87.684013] partition_sched_domains() called
>> ...
>> [   87.687961] partition_sched_domains() called
>> ...
>> [   87.689419] psci: CPU3 killed (polled 0 ms)
>> [   87.689715] __dl_bw_capacity() mask=2-5 cap=1024
>> [   87.689739] dl_bw_cpus() cpu=6 rd->span=2-5 cpu_active_mask=0-2 cpus=1
>> [   87.689757] dl_bw_manage: cpu=2 cap=0 fair_server_bw=52428
>> total_bw=209712 dl_bw_cpus=1 type=DEF span=2-5
>> [   87.689775] dl_bw_cpus() cpu=6 rd->span=2-5 cpu_active_mask=0-2 cpus=1
>> [   87.689789] dl_bw_manage() cpu=2 cap=0 overflow=1 return=-16
>> [   87.689864] Error taking CPU2 down: -16                       <-- !!!
>> ...
>> [   87.690674] partition_sched_domains() called
>> ...
>> [   87.691496] partition_sched_domains() called
>> ...
>> [   87.693702] partition_sched_domains() called
>> ...
>> [   87.695819] partition_and_rebuild_sched_domains() called
>>
> 
> Ah, OK. Did you try with my last proposed change?

I did now. 

Patch-wise I have:

(1) Putting 'fair_server's __dl_server_[de|at]tach_root() under if  
    '(cpumask_test_cpu(rq->cpu, [old_rd->online|cpu_active_mask))' in 
    rq_attach_root()

    https://lkml.kernel.org/r/Z7RhNmLpOb7SLImW@jlelli-thinkpadt14gen4.remote.csb

(2) Create __dl_server_detach_root() and call it in rq_attach_root()

    https://lkml.kernel.org/r/Z4fd_6M2vhSMSR0i@jlelli-thinkpadt14gen4.remote.csb

plus debug patch:

    https://lkml.kernel.org/r/Z6M5fQB9P1_bDF7A@jlelli-thinkpadt14gen4.remote.csb

plus additional debug.

The suspend issue still persists.

My hunch is that it's rather an issue with having 0 CPUs left in DEF
while deactivating the last isol CPU (CPU3) so we set overflow = 1 w/o
calling __dl_overflow(). We want to account fair_server_bw=52428
against 0 CPUs. 

l B B l l l

      ^^^
      isolcpus=[3,4]


cpumask_and(mask, rd->span, cpu_active_mask)

mask = [3-5] & [0-3] = [3] -> dl_bw_cpus(3) = 1

---

dl_bw_deactivate() called cpu=5

dl_bw_deactivate() called cpu=4

dl_bw_deactivate() called cpu=3

dl_bw_cpus() cpu=6 rd->span=3-5 cpu_active_mask=0-3 cpus=1 type=DEF
                   ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
  cpumask_subset(rd->span, cpu_active_mask) is false

  for_each_cpu_and(i, rd->span, cpu_active_mask)
    cpus++                                       <-- cpus is 1 !!!

dl_bw_manage: cpu=3 cap=0 fair_server_bw=52428 total_bw=104856 dl_bw_cpus=1 type=DEF span=3-5

  called w/ 'req = dl_bw_req_deactivate'

  dl_b->total_bw - fair_server_bw = 104856 - 52428 > 0

    dl_bw_cpus(cpu) - 1 = 0
   
      overflow = 1

So there is simply no capacity left in DEF for DL but
'dl_b->total_bw - old_bw + new_bw' = 52428 > 0

  reply	other threads:[~2025-02-19  9:29 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241114142810.794657-1-juri.lelli@redhat.com>
     [not found] ` <ZzYhyOQh3OAsrPo9@jlelli-thinkpadt14gen4.remote.csb>
     [not found]   ` <Zzc1DfPhbvqDDIJR@jlelli-thinkpadt14gen4.remote.csb>
2025-01-10 11:52     ` [PATCH v2 3/2] sched/deadline: Check bandwidth overflow earlier for hotplug Jon Hunter
2025-01-10 15:45       ` Juri Lelli
2025-01-10 18:40         ` Jon Hunter
2025-01-13  9:32           ` Juri Lelli
2025-01-13 13:53             ` Jon Hunter
2025-01-14 13:52             ` Jon Hunter
2025-01-14 14:02               ` Juri Lelli
2025-01-15 16:10                 ` Juri Lelli
2025-01-16 13:14                   ` Jon Hunter
2025-01-16 15:55                     ` Juri Lelli
2025-02-03 11:01                       ` Jon Hunter
2025-02-04 17:26                         ` Juri Lelli
2025-02-05  6:53                         ` Juri Lelli
2025-02-05 10:12                           ` Juri Lelli
2025-02-05 16:56                             ` Jon Hunter
2025-02-06  9:29                               ` Juri Lelli
2025-02-07 10:38                                 ` Jon Hunter
2025-02-07 13:38                                   ` Dietmar Eggemann
2025-02-07 14:04                                     ` Jon Hunter
2025-02-07 15:55                                       ` Christian Loehle
2025-02-10 17:09                                         ` Juri Lelli
2025-02-11  8:36                                           ` Dietmar Eggemann
2025-02-11  9:21                                             ` Juri Lelli
2025-02-11 10:43                                               ` Dietmar Eggemann
2025-02-11 10:15                                           ` Christian Loehle
2025-02-11 10:42                                             ` Juri Lelli
2025-02-12 18:22                                               ` Dietmar Eggemann
2025-02-13  6:20                                                 ` Juri Lelli
2025-02-13 12:27                                                   ` Christian Loehle
2025-02-13 13:33                                                     ` Juri Lelli
2025-02-13 13:38                                                       ` Christian Loehle
2025-02-13 14:51                                                         ` Juri Lelli
2025-02-13 14:57                                                           ` Christian Loehle
2025-02-16 16:33                                                   ` Qais Yousef
2025-02-17 14:52                                                     ` Juri Lelli
2025-02-22 23:59                                                       ` Qais Yousef
2025-02-24  9:27                                                         ` Juri Lelli
2025-02-25  0:02                                                           ` Qais Yousef
2025-02-25  9:46                                                             ` Juri Lelli
2025-02-25 10:09                                                               ` Christian Loehle
2025-02-12 23:01                                               ` Jon Hunter
2025-02-13  6:16                                                 ` Juri Lelli
2025-02-13  9:53                                                   ` Jon Hunter
2025-02-14 10:05                                                     ` Jon Hunter
2025-02-17 16:08                                                       ` Juri Lelli
2025-02-17 16:10                                                         ` Jon Hunter
2025-02-17 16:25                                                           ` Juri Lelli
2025-02-18  9:58                                                         ` Juri Lelli
2025-02-18 10:30                                                           ` Juri Lelli
2025-02-18 14:12                                                           ` Dietmar Eggemann
2025-02-18 14:18                                                             ` Juri Lelli
2025-02-19  9:29                                                               ` Dietmar Eggemann [this message]
2025-02-19 10:02                                                                 ` Juri Lelli
2025-02-19 11:23                                                                   ` Jon Hunter
2025-02-19 13:09                                                                   ` Dietmar Eggemann
2025-02-19 18:14                                                                     ` Dietmar Eggemann
2025-02-20 10:40                                                                       ` Juri Lelli
2025-02-20 15:25                                                                         ` Juri Lelli
2025-02-21 11:56                                                                           ` Jon Hunter
2025-02-21 14:45                                                                             ` Dietmar Eggemann
2025-02-24 13:53                                                                               ` Dietmar Eggemann
2025-02-24 14:03                                                                                 ` Juri Lelli
2025-02-24 23:39                                                                                   ` Jon Hunter
2025-02-25  9:48                                                                                     ` Juri Lelli
2025-03-03 14:17                                                                                       ` Jon Hunter
2025-03-03 16:00                                                                                         ` Juri Lelli
2025-02-07 14:04                                     ` Jon Hunter
2025-02-07 15:52                                   ` Juri Lelli

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=a0f03e3e-bced-4be7-8589-1e65042b39aa@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=christian.loehle@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=joel@joelfernandes.org \
    --cc=jonathanh@nvidia.com \
    --cc=juri.lelli@redhat.com \
    --cc=kawasin@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=pauld@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=shraash@google.com \
    --cc=suleiman@google.com \
    --cc=tj@kernel.org \
    --cc=treding@nvidia.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vineeth@bitbyteword.org \
    --cc=vschneid@redhat.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