Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vhost-net: unbreak busy polling

Commit 67a873df0c41 ("vhost: basic in order support") pass the number
of used elem to vhost_net_rx_peek_head_len() to make sure it can
signal the used correctly before trying to do busy polling. But it
forgets to clear the count, this would cause the count run out of sync
with handle_rx() and break the busy polling.

Fixing this by passing the pointer of the count and clearing it after
the signaling the used.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Cc: stable@vger.kernel.org
Fixes: 67a873df0c41 ("vhost: basic in order support")
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20250917063045.2042-1-jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Jason Wang and committed by
Michael S. Tsirkin
90beccb3 a318eb80

+4 -3
+4 -3
drivers/vhost/net.c
··· 1014 1014 } 1015 1015 1016 1016 static int vhost_net_rx_peek_head_len(struct vhost_net *net, struct sock *sk, 1017 - bool *busyloop_intr, unsigned int count) 1017 + bool *busyloop_intr, unsigned int *count) 1018 1018 { 1019 1019 struct vhost_net_virtqueue *rnvq = &net->vqs[VHOST_NET_VQ_RX]; 1020 1020 struct vhost_net_virtqueue *tnvq = &net->vqs[VHOST_NET_VQ_TX]; ··· 1024 1024 1025 1025 if (!len && rvq->busyloop_timeout) { 1026 1026 /* Flush batched heads first */ 1027 - vhost_net_signal_used(rnvq, count); 1027 + vhost_net_signal_used(rnvq, *count); 1028 + *count = 0; 1028 1029 /* Both tx vq and rx socket were polled here */ 1029 1030 vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, true); 1030 1031 ··· 1181 1180 1182 1181 do { 1183 1182 sock_len = vhost_net_rx_peek_head_len(net, sock->sk, 1184 - &busyloop_intr, count); 1183 + &busyloop_intr, &count); 1185 1184 if (!sock_len) 1186 1185 break; 1187 1186 sock_len += sock_hlen;