From: Frederic Weisbecker <frederic@kernel.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: linux-kernel@vger.kernel.org,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Neeraj Upadhyay <quic_neeraju@quicinc.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH rcu/next 1/3] rcu/tree: Use READ_ONCE() for lockless read of rnp->qsmask
Date: Fri, 16 Sep 2022 12:55:23 +0200 [thread overview]
Message-ID: <20220916105523.GA25456@lothringen> (raw)
In-Reply-To: <20220915001419.55617-2-joel@joelfernandes.org>
On Thu, Sep 15, 2022 at 12:14:17AM +0000, Joel Fernandes (Google) wrote:
> The rnp->qsmask is locklessly accessed from rcutree_dying_cpu(). This
> may help avoid load tearing due to concurrent access, KCSAN
> issues, and preserve sanity of people reading the mask in tracing.
>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
> kernel/rcu/tree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 0ca21ac0f064..5ec97e3f7468 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2106,7 +2106,7 @@ int rcutree_dying_cpu(unsigned int cpu)
> if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
> return 0;
>
> - blkd = !!(rnp->qsmask & rdp->grpmask);
> + blkd = !!(READ_ONCE(rnp->qsmask) & rdp->grpmask);
> trace_rcu_grace_period(rcu_state.name, READ_ONCE(rnp->gp_seq),
> blkd ? TPS("cpuofl-bgp") : TPS("cpuofl"));
> return 0;
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
next prev parent reply other threads:[~2022-09-16 11:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 0:14 [PATCH rcu/next 0/3] Preparatory patches borrowed from lazy rcu v5 Joel Fernandes (Google)
2022-09-15 0:14 ` [PATCH rcu/next 1/3] rcu/tree: Use READ_ONCE() for lockless read of rnp->qsmask Joel Fernandes (Google)
2022-09-16 10:55 ` Frederic Weisbecker [this message]
2022-09-15 0:14 ` [PATCH rcu/next 2/3] rcu: Move trace_rcu_callback() before bypassing Joel Fernandes (Google)
2022-09-16 11:09 ` Frederic Weisbecker
2022-09-16 14:10 ` Joel Fernandes
2022-09-16 14:14 ` Joel Fernandes
2022-09-16 22:19 ` Joel Fernandes
2022-09-16 22:21 ` Joel Fernandes
2022-09-15 0:14 ` [PATCH rcu/next 3/3] rcu: Fix late wakeup when flush of bypass cblist happens Joel Fernandes (Google)
2022-09-16 12:51 ` Frederic Weisbecker
-- strict thread matches above, loose matches on Subject: below --
2022-09-17 16:41 [PATCH rcu/next 0/3] Preparatory patches borrowed from lazy rcu v5 Joel Fernandes (Google)
2022-09-17 16:41 ` [PATCH rcu/next 1/3] rcu/tree: Use READ_ONCE() for lockless read of rnp->qsmask Joel Fernandes (Google)
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=20220916105523.GA25456@lothringen \
--to=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=quic_neeraju@quicinc.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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.