Prev: No SPROM available!
Next: open error path failure...
From: David Howells on 29 Mar 2010 15:10 Paul E. McKenney <paulmck(a)linux.vnet.ibm.com> wrote: > > spin_lock(&clp->cl_lock); > > - if (rcu_dereference(nfsi->delegation) != NULL) { > > + if (nfsi->delegation != NULL) { > > And this one. I thought that Trond said that clp->cl_lock protects > this one, in which case this should work: > > if (rcu_dereference_check(nfsi->delegation, > lockdep_is_held(&clp->cl_lock)) != NULL) { If clp->cl_lock protects this pointer, why the need for rcu_dereference_check() at all? The check is redundant since the line above gets the very lock we're checking for. > > - if (rcu_dereference(nfsi->delegation) != NULL) { > > + if (nfsi->delegation != NULL) { > > And this one, although the check for cp->cl_lock obviously won't work here. > > > spin_lock(&clp->cl_lock); > > delegation = nfs_detach_delegation_locked(nfsi, NULL); > > spin_unlock(&clp->cl_lock); On this one, why does nfsi->delegation need a memory barrier interpolating afterwards? It has an implicit one in the form of the spin_lock() immediately after, if the value of the pointer wasn't NULL. What two memory accesses is the memory barrier ordering? Ditto on the next one. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 29 Mar 2010 16:20 Paul E. McKenney <paulmck(a)linux.vnet.ibm.com> wrote: > > > if (rcu_dereference_check(nfsi->delegation, > > > lockdep_is_held(&clp->cl_lock)) != NULL) { > > > > If clp->cl_lock protects this pointer, why the need for > > rcu_dereference_check() at all? The check is redundant since the line > > above gets the very lock we're checking for. > > Because Arnd Bergmann is working on a set of patches that makes sparse > complain if you access an RCU-protected pointer directly, without using > some flavor of rcu_dereference(). > > So your approach would work for the moment, but would need another > change, probably in the 2.6.35 timeframe. My objection to using rcu_dereference_check() here is that it's a dynamic check: the compiler emits code to do it, since the lock/unlock status of what the pointer points to cannot be determined easily at compiler time - and then the barrier is interpolated anyway unnecessarily. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 29 Mar 2010 18:30 Paul E. McKenney <paulmck(a)linux.vnet.ibm.com> wrote: > And rcu_dereference_raw() is the same as the old rcu_dereference(). Exactly. That's the other half of the issue - that interpolates a redundant memory barrier. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 29 Mar 2010 19:00 Paul E. McKenney <paulmck(a)linux.vnet.ibm.com> wrote: > Only on Alpha. Otherwise only a volatile access. Whilst that is true, it's the principle of the thing. The extra barrier shouldn't be emitted on Alpha. If Alpha's no longer important, then can we scrap smp_read_barrier_depends()? My point is that some of these rcu_dereference*()'s are unnecessary. If there're required for correctness tracking purposes, fine; but can we have a macro that is just a dummy for the purpose of stripping the pointer Sparse annotation? One that doesn't invoke rcu_dereference_raw() and interpolate a barrier, pretend or otherwise, when there's no second reference to order against. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: David Howells on 30 Mar 2010 12:40
Paul E. McKenney <paulmck(a)linux.vnet.ibm.com> wrote: > Scrap this one -- Arnd has it covered, under the much better name > of rcu_dereference_const(). Not convinced of that name either. That sounds like the RCU dereference of constant (R/O) data. David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |