]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
virtio_net: disable cb when NAPI is busy-polled
authorLongjun Tang <tanglongjun@kylinos.cn>
Mon, 29 Jun 2026 02:42:30 +0000 (10:42 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Jul 2026 00:03:37 +0000 (17:03 -0700)
When busy-poll is active, napi_schedule_prep() returns false in
virtqueue_napi_schedule(), so virtqueue_disable_cb() is skipped.
The device may keep firing irqs until reaches virtqueue_napi_complete().
Under load (received == budget), it will lead to a large number
of spurious interrupts.

Fix it by disabling the callback at the virtnet_poll() entry.
This keeps the callback off while we poll and it is re-enabled by
virtqueue_napi_complete() when going idle.

Fixes: ceef438d613f ("virtio_net: remove custom busy_poll")
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Longjun Tang <tanglongjun@kylinos.cn>
Link: https://patch.msgid.link/20260629024230.37325-1-lange_tang@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/virtio_net.c

index 26afa6341d16118885b2364fb66638e7ea88f3ed..3e2a5876c6c8cea27661c89cf73b1e413e5ebc65 100644 (file)
@@ -3011,6 +3011,9 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
        unsigned int xdp_xmit = 0;
        bool napi_complete;
 
+       if (budget)
+               virtqueue_disable_cb(rq->vq);
+
        virtnet_poll_cleantx(rq, budget);
 
        received = virtnet_receive(rq, budget, &xdp_xmit);