Re: [PATCH 5/8] rcu: eliminate deadlock for rcu read site

From: Paul E. McKenney
Date: Wed Aug 21 2013 - 09:42:16 EST


On Wed, Aug 21, 2013 at 11:25:55AM +0800, Lai Jiangshan wrote:
> On 08/21/2013 11:17 AM, Paul E. McKenney wrote:
> > On Sat, Aug 10, 2013 at 08:07:15AM -0700, Paul E. McKenney wrote:
> >> On Sat, Aug 10, 2013 at 11:43:59AM +0800, Lai Jiangshan wrote:
> >
> > [ . . . ]
> >
> >>> So I have to narrow the range of suspect locks. Two choices:
> >>> A) don't call rt_mutex_unlock() from rcu_read_unlock(), only call it
> >>> from rcu_preempt_not_context_switch(). we need to rework these
> >>> two functions and it will add complexity to RCU, and it also still
> >>> adds some probability of deferring.
> >>
> >> One advantage of bh-disable locks is that enabling bh checks
> >> TIF_NEED_RESCHED, so that there is no deferring beyond that
> >> needed by bh disable. The same of course applies to preempt_disable().
> >>
> >> So one approach is to defer when rcu_read_unlock_special() is entered
> >> with either preemption or bh disabled. Your current set_need_resched()
> >> trick would work fine in this case. Unfortunately, re-enabling interrupts
> >> does -not- check TIF_NEED_RESCHED, which is why we have latency problems
> >> in that case. (Hence my earlier question about making self-IPI safe
> >> on all arches, which would result in an interrupt as soon as interrupts
> >> were re-enabled.)
> >>
> >> Another possibility is to defer only when preemption or bh are disabled
> >> on entry ro rcu_read_unlock_special(), but to retain the current
> >> (admittedly ugly) nesting rules for the scheduler locks.
> >
> > Would you be willing to do a patch that deferred rt_mutex_unlock() in
> > the preempt/bh cases? This of course does not solve the irq-disable
> > case, but it should at least narrow the problem to the scheduler locks.
> >
> > Not a big hurry, given the testing required, this is 3.13 or 3.14 material,
> > I think.
> >
> > If you are busy, no problem, I can do it, just figured you have priority
> > if you want it.
>
> I'm writing a special rt_mutex_unlock() for rcu deboost only.
> I hope Steven accept it.

That would be very cool, though if I understand the requirements,
especially for -rt, very challenging. Looking forward to seeing it!

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/