On Thu, May 14, 2020 at 03:47:35PM -0700, Paul E. McKenney wrote: > On Fri, May 15, 2020 at 12:30:23AM +0200, Frederic Weisbecker wrote: > > On Thu, May 14, 2020 at 08:47:07AM -0700, Paul E. McKenney wrote: > > > On Thu, May 14, 2020 at 12:45:26AM +0200, Frederic Weisbecker wrote: > > > This last seems best to me. The transition from CBLIST_NOT_OFFLOADED > > > to CBLIST_OFFLOADING of course needs to be on the CPU in question with > > > at least bh disabled. Probably best to be holding rcu_nocb_lock(), > > > but that might just be me being overly paranoid. > > > > So that's in the case of offloading, right? Well, I don't think we'd > > need to even disable bh nor lock nocb. We just need the current CPU > > to see the local update of cblist->offloaded = CBLIST_OFFLOADING > > before the kthread is unparked: > > > > cblist->offloaded = CBLIST_OFFLOADING; > > /* Make sure subsequent softirq lock nocb */ > > barrier(); > > kthread_unpark(rdp->nocb_cb_thread); > > > > Now, although that guarantees that nocb_cb will see CBLIST_OFFLOADING > > upon unparking, it's not guaranteed that the nocb_gp will see it on its > > next round. Ok so eventually you're right, I should indeed lock nocb... > > I suspect that our future selves would hate us much less if we held > that lock. ;-)
Also, taking the decision to hold that lock could teach a lesson to our past selves. Win-win! Let us become that most welcome time bridge!