On Thu, Mar 6, 2025 at 12:34 AM Joe Damato <jdamato@xxxxxxxxxx> wrote: > > On Wed, Mar 05, 2025 at 01:11:55PM +0800, Jason Wang wrote: > > On Tue, Mar 4, 2025 at 11:09 PM Joe Damato <jdamato@xxxxxxxxxx> wrote: > > > > > > On Mon, Mar 03, 2025 at 04:03:55PM -0800, Jakub Kicinski wrote: > > > > On Mon, 3 Mar 2025 13:33:10 -0500 Joe Damato wrote: > > [...] > > > > > Middle ground would be to do what you suggested above and just leave > > > > a well worded comment somewhere that will show up in diffs adding queue > > > > API support? > > > > > > Jason, Michael, et. al.: what do you think ? I don't want to spin > > > up a v6 if you are opposed to proceeding this way. Please let me > > > know. > > > > > > > Maybe, but need to make sure there's no use-after-free (etc. > > virtnet_close() has several callers). > > Sorry, I think I am missing something. Can you say more? > > I was asking: if I add the following diff below to patch 3, will > that be acceptable for you as a middle ground until a more idiomatic > implementation can be done ? Yes, I misunderstand you before. > > Since this diff leaves refill_work as it functioned before, it > avoids the problem Jakub pointed out and shouldn't introduce any > bugs since refill_work isn't changing from the original > implementation ? > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 76dcd65ec0f2..d6c8fe670005 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -2883,15 +2883,9 @@ static void refill_work(struct work_struct *work) > for (i = 0; i < vi->curr_queue_pairs; i++) { > struct receive_queue *rq = &vi->rq[i]; > > - rtnl_lock(); > - virtnet_napi_disable(rq); > - rtnl_unlock(); > - > + napi_disable(&rq->napi); > still_empty = !try_fill_recv(vi, rq, GFP_KERNEL); > - > - rtnl_lock(); > - virtnet_napi_enable(rq); > - rtnl_unlock(); > + virtnet_napi_do_enable(rq->vq, &rq->napi); > > /* In theory, this can happen: if we don't get any buffers in > * we will *never* try to fill again. > Works for me. Thanks