Re: [PATCH RT] sched/migrate_disable: fallback to preempt_disable() instead barrier()
From: Sebastian Andrzej Siewior
Date: Thu Jul 05 2018 - 12:38:53 EST
On 2018-07-05 12:23:00 [-0400], Steven Rostedt wrote:
> [ Added Peter ]
>
> On Thu, 5 Jul 2018 17:50:34 +0200
> Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
>
> > migrate_disable() does nothing !SMP && !RT. This is bad for two reasons:
> > - The futex code relies on the fact migrate_disable() is part of spin_lock().
> > There is a workaround for the !in_atomic() case in migrate_disable() which
> > work-arounds the different ordering (non-atomic lock and atomic unlock).
>
> But isn't it only part of spin_lock() in the RT case?
that is correct. so in the !RT case if it remains a barrier then nothing
bad happens. So this should not affect futex case at all. Let me retry
this (Joe also says that this patch does not fix it).
> >
> > - we have a few instances where preempt_disable() is replaced with
> > migrate_disable().
>
> What? Really? I thought we only replace preempt_disable() with a
> local_lock(). Which gives annotation to why a preempt_disable() exists.
> And on non-RT, local_lock() is preempt_disable().
KVM-arm-arm64-downgrade-preempt_disable-d-region-to-.patch
printk-rt-aware.patch
upstream-net-rt-remove-preemption-disabling-in-netif_rx.patch
> > For both cases it is bad if migrate_disable() ends up as barrier() instead of
> > preempt_disable(). Let migrate_disable() fallback to preempt_disable().
> >
>
> I still don't understand exactly what is "bad" about it.
>
> IIRC, I remember Peter not wanting any open coded "migrate_disable"
> calls. It was to be for internal use cases only, and specifically, only
> for RT.
the futex code locks in !ATOMIC context and unlocks the same lock in
ATOMIC context which is not balanced on RT. This is the only case where
we do migrate_disable magic.
> Personally, I think making migrate_disable() into preempt_disable() on
> NON_RT is incorrect too.
For the three patches I mentioned above, the migrate_disable() was
preempt_disable() for !RT before the RT patch was applied. So nothing
changes here. It should only matter for the case where migrate_disable()
was used explicit.
> -- Steve
Sebastian