[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250430070205.09a4ea5d@kernel.org>
Date: Wed, 30 Apr 2025 07:02:05 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Jason Wang <jasowang@...hat.com>, davem@...emloft.net,
netdev@...r.kernel.org, edumazet@...gle.com, pabeni@...hat.com,
andrew+netdev@...n.ch, horms@...nel.org, xuanzhuo@...ux.alibaba.com,
eperezma@...hat.com, minhquangbui99@...il.com, romieu@...zoreil.com,
kuniyu@...zon.com, virtualization@...ts.linux.dev
Subject: Re: [PATCH net] virtio-net: don't re-enable refill work too early
when NAPI is disabled
On Wed, 30 Apr 2025 01:29:06 -0400 Michael S. Tsirkin wrote:
> > > @@ -3728,7 +3731,7 @@ static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs)
> > > succ:
> > > vi->curr_queue_pairs = queue_pairs;
> > > /* virtnet_open() will refill when device is going to up. */
> > > - if (dev->flags & IFF_UP)
> > > + if (dev->flags & IFF_UP && vi->refill_enabled)
> > > schedule_delayed_work(&vi->refill, 0);
> >
> > This has the assumption that the toggle of the refill_enabled is under
> > RTNL.
Yes, this line of code must be under rtnl_lock to be correct, since
it is also checking flags & IFF_UP. I was thinking of moving it to
virtnet_restore(), AFAIU that's the only place that needs it.
But that's more of a -next change.
> > Though it's true now but it looks to me it's better to protect
> > it against refill_lock.
>
> Good point.
Sure. I'll wrap the check and the call to schedule_.. with the lock.
Powered by blists - more mailing lists