From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
lttng-dev@lists.lttng.org, josh@joshtriplett.org,
sparse@chrisli.org, linux-sparse@vger.kernel.org
Subject: Re: [RFC] adding into middle of RCU list
Date: Thu, 29 Aug 2013 17:57:33 -0700 [thread overview]
Message-ID: <20130830005733.GA20664@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130823210822.GD3871@linux.vnet.ibm.com>
On Fri, Aug 23, 2013 at 02:08:22PM -0700, Paul E. McKenney wrote:
> On Fri, Aug 23, 2013 at 01:16:53PM -0400, Mathieu Desnoyers wrote:
> > * Paul E. McKenney (paulmck@linux.vnet.ibm.com) wrote:
> > > On Thu, Aug 22, 2013 at 09:33:18PM -0700, Stephen Hemminger wrote:
[ . . . ]
> > > > +
> > > > +/**
> > > > + * Splice an RCU-protected list into an existing list.
> > > > + *
> > > > + * Note that this function blocks in synchronize_rcu()
> > > > + *
> > > > + * Important note: this function is not called concurrently
> > > > + * with other updates to the list.
> > > > + */
> > > > +static inline void caa_list_splice_init_rcu(struct cds_list_head *list,
> > > > + struct cds_list_head *head)
> > > > +{
> > > > + struct cds_list_head *first = list->next;
> > > > + struct cds_list_head *last = list->prev;
> > > > + struct cds_list_head *at = head->next;
> > > > +
> > > > + if (cds_list_empty(list))
> > > > + return;
> > > > +
> > > > + /* "first" and "last" tracking list, so initialize it. */
> > > > + CDS_INIT_LIST_HEAD(list);
> > >
> > > This change is happening in the presence of readers on the list, right?
> > > For this to work reliably in the presence of mischievous compilers,
> > > wouldn't CDS_INIT_LIST_HEAD() need to use CMM_ACCESS_ONCE() for its
> > > pointer accesses?
> >
> > Actually, we have rcu_assign_pointer()/rcu_set_pointer() exactly for
> > this. They even skip the memory barrier if they store a NULL pointer.
> >
> > > Hmmm... The kernel version seems to have the same issue...
> >
> > The compiler memory model of the Linux kernel AFAIK does not require an
> > ACCESS_ONCE() for stores to word-aligned, word-sized integers/pointers,
> > even if those are expected to be read concurrently. For reference, see:
> >
> > #define __rcu_assign_pointer(p, v, space) \
> > do { \
> > smp_wmb(); \
> > (p) = (typeof(*v) __force space *)(v); \
> > } while (0)
>
> Or I need to fix this one as well. ;-)
In that vein... Is there anything like typeof() that also preserves
sparse's notion of address space? Wrapping an ACCESS_ONCE() around
"p" in the assignment above results in sparse errors.
Thanx, Paul
Thanx, Paul
next prev parent reply other threads:[~2013-08-30 0:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20130822213318.49a57fa2@nehalam.linuxnetplumber.net>
2013-08-23 15:07 ` [RFC] adding into middle of RCU list Mathieu Desnoyers
2013-08-23 16:46 ` Paul E. McKenney
[not found] ` <20130823164637.GB3871@linux.vnet.ibm.com>
2013-08-23 17:16 ` Mathieu Desnoyers
[not found] ` <20130823171653.GA16558@Krystal>
2013-08-23 19:09 ` Stephen Hemminger
[not found] ` <20130823120956.58ee74e3@nehalam.linuxnetplumber.net>
2013-08-23 21:05 ` Paul E. McKenney
[not found] ` <20130823210551.GC3871@linux.vnet.ibm.com>
2013-08-23 21:14 ` Stephen Hemminger
2013-08-23 21:08 ` Paul E. McKenney
[not found] ` <20130823210822.GD3871@linux.vnet.ibm.com>
2013-08-30 0:57 ` Paul E. McKenney [this message]
2013-08-30 2:16 ` Josh Triplett
2013-08-30 2:16 ` Josh Triplett
2013-08-31 21:32 ` Paul E. McKenney
2013-09-01 20:42 ` Josh Triplett
2013-09-01 22:26 ` Paul E. McKenney
2013-09-01 22:43 ` Josh Triplett
2013-09-01 23:42 ` [PATCH] rcu: Make rcu_assign_pointer's assignment volatile and type-safe Josh Triplett
2013-09-02 2:01 ` Paul E. McKenney
2013-08-23 4:33 [RFC] adding into middle of RCU list Stephen Hemminger
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=20130830005733.GA20664@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=josh@joshtriplett.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lttng-dev@lists.lttng.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=sparse@chrisli.org \
--cc=stephen@networkplumber.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.