> Right. So I came up with this then. Pls note i could not repro the > problem so I am merely reasoning based on theoretical understanding > of it. > > ---> > > virtio_net: mask callbacks before handing off NAPI ownership > > Virtio is special in that enabling or disabling callbacks (interrupts) > accesses shared virtqueue state and must be serialized with polling. It > therefore enables callbacks before completing NAPI, and disables them > again if completion returns false. > > With napi_complete_done(), that false return can come after ownership has > passed to another poll. The first poll can then disable callbacks after > its successor has enabled them, leaving RX stalled. Virtio therefore > needs to disable callbacks before handing off NAPI ownership. > > Add a prepare/finish NAPI completion API so virtio-net can mask interrupts > before handing ownership off. > > This preserves interrupt suppression without a callback or an additional > data-path barrier. Ordinary napi_complete_done() compiles identically in > the tested configuration. > > Tested on x86-64 KVM with lock debugging, including IRQ deferral, concurrent > scheduling, busy polling, netpoll, and threaded NAPI. Split and packed > virtqueue TCP RX tests with IRQ deferral and busy polling also passed. > > Reported-by: Congjie Zhou <[email protected]> > Closes: > https://lore.kernel.org/netdev/[email protected]/ > Fixes: 6f8b12d661d0 ("net: napi: add hard irqs deferral feature") > Assisted-by: LLM
I've tested this patch locally , and everything looks good now, the issue is gone.
