Re: [PATCH tip v4 4/5] rcu: Do not call rcu_nocb_gp_cleanup() while holding rnp->lock

From: Boqun Feng
Date: Tue Nov 24 2015 - 20:02:23 EST


On Tue, Nov 24, 2015 at 11:52:12PM +0800, Boqun Feng wrote:
> Hi Daniel,
>
> On Tue, Nov 24, 2015 at 02:03:06PM +0100, Daniel Wagner wrote:
> > rcu_nocb_gp_cleanup() is called while holding rnp->lock. Currently,
> > this is okay because the wake_up_all() in rcu_nocb_gp_cleanup() will
> > not enable the IRQs. lockdep is happy.
> >
> > By switching over using swait this is not true anymore. swake_up_all()
> > enables the IRQs while processing the waiters. __do_softirq() can now
> > run and will eventually call rcu_process_callbacks() which wants to
> > grap nrp->lock.
> >
> > Let's move the rcu_nocb_gp_cleanup() call outside the lock before we
> > switch over to swait.
> >
>
> But you did introduce swait in this patch ;-)
>
> [snip]
>
> >
> > Signed-off-by: Daniel Wagner <daniel.wagner@xxxxxxxxxxxx>
> > Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
> > Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: linux-kernel@xxxxxxxxxxxxxxx
> > ---
> > kernel/rcu/tree.c | 4 +++-
> > kernel/rcu/tree.h | 3 ++-
> > kernel/rcu/tree_plugin.h | 16 +++++++++++++---
> > 3 files changed, 18 insertions(+), 5 deletions(-)
> >
>
> So I tried to build this patch with a config having RCU_EXPERT=y and
> RCU_NOCB_CPU=y, but I got:
>
> In file included from include/linux/completion.h:11:0,
> from include/linux/rcupdate.h:43,
> from include/linux/sysctl.h:25,
> from include/linux/timer.h:242,
> from include/linux/workqueue.h:8,
> from include/linux/pm.h:25,
> from ./arch/x86/include/asm/apic.h:5,
> from ./arch/x86/include/asm/smp.h:12,
> from include/linux/smp.h:59,
> from kernel/rcu/tree.c:34:
> kernel/rcu/tree_plugin.h: In function ârcu_nocb_gp_cleanupâ:
> kernel/rcu/tree_plugin.h:1782:14: warning: passing argument 1 of â__wake_upâ from incompatible pointer type [-Wincompatible-pointer-types]
> wake_up_all(sq);
> ^
> include/linux/wait.h:168:36: note: in definition of macro âwake_up_allâ
> #define wake_up_all(x) __wake_up(x, TASK_NORMAL, 0, NULL)
>
>

Just to be clear, I saw this build error when I applied only the first
four patches of this series. When I applied the whole series, I didn't
see any build error.

Regards,
Boqun

Attachment: signature.asc
Description: PGP signature