Re: [RFC] Deadlock via recursive wakeup via RCU with threadirqs

From: Paul E. McKenney
Date: Fri Jun 28 2019 - 14:53:25 EST


On Fri, Jun 28, 2019 at 08:40:26PM +0200, Sebastian Andrzej Siewior wrote:
> On 2019-06-28 08:30:50 [-0700], Paul E. McKenney wrote:
> > On Fri, Jun 28, 2019 at 03:54:33PM +0200, Peter Zijlstra wrote:
> > > On Thu, Jun 27, 2019 at 11:41:07AM -0700, Paul E. McKenney wrote:
> > > > Or just don't do the wakeup at all, if it comes to that. I don't know
> > > > of any way to determine whether rcu_read_unlock() is being called from
> > > > the scheduler, but it has been some time since I asked Peter Zijlstra
> > > > about that.
> > >
> > > There (still) is no 'in-scheduler' state.
> >
> > Well, my TREE03 + threadirqs rcutorture test ran for ten hours last
> > night with no problems, so we just might be OK.
> >
> > The apparent fix is below, though my approach would be to do backports
> > for the full set of related changes.
> >
> > Joel, Sebastian, how goes any testing from your end? Any reason
> > to believe that this does not represent a fix? (Me, I am still
> > concerned about doing raise_softirq() from within a threaded
> > interrupt, but am not seeing failures.)
>
> For some reason it does not trigger as good as it did yesterday.

I swear that I wasn't watching!!! ;-)

But I do know that feeling.

> Commit
> - 23634ebc1d946 ("rcu: Check for wakeup-safe conditions in
> rcu_read_unlock_special()") does not trigger the bug within 94
> attempts.
>
> - 48d07c04b4cc1 ("rcu: Enable elimination of Tree-RCU softirq
> processing") needed 12 attempts to trigger the bug.

That matches my belief that 23634ebc1d946 ("rcu: Check for wakeup-safe
conditions in rcu_read_unlock_special()") will at least greatly decrease
the probability of this bug occurring.

Thanx, Paul