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

Paul E. McKenney
2019-07-01T16:01:13Z

On Mon, Jul 01, 2019 at 04:00:53PM +0200, Peter Zijlstra wrote:
> On Mon, Jul 01, 2019 at 05:23:05AM -0700, Paul E. McKenney wrote:
> > On Mon, Jul 01, 2019 at 12:24:42PM +0200, Sebastian Andrzej Siewior wrote:
> > > On 2019-07-01 11:42:15 [+0200], Peter Zijlstra wrote:
> > > > I'm not sure if smp_send_reschedule() can be used as self-IPI, some
> > > > hardware doesn't particularly like that IIRC. That is, hardware might
> > > > only have interfaces to IPI _other_ CPUs, but not self.
> > > >
> > > > The normal scheduler code takes care to not call smp_send_reschedule()
> > > > to self.
> > >
> > > and irq_work:
> > > 471ba0e686cb1 ("irq_work: Do not raise an IPI when queueing work on the local CPU")
> >
> > OK, so it looks like I will need to use something else. But thank you
> > for calling my attention to this commit.
>
> I think that commit is worded slight confusing -- sorry I should've paid
> more attention.
>
> irq_work _does_ work locally, and arch_irq_work_raise() must self-IPI,
> otherwise everything is horribly broken.
>
> But what happened, was that irq_work_queue() and irq_work_queue_on(.cpu
> = smp_processor_id()) wasn't using the same code, and the latter would
> try to self-IPI through arch_send_call_function_single_ipi().
>
> Nick fixed that so that irq_work_queue() and irq_work_queue_on(.cpu =
> smp_processor_id() now both use arch_raise_irq_work() and remote stuff
> uses arch_send_call_function_single_ipi().

OK, thank you for looking into this!

I therefore continue relying on IRQ work. Should there be problems with
kernels not supporting IRQ work, and if there is a legitimate reason
why they should not support IRQ work, I can look into things like timers
for those kernels.

Thanx, Paul