Messages in this thread | | | Date | Fri, 18 Sep 2020 10:48:35 +0200 | From | Sebastian Siewior <> | Subject | Re: [patch 09/10] sched/core: Add migrate_disable/enable() |
| |
On 2020-09-18 10:22:32 [+0200], peterz@infradead.org wrote: > > > 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. Me stupid. fpregs_lock() does
preempt_disable(); local_bh_disable();
which is more or less the "official" pattern. As of today local_bh_disable() does migrate_disable() / spin_lock(). Not sure what we end up with for local_bh_disable() in the end. We used not have a BLK here on RT but ended up in all kind of locking problems because vanilla treats local_bh_disable() as a BLK and uses it for locking. Today we have a per-CPU spinlock_t in local_bh_disable() to emulate the BKL. But this pattern above isn't working due to the atomic part…
Sebastian
| |