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@xxxxxxxxxxxxxxxxxx) 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 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html