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

From: Paul E. McKenney
Date: Fri Jun 28 2019 - 13:21:07 EST


On Fri, Jun 28, 2019 at 06:04:08PM +0200, Peter Zijlstra wrote:
> On Fri, Jun 28, 2019 at 08:54:04AM -0700, Paul E. McKenney wrote:
> > Thank you! Plus it looks like scheduler_ipi() takes an early exit if
> > ->wake_list is empty, regardless of TIF_NEED_RESCHED, right?
>
> Yes, TIF_NEED_RESCHED is checked in the interrupt return path.

OK, got it. So the following sequence would be a valid way to get the
scheduler's attention on the current CPU shortly after interrupts
are re-enabled, even if the current CPU is already holding some
rq or pi locks, correct?

set_tsk_need_resched(current);
set_preempt_need_resched();
smp_send_reschedule(smp_processor_id());

Thanx, Paul