All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger@xenproject.org>
To: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Cc: xen-devel@lists.xenproject.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH v2 2/3] xen/rcu: simplify RCU implementation
Date: Tue, 29 Sep 2026 15:53:57 +0200	[thread overview]
Message-ID: <arvC9aSoleeD5vQz@macbook.local> (raw)
In-Reply-To: <DLQTVEZZBRXP.2TGY8Y2Z1PQOV@amd.com>

On Mon, Sep 28, 2026 at 11:05:10AM +0200, Alejandro Vallejo wrote:
> On Fri Sep 25, 2026 at 6:30 PM CEST, Roger Pau Monne wrote:
> >  bool rcu_needs_cpu(unsigned int cpu)
> >  {
> > -    struct rcu_data *rdp = &per_cpu(rcu_data, cpu);
> > -
> > -    return (rdp->curlist && !rdp->idle_timer_active) || rcu_pending(cpu);
> > +    return !!per_cpu(rcu_data, cpu).nr;
> 
> Local reads are fine to be relaxed with IRQs off because they can't
> change. But remote reads and reads with IRQs on are subject to data
> races.
> 
> This read should be atomic. And the writes should be atomic too because
> the field is read from remote CPUs.

Sorry, this is a leftover from a further change I wanted to do.
rcu_needs_cpu() is never called against remote CPUs (as is
rcu_pending()), so I wanted to get rid of the cpu parameter and
instead use this_cpu(rcu_data).nr.  Then decided it was too much
churn (and extra logic to fetch the current cpu repeatedly) and forgot
to add the ACCESS_ONCE().

I will add the ACCESS_ONCE() and keep the function interface as-is.

Thanks, Roger.


  reply	other threads:[~2026-09-29 13:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 16:30 [PATCH v2 0/3] xen/rcu: rework the RCU logic Roger Pau Monne
2026-09-25 16:30 ` [PATCH v2 1/3] xen/rcu: introduce the concept of RCU epoch Roger Pau Monne
2026-09-28  8:24   ` Alejandro Vallejo
2026-09-29 14:20     ` Roger Pau Monné
2026-09-29 14:52       ` Jan Beulich
2026-09-29 22:14         ` Alejandro Vallejo
2026-09-30  5:58           ` Jan Beulich
2026-09-30  8:09             ` Roger Pau Monné
2026-09-30  8:34               ` Jan Beulich
2026-09-30 10:07                 ` Roger Pau Monné
2026-09-30 10:31                   ` Jan Beulich
2026-09-30 11:56                   ` Alejandro Vallejo
2026-09-30  8:32           ` Roger Pau Monné
2026-09-30 11:59             ` Alejandro Vallejo
2026-09-25 16:30 ` [PATCH v2 2/3] xen/rcu: simplify RCU implementation Roger Pau Monne
2026-09-28  8:31   ` Alejandro Vallejo
2026-09-28  9:05   ` Alejandro Vallejo
2026-09-29 13:53     ` Roger Pau Monné [this message]
2026-09-25 16:30 ` [PATCH v2 3/3] xen/rcu: remove rcu_quiesce_{disable,enable}() Roger Pau Monne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arvC9aSoleeD5vQz@macbook.local \
    --to=roger@xenproject.org \
    --cc=alejandro.garciavallejo@amd.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.