Re: [PATCH tip/core/rcu 43/48] vhost: add __rcu annotations

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Paul E. McKenney
Date: Tuesday, May 4, 2010 - 4:57 pm

On Wed, May 05, 2010 at 12:39:36AM +0300, Michael S. Tsirkin wrote:

How about the following?

	struct socket *sock;
	
	sock = rcu_dereference_protected(vq->private_data,
					 lockdep_is_held(&vq->mutex));

This could be used for some (though not all) of these situations.

And just so you know...  The fact that this is here in the first
place is actually my mistake -- my intention was to include the __rcu
annotations and nothing else, then follow up with bug fixes.  In fact,
the alert reader will have noted that there is in fact no such thing
as rcu_dereference_const().  And have concluded that none of my test
machines use vhost.  :-/

But as long as we are here, might as well complete the annotation...

So I have inserted guesses for the lockdep_is_held() expressions below
for your amusement.  Please let me know what I should be using instead.


	sock = rcu_dereference_protected(vq->private_data,
					 lockdep_is_held(&vq->mutex));


	oldsock = rcu_dereference_protected(vq->private_data,
					    lockdep_is_held(&vq->mutex));

Though I can't say I see where this lock is actually acquired in this
case...


Good point!  Fixed.


	kfree(rcu_dereference_protected(dev->memory,
					lockdep_is_held(&dev->mutex));


Fixed -- any in any case, we can always use RCU_INIT_POINTER() when
assigning NULL.


	return memory_access_ok(dev, rcu_dereference_protected(dev->memory, lockdep_is_held(&dev->mutex)), 1);

And yes, we do need an rcu_dereference_vqdev() wrapper function, but just
want to identify the mutexes for the moment.

Maybe a separate rcu_dereference_vq() as well -- but you tell me!


	return memory_access_ok(dev, rcu_dereference_protected(dev->memory, lockdep_is_held(&dev->mutex)),


	oldmem = rcu_dereference_protected(d->memory,
					   lockdep_is_held(&d->mutex));

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH tip/core/rcu 03/48] rcu: make dead code really dead, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 19/48] Debugobjects transition check, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 22/48] rcu head remove init, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 24/48] rcu: make SRCU usable in modules, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 0/48] v4 patches queued for 2.6.35, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 32/48] rculist: avoid __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 33/48] cgroups: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 34/48] credentials: rcu annotation, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 35/48] keys: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 36/48] nfs: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 38/48] perf_event: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 39/48] notifiers: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 40/48] radix-tree: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 41/48] idr: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 42/48] input: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 43/48] vhost: add __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 44/48] net/netfilter: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 45/48] kvm: add __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 46/48] kernel: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 47/48] net: __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
[PATCH tip/core/rcu 48/48] kvm: more __rcu annotations, Paul E. McKenney, (Tue May 4, 1:19 pm)
Re: [PATCH tip/core/rcu 43/48] vhost: add __rcu annotations, Michael S. Tsirkin, (Tue May 4, 2:39 pm)
Re: [PATCH tip/core/rcu 43/48] vhost: add __rcu annotations, Paul E. McKenney, (Tue May 4, 4:57 pm)
Re: [PATCH tip/core/rcu 43/48] vhost: add __rcu annotations, Michael S. Tsirkin, (Tue May 4, 4:59 pm)
Re: [PATCH tip/core/rcu 33/48] cgroups: __rcu annotations, Paul E. McKenney, (Tue May 4, 5:04 pm)
Re: [PATCH tip/core/rcu 43/48] vhost: add __rcu annotations, Paul E. McKenney, (Tue May 4, 5:39 pm)
Re: [PATCH tip/core/rcu 36/48] nfs: __rcu annotations, David Howells, (Wed May 5, 3:14 am)
Re: [PATCH tip/core/rcu 36/48] nfs: __rcu annotations, Trond Myklebust, (Wed May 5, 5:44 am)
Re: [PATCH tip/core/rcu 36/48] nfs: __rcu annotations, Paul E. McKenney, (Wed May 5, 2:01 pm)