Linux virtualization list
 help / color / mirror / Atom feed
From: Longjun Tang <lange_tang@163.com>
To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
	edumazet@google.com
Cc: lange_tang@163.com, tanglongjun@kylinos.cn,
	virtualization@lists.linux.dev
Subject: [PATCH 1/2] virtio_net: disable cb when in busy-polling
Date: Tue, 31 Mar 2026 18:26:25 +0800	[thread overview]
Message-ID: <20260331102626.108962-2-lange_tang@163.com> (raw)
In-Reply-To: <20260331102626.108962-1-lange_tang@163.com>

From: Longjun Tang <tanglongjun@kylinos.cn>

virtnet_poll() is shared between NAPI softirq context and the busy-poll
path (sk_busy_loop).  In the busy-poll path the caller drives the loop
directly and does not rely on interrupts to schedule NAPI; keeping
callbacks enabled is wasteful and risks a flood of IRQ_NONE returns that
can trigger the kernel's spurious-IRQ detector.

Signed-off-by: Longjun Tang <tanglongjun@kylinos.cn>
---
 drivers/net/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 72d6a9c6a5a2..df365fba2c40 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -3078,6 +3078,9 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
 	unsigned int xdp_xmit = 0;
 	bool napi_complete;
 
+	if (READ_ONCE(napi->state) & NAPIF_STATE_IN_BUSY_POLL)
+		virtqueue_disable_cb(rq->vq);
+
 	virtnet_poll_cleantx(rq, budget);
 
 	received = virtnet_receive(rq, budget, &xdp_xmit);
-- 
2.43.0


  reply	other threads:[~2026-03-31 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 10:26 [PATCH 0/2] fix virtio_net/virtio when in busy-polling Longjun Tang
2026-03-31 10:26 ` Longjun Tang [this message]
2026-04-03  2:57   ` [PATCH 1/2] virtio_net: disable cb " Jason Wang
2026-04-07  7:02     ` Lange Tang
2026-03-31 10:26 ` [PATCH 2/2] virtio_ring: return IRQ_HANDLED for stale interrupts when cb disabled Longjun Tang
2026-04-03  2:55   ` Jason Wang
2026-04-07  7:28     ` Lange Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260331102626.108962-2-lange_tang@163.com \
    --to=lange_tang@163.com \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=tanglongjun@kylinos.cn \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox