Re: [PATCH 02/11] rcu: Kill rnp->ofl_seq and use only rcu_state.ofl_lock for exclusion

From: David Woodhouse
Date: Thu Dec 09 2021 - 13:43:57 EST


On Fri, 2021-12-10 at 00:01 +0530, Neeraj Upadhyay wrote:
> > @@ -4246,11 +4249,11 @@ void rcu_cpu_starting(unsigned int cpu)
> >
> > rnp = rdp->mynode;
> > mask = rdp->grpmask;
> > - WRITE_ONCE(rnp->ofl_seq, rnp->ofl_seq + 1);
> > - WARN_ON_ONCE(!(rnp->ofl_seq & 0x1));
> > + local_irq_save(seq_flags);
> > + arch_spin_lock(&rcu_state.ofl_lock);
> > rcu_dynticks_eqs_online();
> > smp_mb(); // Pair with rcu_gp_cleanup()'s ->ofl_seq barrier().
>
> Can we drop this smp_mb(),as arch_spin_lock(&rcu_state.ofl_lock)
> provides the ordering now?

Yes, thanks.

> > - raw_spin_lock_irqsave_rcu_node(rnp, flags);
> > + raw_spin_lock_rcu_node(rnp);
> > WRITE_ONCE(rnp->qsmaskinitnext, rnp->qsmaskinitnext | mask);
> > newcpu = !(rnp->expmaskinitnext & mask);
> > rnp->expmaskinitnext |= mask;
> > @@ -4269,9 +4272,8 @@ void rcu_cpu_starting(unsigned int cpu)
> > } else {
> > raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
>
> 'flags' is uninitialized now?

Ah yes, that suffered from the fact that saving the flags is pointless
because we know we already disabled interrupts... but
rcu_report_qs_rnp() *really* wants to be given some flags to restore.

Will fix that too; thanks again.

Attachment: smime.p7s
Description: S/MIME cryptographic signature