Re: [PATCH -rcu dev 1/2] Revert b8c17e6664c4 ("rcu: Maintain special bits at bottom of ->dynticks counter")
From: Paul E. McKenney
Date: Fri Sep 06 2019 - 13:17:39 EST
On Fri, Sep 06, 2019 at 12:57:51PM -0400, Joel Fernandes wrote:
> On Fri, Sep 06, 2019 at 08:27:53AM -0700, Paul E. McKenney wrote:
> > On Fri, Sep 06, 2019 at 08:21:44AM -0700, Paul E. McKenney wrote:
> > > On Fri, Sep 06, 2019 at 11:08:06AM -0400, Joel Fernandes wrote:
> > > > On Thu, Sep 05, 2019 at 08:01:37PM -0400, Joel Fernandes wrote:
> > > > [snip]
> > > > > > > > @@ -3004,7 +3007,7 @@ static int rcu_pending(void)
> > > > > > > > return 0;
> > > > > > > >
> > > > > > > > /* Is the RCU core waiting for a quiescent state from this CPU? */
> > > > > > > > - if (rdp->core_needs_qs && !rdp->cpu_no_qs.b.norm)
> > > > > > > > + if (READ_ONCE(rdp->core_needs_qs) && !rdp->cpu_no_qs.b.norm)
> > > > > > > > return 1;
> > > > > > > >
> > > > > > > > /* Does this CPU have callbacks ready to invoke? */
> > > > > > > > @@ -3244,7 +3247,6 @@ int rcutree_prepare_cpu(unsigned int cpu)
> > > > > > > > rdp->gp_seq = rnp->gp_seq;
> > > > > > > > rdp->gp_seq_needed = rnp->gp_seq;
> > > > > > > > rdp->cpu_no_qs.b.norm = true;
> > > > > > > > - rdp->core_needs_qs = false;
> > > > > > >
> > > > > > > How about calling the new hint-clearing function here as well? Just for
> > > > > > > robustness and consistency purposes?
> > > > > >
> > > > > > This and the next function are both called during a CPU-hotplug online
> > > > > > operation, so there is little robustness or consistency to be had by
> > > > > > doing it twice.
> > > > >
> > > > > Ok, sorry I missed you are clearing it below in the next function. That's
> > > > > fine with me.
> > > > >
> > > > > This patch looks good to me and I am Ok with merging of these changes into
> > > > > the original patch with my authorship as you mentioned. Or if you wanted to
> > > > > be author, that's fine too :)
> > > >
> > > > Paul, does it make sense to clear these urgency hints in rcu_qs() as well?
> > > > After all, we are clearing atleast one urgency hint there: the
> > > > rcu_read_unlock_special::need_qs bit.
>
> Makes sense.
>
> > > We certainly don't want to turn off the scheduling-clock interrupt until
> > > after the quiescent state has been reported to the RCU core. And it might
> > > still be useful to have a heavy quiescent state because the grace-period
> > > kthread can detect that. Just in case the CPU that just called rcu_qs()
> > > is slow about actually reporting that quiescent state to the RCU core.
> >
> > Hmmm... Should ->need_qs ever be cleared from FQS to begin with?
>
> I did not see the FQS loop clearing ->need_qs in the rcu_read_unlock_special
> union after looking for a few minutes. Could you clarify which path this?
>
> Or do you mean ->core_needs_qs? If so, I feel the FQS loop should clear it as
> I think your patch does, since the FQS loop is essentially doing heavy-weight
> RCU core processing right?
>
> Also, where does FQS loop clear rdp.cpu_no_qs? Shouldn't it clear that as
> well for the dyntick-idle CPUs?
Synchronization?
Thanx, Paul