mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
vhost: rcu annotation fixup
When built with rcu checks enabled, vhost triggers bogus warnings as vhost features are read without dev->mutex sometimes, and private pointer is read with our kind of rcu where work serves as a read side critical section. Fixing it properly is not trivial. Disable the warnings by stubbing out the checks for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
fca540ab5f
commit
5e18247b02
@ -128,8 +128,7 @@ static void handle_tx(struct vhost_net *net)
|
|||||||
size_t hdr_size;
|
size_t hdr_size;
|
||||||
struct socket *sock;
|
struct socket *sock;
|
||||||
|
|
||||||
/* TODO: check that we are running from vhost_worker?
|
/* TODO: check that we are running from vhost_worker? */
|
||||||
* Not sure it's worth it, it's straight-forward enough. */
|
|
||||||
sock = rcu_dereference_check(vq->private_data, 1);
|
sock = rcu_dereference_check(vq->private_data, 1);
|
||||||
if (!sock)
|
if (!sock)
|
||||||
return;
|
return;
|
||||||
@ -306,7 +305,8 @@ static void handle_rx_big(struct vhost_net *net)
|
|||||||
size_t len, total_len = 0;
|
size_t len, total_len = 0;
|
||||||
int err;
|
int err;
|
||||||
size_t hdr_size;
|
size_t hdr_size;
|
||||||
struct socket *sock = rcu_dereference(vq->private_data);
|
/* TODO: check that we are running from vhost_worker? */
|
||||||
|
struct socket *sock = rcu_dereference_check(vq->private_data, 1);
|
||||||
if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
|
if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -415,7 +415,8 @@ static void handle_rx_mergeable(struct vhost_net *net)
|
|||||||
int err, headcount;
|
int err, headcount;
|
||||||
size_t vhost_hlen, sock_hlen;
|
size_t vhost_hlen, sock_hlen;
|
||||||
size_t vhost_len, sock_len;
|
size_t vhost_len, sock_len;
|
||||||
struct socket *sock = rcu_dereference(vq->private_data);
|
/* TODO: check that we are running from vhost_worker? */
|
||||||
|
struct socket *sock = rcu_dereference_check(vq->private_data, 1);
|
||||||
if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
|
if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -173,9 +173,9 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit)
|
|||||||
{
|
{
|
||||||
unsigned acked_features;
|
unsigned acked_features;
|
||||||
|
|
||||||
acked_features =
|
/* TODO: check that we are running from vhost_worker or dev mutex is
|
||||||
rcu_dereference_index_check(dev->acked_features,
|
* held? */
|
||||||
lockdep_is_held(&dev->mutex));
|
acked_features = rcu_dereference_index_check(dev->acked_features, 1);
|
||||||
return acked_features & (1 << bit);
|
return acked_features & (1 << bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user