Re: [PATCH] sched/fair: Use printk_deferred instead of printk in pick_eevdf()

From: Phil Auld
Date: Tue Oct 10 2023 - 08:27:07 EST


On Tue, Oct 10, 2023 at 09:59:28AM +0200 Peter Zijlstra wrote:
> On Tue, Oct 10, 2023 at 11:25:41AM +0800, Chen Yu wrote:
> > When no eligible entity is found in pick_eevdf(), it has to pick
> > the entity with smallest vruntime. This indicates a potential issue
> > and scheduler will print this error.
> >
> > However this printk could introduce possible circular locking issue
> > because when the code path reaches here with the rq lock held, the
> > printk could trigger further scheduling which loops back to the
> > scheduler.
> >
> > Use printk_deferred() to defer the console write from current context
> > to the irq work in the next tick.

Chen: I was not actually suggesting you make this change, just answering your
question about printk/rq lock. You don't need to put that line in there.

>
> No.. I detest printk_deferred with a passion. This is effectively a WARN
> and we don't do silly buggers for them either.
>

Sure, printk_deferred is not ideal, but is getting this message in the right
order worth locking up people's machines? Not sure you get the message at
all when that happens. I have to dig the code location out of the crash
dump to find which sched warning fired and took down the (usually virtual)
machine.


Cheers,
Phil

--