From: Joel Fernandes <joel@joelfernandes.org>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH RFC 4/5] sched/topology: Annonate RCU pointers properly
Date: Thu, 21 Feb 2019 12:17:19 -0500 [thread overview]
Message-ID: <20190221171719.GB118415@google.com> (raw)
In-Reply-To: <20190221152944.GS32494@hirez.programming.kicks-ass.net>
On Thu, Feb 21, 2019 at 04:29:44PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 21, 2019 at 10:10:57AM -0500, Joel Fernandes wrote:
> > Hi Peter,
> >
> > Thanks for taking a look.
> >
> > On Thu, Feb 21, 2019 at 10:19:44AM +0100, Peter Zijlstra wrote:
> > > On Thu, Feb 21, 2019 at 12:49:41AM -0500, Joel Fernandes (Google) wrote:
> > >
> > > > Also replace rcu_assign_pointer call on rq->sd with WRITE_ONCE. This
> > > > should be sufficient for the rq->sd initialization.
> > >
> > > > @@ -668,7 +668,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
> > > >
> > > > rq_attach_root(rq, rd);
> > > > tmp = rq->sd;
> > > > - rcu_assign_pointer(rq->sd, sd);
> > > > + WRITE_ONCE(rq->sd, sd);
> > > > dirty_sched_domain_sysctl(cpu);
> > > > destroy_sched_domains(tmp);
> > >
> > > Where did the RELEASE barrier go?
> > >
> > > That was a publish operation, now it is not.
> >
> > Funny thing is, initially I had written this patch with smp_store_release()
> > instead of WRITE_ONCE, but checkpatch complaints with that since it needs a
> > comment on top of it, and I wasn't sure if RELEASE barrier was the intent of
> > using rcu_assign_pointer (all the more reason to replace it with something
> > more explicit).
> >
> > I will replace it with the following and resubmit it then:
> >
> > /* Release barrier */
> > smp_store_release(&rq->sd, sd);
> >
> > Or do we want to just drop the "Release barrier" comment and live with the
> > checkpatch warning?
>
> How about we keep using rcu_assign_pointer(), the whole sched domain
> tree is under rcu; peruse that destroy_sched_domains() function for
> instance.
>
> Also check how for_each_domain() uses rcu_dereference().
May be then, all those pointers should be made __rcu as well. Then we can use
rcu_assign_pointer() here. I will look more into it and study these functions
as you are suggesting.
thanks,
- Joel
WARNING: multiple messages have this Message-ID (diff)
From: Joel Fernandes <joel@joelfernandes.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Christian Brauner <christian@brauner.io>,
Daniel Borkmann <daniel@iogearbox.net>,
David Ahern <dsahern@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Ido Schimmel <idosch@mellanox.com>,
Ingo Molnar <mingo@redhat.com>,
"moderated list:INTEL ETHERNET DRIVERS"
<intel-wired-lan@lists.osuosl.org>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Josh Triplett <josh@joshtriplett.org>,
keescook@chromium.org, Lai Jiangshan <jiangshanlai@gmail.com>,
Martin KaFai Lau <kafai@fb.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
netdev@vger.kernel.org,
"Paul E. McKenney" <paulmck@linux.ibm.com>,
rcu@vger.kernel.org, Song Liu <songliubraving@fb.com>,
Steven Rostedt <rostedt@goodmis.org>,
xdp-newbies@vger.kernel.org, Yonghong Song <yhs@fb.com>
Subject: Re: [PATCH RFC 4/5] sched/topology: Annonate RCU pointers properly
Date: Thu, 21 Feb 2019 12:17:19 -0500 [thread overview]
Message-ID: <20190221171719.GB118415@google.com> (raw)
In-Reply-To: <20190221152944.GS32494@hirez.programming.kicks-ass.net>
On Thu, Feb 21, 2019 at 04:29:44PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 21, 2019 at 10:10:57AM -0500, Joel Fernandes wrote:
> > Hi Peter,
> >
> > Thanks for taking a look.
> >
> > On Thu, Feb 21, 2019 at 10:19:44AM +0100, Peter Zijlstra wrote:
> > > On Thu, Feb 21, 2019 at 12:49:41AM -0500, Joel Fernandes (Google) wrote:
> > >
> > > > Also replace rcu_assign_pointer call on rq->sd with WRITE_ONCE. This
> > > > should be sufficient for the rq->sd initialization.
> > >
> > > > @@ -668,7 +668,7 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
> > > >
> > > > rq_attach_root(rq, rd);
> > > > tmp = rq->sd;
> > > > - rcu_assign_pointer(rq->sd, sd);
> > > > + WRITE_ONCE(rq->sd, sd);
> > > > dirty_sched_domain_sysctl(cpu);
> > > > destroy_sched_domains(tmp);
> > >
> > > Where did the RELEASE barrier go?
> > >
> > > That was a publish operation, now it is not.
> >
> > Funny thing is, initially I had written this patch with smp_store_release()
> > instead of WRITE_ONCE, but checkpatch complaints with that since it needs a
> > comment on top of it, and I wasn't sure if RELEASE barrier was the intent of
> > using rcu_assign_pointer (all the more reason to replace it with something
> > more explicit).
> >
> > I will replace it with the following and resubmit it then:
> >
> > /* Release barrier */
> > smp_store_release(&rq->sd, sd);
> >
> > Or do we want to just drop the "Release barrier" comment and live with the
> > checkpatch warning?
>
> How about we keep using rcu_assign_pointer(), the whole sched domain
> tree is under rcu; peruse that destroy_sched_domains() function for
> instance.
>
> Also check how for_each_domain() uses rcu_dereference().
May be then, all those pointers should be made __rcu as well. Then we can use
rcu_assign_pointer() here. I will look more into it and study these functions
as you are suggesting.
thanks,
- Joel
next prev parent reply other threads:[~2019-02-21 17:17 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-21 5:49 [Intel-wired-lan] [PATCH RFC 0/5] RCU fixes for rcu_assign_pointer() usage Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` [Intel-wired-lan] [PATCH RFC 1/5] net: rtnetlink: Fix incorrect RCU API usage Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` [Intel-wired-lan] [PATCH RFC 2/5] ixgbe: " Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` [Intel-wired-lan] [PATCH RFC 3/5] sched/cpufreq: " Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 9:18 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 9:18 ` Peter Zijlstra
2019-02-21 15:21 ` [Intel-wired-lan] " Joel Fernandes
2019-02-21 15:21 ` Joel Fernandes
2019-02-21 15:31 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 15:31 ` Peter Zijlstra
2019-02-21 15:52 ` [Intel-wired-lan] " Paul E. McKenney
2019-02-21 15:52 ` Paul E. McKenney
2019-02-21 16:11 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 16:11 ` Peter Zijlstra
2019-02-21 17:13 ` [Intel-wired-lan] " Joel Fernandes
2019-02-21 17:13 ` Joel Fernandes
2019-02-21 17:29 ` [Intel-wired-lan] " Paul E. McKenney
2019-02-21 17:29 ` Paul E. McKenney
2019-02-21 16:17 ` [Intel-wired-lan] " Steven Rostedt
2019-02-21 16:17 ` Steven Rostedt
2019-02-21 16:17 ` Steven Rostedt
2019-02-21 23:05 ` [Intel-wired-lan] " Rafael J. Wysocki
2019-02-21 23:05 ` Rafael J. Wysocki
2019-02-21 5:49 ` [Intel-wired-lan] [PATCH RFC 4/5] sched/topology: Annonate RCU pointers properly Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 9:19 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 9:19 ` Peter Zijlstra
2019-02-21 15:10 ` [Intel-wired-lan] " Joel Fernandes
2019-02-21 15:10 ` Joel Fernandes
2019-02-21 15:29 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 15:29 ` Peter Zijlstra
2019-02-21 17:17 ` Joel Fernandes [this message]
2019-02-21 17:17 ` Joel Fernandes
2019-02-21 5:49 ` [Intel-wired-lan] [PATCH RFC 5/5] rcuwait: Replace rcu_assign_pointer() with WRITE_ONCE Joel Fernandes
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 5:49 ` Joel Fernandes (Google)
2019-02-21 9:20 ` [Intel-wired-lan] " Peter Zijlstra
2019-02-21 9:20 ` Peter Zijlstra
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=20190221171719.GB118415@google.com \
--to=joel@joelfernandes.org \
--cc=intel-wired-lan@osuosl.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.