lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4300a3e5-061d-4daf-b277-631bfc16ff85@arm.com>
Date: Fri, 15 Mar 2024 19:47:29 +0000
From: Hongyan Xia <hongyan.xia2@....com>
To: Dietmar Eggemann <dietmar.eggemann@....com>,
 Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
 Vincent Guittot <vincent.guittot@...aro.org>,
 Juri Lelli <juri.lelli@...hat.com>, Steven Rostedt <rostedt@...dmis.org>,
 Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
 Daniel Bristot de Oliveira <bristot@...hat.com>,
 Valentin Schneider <vschneid@...hat.com>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Viresh Kumar <viresh.kumar@...aro.org>
Cc: Qais Yousef <qyousef@...alina.io>,
 Morten Rasmussen <morten.rasmussen@....com>,
 Lukasz Luba <lukasz.luba@....com>,
 Christian Loehle <christian.loehle@....com>, linux-kernel@...r.kernel.org,
 David Dai <davidai@...gle.com>, Saravana Kannan <saravanak@...gle.com>,
 linux-pm@...r.kernel.org
Subject: Re: [RFC PATCH v2 4/7] sched/fair: Use CFS util_avg_uclamp for
 utilization and frequency

On 15/03/2024 12:31, Dietmar Eggemann wrote:
> On 01/02/2024 14:12, Hongyan Xia wrote:
> 
> [...]
> 
>> @@ -7685,11 +7697,13 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
>>   static unsigned long
>>   cpu_util(int cpu, struct task_struct *p, int dst_cpu, int boost)
>>   {
>> -	struct cfs_rq *cfs_rq = &cpu_rq(cpu)->cfs;
>> -	unsigned long util = READ_ONCE(cfs_rq->avg.util_avg);
>> +	struct rq *rq = cpu_rq(cpu);
>> +	struct cfs_rq *cfs_rq = &rq->cfs;
>> +	unsigned long util = root_cfs_util(rq);
>> +	bool capped = uclamp_rq_is_capped(rq);
> 
> I try to rerun your tests in your 2 ipynbs (cover letter) but this let's
> the sum aggr stack go sideways ...
> 
> if 'sched_uclamp_used' then uclamp_rq_is_capped() will call
> cpu_util_cfs()->cpu_util() which then calls uclamp_rq_is_capped()
> recursively resulting in a stack overflow.
> 
> Do you have a fix for that you can share? For the time I remove the call
> to uclamp_rq_is_capped() in cpu_util().

My apologies. This has long ago been fixed and here is the diff:

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 1ebdd0b9ebca..d5dcda036e0d 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -3018,9 +3018,8 @@ static inline bool uclamp_rq_is_capped(struct rq *rq)
         if (!static_branch_likely(&sched_uclamp_used))
                 return false;

-       rq_uclamp_util = cpu_util_cfs(cpu_of(rq)) + cpu_util_rt(rq);
-       rq_real_util = READ_ONCE(rq->cfs.avg.util_avg) +
-                      READ_ONCE(rq->avg_rt.util_avg);
+       rq_uclamp_util = READ_ONCE(rq->root_cfs_util_uclamp);
+       rq_real_util = READ_ONCE(rq->cfs.avg.util_avg);

         return rq_uclamp_util < SCHED_CAPACITY_SCALE &&
                rq_real_util > rq_uclamp_util;

> [...]
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ