When built with rcu checks enabled, vhost triggers bogus warnings as vhost features are read without dev->mutex sometimes. Fixing it properly is not trivial as vhost.h does not know which lockdep classes it will be used under. Disable the warning by stubbing out the check for now. Signed-off-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/vhost/vhost.h | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 2af44b7..2d03a31 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h @@ -173,9 +173,7 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit) { unsigned acked_features; - acked_features - rcu_dereference_index_check(dev->acked_features, - lockdep_is_held(&dev->mutex)); + acked_features = rcu_dereference_index_check(dev->acked_features, 1); return acked_features & (1 << bit); } -- 1.7.3.2.91.g446ac
On Tue, Jan 18, 2011 at 01:08:45PM +0200, Michael S. Tsirkin wrote:> When built with rcu checks enabled, vhost triggers > bogus warnings as vhost features are read without > dev->mutex sometimes. > Fixing it properly is not trivial as vhost.h does not > know which lockdep classes it will be used under. > Disable the warning by stubbing out the check for now. > > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > --- > drivers/vhost/vhost.h | 4 +--- > 1 files changed, 1 insertions(+), 3 deletions(-) > > diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h > index 2af44b7..2d03a31 100644 > --- a/drivers/vhost/vhost.h > +++ b/drivers/vhost/vhost.h > @@ -173,9 +173,7 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit) > { > unsigned acked_features; > > - acked_features > - rcu_dereference_index_check(dev->acked_features, > - lockdep_is_held(&dev->mutex)); > + acked_features = rcu_dereference_index_check(dev->acked_features, 1);Ouch!!! Could you please at least add a comment? Alternatively, pass in the lock that is held and check for that? Given that this is a static inline, the compiler should be able to optimize the argument away when !PROVE_RCU, correct? Thanx, Paul> return acked_features & (1 << bit); > } > > -- > 1.7.3.2.91.g446ac > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/
On Tue, Jan 18, 2011 at 01:08:45PM +0200, Michael S. Tsirkin wrote:> When built with rcu checks enabled, vhost triggers > bogus warnings as vhost features are read without > dev->mutex sometimes. > Fixing it properly is not trivial as vhost.h does not > know which lockdep classes it will be used under. > Disable the warning by stubbing out the check for now. >What is the harm in leaving the bogus warnings until the difficult fix happens? RCU checks enabled does not seem like something that is enabled in production. If this patch is applied, there is always the risk that it'll be simply forgotten about. -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab