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: <19a072e1-cfd8-43e1-9e8e-aa1950b20533@linux.ibm.com>
Date: Tue, 22 Oct 2024 11:11:18 +0530
From: Shrikanth Hegde <sshegde@...ux.ibm.com>
To: Ankur Arora <ankur.a.arora@...cle.com>
Cc: linux-kernel@...r.kernel.org, peterz@...radead.org, tglx@...utronix.de,
        paulmck@...nel.org, mingo@...nel.org, bigeasy@...utronix.de,
        juri.lelli@...hat.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
        mgorman@...e.de, vschneid@...hat.com, frederic@...nel.org,
        efault@....de
Subject: Re: [PATCH 1/7] sched: warn for high latency with
 TIF_NEED_RESCHED_LAZY



On 10/22/24 00:51, Ankur Arora wrote:
> 
> Shrikanth Hegde <sshegde@...ux.ibm.com> writes:
> 
>> On 10/9/24 22:24, Ankur Arora wrote:
>>> resched_latency_warn() now also warns if TIF_NEED_RESCHED_LAZY is set
>>> without rescheduling for more than the latency_warn_ms period.
>>>
>>
>> I am bit confused here. Why do we need to warn if LAZY is set for a long time?
>>
>> If lazy set, the subsequent tick, it would be set to upgraded to NEED_RESCHED.
>>
>> Since the value of latency_warn_ms=100ms, that means even on system with HZ=100,
>> that means 10 ticks before that warning would be printed no?
> 
> That's a fair point. However, the assumption there is that there are no
> bugs in upgrade on tick or that there's no situation in which the tick
> is off for a prolonged period.
> 

ok.

But if tick is off, then ticks_without_resched isn't incremented either. 
IIUC, this check is for situation when NR is set and tick is on.

> Ankur
> 
>> IIUC, the changelog c006fac556e40 ("sched: Warn on long periods of pending
>> need_resched") has the concern of need_resched set but if it is non-preemptible
>> kernel it would spend a lot of time in kernel mode. In that case print a
>> warning.
>>
>> If someone enables Lazy, that means it is preemptible and probably this whole
>> notion of resched_latency_warn doesn't apply to lazy. Please correct me if i am
>> not understanding this correctly.
>>
>>> Cc: Ingo Molnar <mingo@...hat.com>
>>> Cc: Peter Ziljstra <peterz@...radead.org>
>>> Cc: Juri Lelli <juri.lelli@...hat.com>
>>> Cc: Vincent Guittot <vincent.guittot@...aro.org>
>>> Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
>>> ---
>>>    kernel/sched/core.c  | 2 +-
>>>    kernel/sched/debug.c | 7 +++++--
>>>    2 files changed, 6 insertions(+), 3 deletions(-)
>>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>>> index 694bfcf153cb..1229766b704e 100644
>>> --- a/kernel/sched/core.c
>>> +++ b/kernel/sched/core.c
>>> @@ -5571,7 +5571,7 @@ static u64 cpu_resched_latency(struct rq *rq)
>>>    	if (sysctl_resched_latency_warn_once && warned_once)
>>>    		return 0;
>>>    -	if (!need_resched() || !latency_warn_ms)
>>> +	if ((!need_resched() && !tif_need_resched_lazy()) || !latency_warn_ms)
>>>    		return 0;
>>>      	if (system_state == SYSTEM_BOOTING)
>>> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
>>> index 9abcc6ead11b..f0d551ba64bb 100644
>>> --- a/kernel/sched/debug.c
>>> +++ b/kernel/sched/debug.c
>>> @@ -1293,9 +1293,12 @@ void proc_sched_set_task(struct task_struct *p)
>>>    void resched_latency_warn(int cpu, u64 latency)
>>>    {
>>>    	static DEFINE_RATELIMIT_STATE(latency_check_ratelimit, 60 * 60 * HZ, 1);
>>> +	char *nr;
>>> +
>>> +	nr = tif_need_resched() ? "need_resched" : "need_resched_lazy";
>>>      	WARN(__ratelimit(&latency_check_ratelimit),
>>> -	     "sched: CPU %d need_resched set for > %llu ns (%d ticks) "
>>> +	     "sched: CPU %d %s set for > %llu ns (%d ticks) "
>>>    	     "without schedule\n",
>>> -	     cpu, latency, cpu_rq(cpu)->ticks_without_resched);
>>> +	     cpu, nr, latency, cpu_rq(cpu)->ticks_without_resched);
>>>    }
> 
> 
> --
> ankur


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ