Re: [PATCH] rcu/nocb: Fix misordered rcu_barrier() while (de-)offloading

From: Frederic Weisbecker
Date: Mon Oct 18 2021 - 17:50:53 EST


On Mon, Oct 18, 2021 at 11:36:04AM -0700, Paul E. McKenney wrote:
> On Mon, Oct 18, 2021 at 07:42:42PM +0200, Frederic Weisbecker wrote:
> > I think you're right. The real issue is something I wanted to
> > fix next: RCU_SEGCBLIST_RCU_CORE isn't cleared when nocb is enabled on
> > boot so rcu_core() always run concurrently with nocb kthreads in TREE04,
> > without holding rcu_barrier mutex of course (I mean with the latest patchset).
>
> That would do it!
>
> > Ok forget this patch, I'm testing again with simply clearing
> > RCU_SEGCBLIST_RCU_CORE on boot.
>
> Sounds good, looking forward to it!

So yes that was indeed the real issue. I've pushed an "rcu/rt-v3" branch
which is the same as your dev.2021.10.07a branch but the first patch
"rcu/nocb: Prepare state machine for a new step" has this added:

diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index 3b470113ae38..2461fe8d0c23 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -1171,8 +1171,8 @@ void __init rcu_init_nohz(void)
if (rcu_segcblist_empty(&rdp->cblist))
rcu_segcblist_init(&rdp->cblist);
rcu_segcblist_offload(&rdp->cblist, true);
- rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB);
- rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_GP);
+ rcu_segcblist_set_flags(&rdp->cblist, SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP);
+ rcu_segcblist_clear_flags(&rdp->cblist, SEGCBLIST_RCU_CORE);
}
rcu_organize_nocb_kthreads();
}


I still see the oom though, hopefully my series just makes an existing
problem more likely to happen.

Thanks.