Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: lange_tang@163.com
Cc: Simon Horman <horms@kernel.org>,
	mst@redhat.com, xuanzhuo@linux.alibaba.com, jasowang@redhat.com,
	edumazet@google.com, virtualization@lists.linux.dev,
	netdev@vger.kernel.org, tanglongjun@kylinos.cn
Subject: Re: [PATCH v4] virtio_net: disable cb when NAPI is busy-polled
Date: Fri, 26 Jun 2026 16:15:08 +0100	[thread overview]
Message-ID: <20260626151508.1319440-1-horms@kernel.org> (raw)
In-Reply-To: <20260625013733.29300-1-lange_tang@163.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev
---
virtio_net: disable cb when NAPI is busy-polled

This commit disables the virtqueue callback at the entry of virtnet_poll().
It aims to prevent a large number of spurious interrupts when busy-poll is
active by keeping the callback off while polling.

> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 26afa6341d161..c1e252400c0fc 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -3011,6 +3011,8 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
>  	unsigned int xdp_xmit = 0;
>  	bool napi_complete;
>  
> +	virtqueue_disable_cb(rq->vq);
> +

[Severity: High]
Can this unconditionally disable the RX callback and cause a permanent network
stall when polled by netpoll?

If the netpoll subsystem (e.g., used by netconsole) calls the NAPI poll
function directly with a budget of 0, virtqueue_disable_cb() is called
immediately. virtnet_receive() will then process 0 packets and return 0.

Later in virtnet_poll(), the completion condition is checked:

	if (received < budget) {
		napi_complete = virtqueue_napi_complete(napi, rq->vq, received);
        ...
	}

When both received and budget are 0, this condition evaluates to false. This
skips virtqueue_napi_complete(), leaving the RX callback permanently disabled
and preventing the device from raising further RX interrupts.

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

      reply	other threads:[~2026-06-26 15:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-25  1:37 [PATCH v4] virtio_net: disable cb when NAPI is busy-polled Longjun Tang
2026-06-26 15:15 ` Simon Horman [this message]

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=20260626151508.1319440-1-horms@kernel.org \
    --to=horms@kernel.org \
    --cc=edumazet@google.com \
    --cc=jasowang@redhat.com \
    --cc=lange_tang@163.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --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