Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [PATCH] vhost/net: Fix receive queue test in busy poll
@ 2026-11-10  5:16 raoxu
  2026-11-11  5:19 ` sashiko-bot
  2026-11-11 11:58 ` Björn Töpel
  0 siblings, 2 replies; 3+ messages in thread
From: raoxu @ 2026-11-10  5:16 UTC (permalink / raw)
  To: mst; +Cc: jasowangio, eperezma, kvm, virtualization, netdev, linux-kernel,
	raoxu

From: Xu Rao <raoxu@uniontech.com>

sock_has_rx_data() returns a positive result when receive data is
available. Socket implementations with a peek_len() callback follow
that convention, but the fallback for sockets without one returns
skb_queue_empty(), which has the opposite meaning.

This makes busy polling stop when a raw packet socket has no queued data
and fail to recognize queued data through the fallback path. Return the
negated queue-empty result so the fallback matches the callback and its
callers.

Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 drivers/vhost/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 4570a4ffbab2..10ed2d55ff07 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -538,7 +538,7 @@ static int sock_has_rx_data(struct socket *sock)
 	if (sock->ops->peek_len)
 		return sock->ops->peek_len(sock);

-	return skb_queue_empty(&sock->sk->sk_receive_queue);
+	return !skb_queue_empty(&sock->sk->sk_receive_queue);
 }

 static void vhost_net_busy_poll_try_queue(struct vhost_net *net,
--
2.50.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost/net: Fix receive queue test in busy poll
  2026-11-10  5:16 [PATCH] vhost/net: Fix receive queue test in busy poll raoxu
@ 2026-11-11  5:19 ` sashiko-bot
  2026-11-11 11:58 ` Björn Töpel
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-11  5:19 UTC (permalink / raw)
  To: raoxu; +Cc: kvm, virtualization, Michael S. Tsirkin, Eugenio Perez

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] vhost/net: missing Fixes trailer for sock_has_rx_data() bug fix
--

commit e704f9e65e5ab760d5f0c63a3cc9fef9370b05b7
Author: Xu Rao <raoxu@uniontech.com>

> vhost/net: Fix receive queue test in busy poll
>
> sock_has_rx_data() returns a positive result when receive data is
> available. Socket implementations with a peek_len() callback follow
> that convention, but the fallback for sockets without one returns
> skb_queue_empty(), which has the opposite meaning.
>
> This makes busy polling stop when a raw packet socket has no queued data
> and fail to recognize queued data through the fallback path. Return the
> negated queue-empty result so the fallback matches the callback and its
> callers.
>
> Signed-off-by: Xu Rao <raoxu@uniontech.com>

[Severity: Low]
The inverted skb_queue_empty() return value was introduced by
1576d9860599 ("tun: switch to use skb array for tx") and later moved to
sock_has_rx_data() by dc151282bbda ("net: vhost: factor out busy polling
logic to vhost_net_busy_poll()").  Should this include a Fixes tag, such
as:

  Fixes: 1576d9860599 ("tun: switch to use skb array for tx")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/005FA5F7354482C7+20261110051642.249640-1-raoxu@uniontech.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost/net: Fix receive queue test in busy poll
  2026-11-10  5:16 [PATCH] vhost/net: Fix receive queue test in busy poll raoxu
  2026-11-11  5:19 ` sashiko-bot
@ 2026-11-11 11:58 ` Björn Töpel
  1 sibling, 0 replies; 3+ messages in thread
From: Björn Töpel @ 2026-11-11 11:58 UTC (permalink / raw)
  To: raoxu, mst
  Cc: jasowangio, eperezma, kvm, virtualization, netdev, linux-kernel,
	raoxu

raoxu <raoxu@uniontech.com> writes:

> From: Xu Rao <raoxu@uniontech.com>
>
> sock_has_rx_data() returns a positive result when receive data is
> available. Socket implementations with a peek_len() callback follow
> that convention, but the fallback for sockets without one returns
> skb_queue_empty(), which has the opposite meaning.
>
> This makes busy polling stop when a raw packet socket has no queued data
> and fail to recognize queued data through the fallback path. Return the
> negated queue-empty result so the fallback matches the callback and its
> callers.
>
> Signed-off-by: Xu Rao <raoxu@uniontech.com>

This fix is valid, but you need to carry a Fixes: tag. You should also
state what netdev tree you're targeting. Please see
Documentation/process/maintainer-netdev.rst

Could the changelog also state how the bug was found and confirmed, and
how the fix was tested?

Björn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-11 11:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10  5:16 [PATCH] vhost/net: Fix receive queue test in busy poll raoxu
2026-11-11  5:19 ` sashiko-bot
2026-11-11 11:58 ` Björn Töpel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox