netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
	minhquangbui99@gmail.com, romieu@fr.zoreil.com,
	kuniyu@amazon.com, virtualization@lists.linux.dev
Subject: Re: [PATCH net] virtio-net: don't re-enable refill work too early when NAPI is disabled
Date: Wed, 30 Apr 2025 07:02:05 -0700	[thread overview]
Message-ID: <20250430070205.09a4ea5d@kernel.org> (raw)
In-Reply-To: <20250430012856-mutt-send-email-mst@kernel.org>

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.

  reply	other threads:[~2025-04-30 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 14:31 [PATCH net] virtio-net: don't re-enable refill work too early when NAPI is disabled Jakub Kicinski
2025-04-29 16:26 ` Bui Quang Minh
2025-04-30  3:49 ` Jason Wang
2025-04-30  5:29   ` Michael S. Tsirkin
2025-04-30 14:02     ` Jakub Kicinski [this message]
2025-04-30  4:16 ` Michael S. Tsirkin

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=20250430070205.09a4ea5d@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eperezma@redhat.com \
    --cc=horms@kernel.org \
    --cc=jasowang@redhat.com \
    --cc=kuniyu@amazon.com \
    --cc=minhquangbui99@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=romieu@fr.zoreil.com \
    --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;
as well as URLs for NNTP newsgroup(s).