On Tue, Mar 31, 2026 at 6:27 PM Longjun Tang <[email protected]> wrote:
>
> From: Longjun Tang <[email protected]>
>
> 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 <[email protected]>
> ---
>  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);
> +

I guess the root cause is virtuqeue_disable_cb() doesn't disable cb in
this case?

static void virtqueue_napi_schedule(struct napi_struct *napi,
                                    struct virtqueue *vq)
{
        if (napi_schedule_prep(napi)) {
virtqueue_disable_cb(vq);
                __napi_schedule(napi);
        }
}

If there's an interrupt in the middle of NAPIF_STATE_IN_BUSY_POLL,
napi_schedule_prep() will return false, so we lose the chance to
disable cb.

Thanks

>         virtnet_poll_cleantx(rq, budget);
>
>         received = virtnet_receive(rq, budget, &xdp_xmit);
> --
> 2.43.0
>


Reply via email to