Re: [patch 09/10] sched/core: Add migrate_disable/enable()

From: peterz
Date: Fri Sep 18 2020 - 04:23:00 EST


On Thu, Sep 17, 2020 at 06:30:01PM +0200, Sebastian Siewior wrote:
> On 2020-09-17 17:54:10 [+0200], peterz@xxxxxxxxxxxxx wrote:
> > I'm not sure what the problem with FPU was, I was throwing alternatives
> > at tglx to see what would stick, in part to (re)discover the design
> > constraints of this thing.
>
> was this recent or distant in the time line?

The past few weeks :-) Thomas and me have been bickering about this
stuff on IRC on and off.

> > One reason for not allowing migrate_disable() to sleep was: FPU code.
> >
> > Could it be it does something like:
> >
> > preempt_disable();
> > spin_lock();
> >
> > spin_unlock();
> > preempt_enable();
> >
> > Where we'll never get preempted while migrate_disable()'d and thus never
> > trigger any of the sleep paths?
>
> I try to get rid of something like that. This doesn't work either way
> because the spin_lock() may block which it can't with disabled
> preemption.

Yeah, that obviously should have been migrate_disable/enable instead of
spin_lock/unlock :/

> Ah. We used to have migrate_disable() in pagefault_disable(). The x86
> FPU code does
> preempt_disable();
>
> pagefault_disable();
>
> but that migrate_disable() was moved from pagefault_disable() to
> kmap_atomic(). We shouldn't have
> preempt_disable(); || local_irq_disable();
> kmap_atomic();
>
> on RT. I've been running around removing those. See
> a10dcebacdb0c ("fs/ntfs/aops.c: don't disable interrupts during kmap_atomic()")
> ce1e518190ea7 ("ide: don't disable interrupts during kmap_atomic()")
> f3a1075e5fc34 ("block: don't disable interrupts during kmap_atomic()")

Hmm, okay.