At 2026-06-15 18:01:40, "Xuan Zhuo" <[email protected]> wrote:
>On Mon, 15 Jun 2026 17:45:50 +0800, Longjun Tang <[email protected]> wrote:
>> From: Longjun Tang <[email protected]>
>>
>> When busy-poll is active, napi_schedule_prep() returns false in
>> skb_recv_done(), so virtqueue_disable_cb() is skipped. The device
>> may keep firing irqs until the next poll round reaches
>> virtqueue_napi_complete(). If cb is enabled under busy-poll case,
>> it will lead to a large number of spurious interrupts. Explicitly
>> disable callbacks in this case to prevent spurious interrupts.
>>
>> Signed-off-by: Longjun Tang <[email protected]>
>> ---
>> drivers/net/virtio_net.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index f4adcfee7a80..6d675fddc59b 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -728,6 +728,8 @@ static void virtqueue_napi_schedule(struct napi_struct
>> *napi,
>> if (napi_schedule_prep(napi)) {
>> virtqueue_disable_cb(vq);
>> __napi_schedule(napi);
>> + } else if (test_bit(NAPI_STATE_IN_BUSY_POLL, &napi->state)) {
>> + virtqueue_disable_cb(vq);
>
>I see, but we should avoid checking NAPI_STATE_IN_BUSY_POLL directly in the
>drivers. The NIC driver should remain agnostic to busy polling. I think we need
>a better way, maybe we should rewrite virtqueue_napi_schedule instead.
How about rewrite it like this?
static void virtqueue_napi_schedule(struct napi_struct *napi,
struct virtqueue *vq)
{
virtqueue_disable_cb(vq);
if (napi_schedule_prep(napi))
__napi_schedule(napi);
}
Any comments are welcome.
>
>Thanks.
>
>> }
>> }
>>
>> --
>> 2.25.1
>>