From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
netdev@vger.kernel.org, "Eugenio Pérez" <eperezma@redhat.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"John Fastabend" <john.fastabend@gmail.com>,
"Stanislav Fomichev" <sdf@fomichev.me>,
virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, "Bui Quang Minh" <minhquangbui99@gmail.com>
Subject: Re: [PATCH net 1/3] virtio-net: make refill work a per receive queue work
Date: Fri, 26 Dec 2025 02:37:40 -0500 [thread overview]
Message-ID: <20251226022727-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CACGkMEt33BAWGmeFfHWYrjQLOT4+JB7HsWWVMKUn6yFxQ9y2gg@mail.gmail.com>
On Fri, Dec 26, 2025 at 09:31:26AM +0800, Jason Wang wrote:
> On Fri, Dec 26, 2025 at 12:27 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Thu, Dec 25, 2025 at 03:33:29PM +0800, Jason Wang wrote:
> > > On Wed, Dec 24, 2025 at 9:48 AM Michael S. Tsirkin <mst@redhat.com> wrote:
> > > >
> > > > On Wed, Dec 24, 2025 at 09:37:14AM +0800, Xuan Zhuo wrote:
> > > > >
> > > > > Hi Jason,
> > > > >
> > > > > I'm wondering why we even need this refill work. Why not simply let NAPI retry
> > > > > the refill on its next run if the refill fails? That would seem much simpler.
> > > > > This refill work complicates maintenance and often introduces a lot of
> > > > > concurrency issues and races.
> > > > >
> > > > > Thanks.
> > > >
> > > > refill work can refill from GFP_KERNEL, napi only from ATOMIC.
> > > >
> > > > And if GFP_ATOMIC failed, aggressively retrying might not be a great idea.
> > >
> > > Btw, I see some drivers are doing things as Xuan said. E.g
> > > mlx5e_napi_poll() did:
> > >
> > > busy |= INDIRECT_CALL_2(rq->post_wqes,
> > > mlx5e_post_rx_mpwqes,
> > > mlx5e_post_rx_wqes,
> > >
> > > ...
> > >
> > > if (busy) {
> > > if (likely(mlx5e_channel_no_affinity_change(c))) {
> > > work_done = budget;
> > > goto out;
> > > ...
> >
> >
> > is busy a GFP_ATOMIC allocation failure?
>
> Yes, and I think the logic here is to fallback to ksoftirqd if the
> allocation fails too much.
>
> Thanks
True. I just don't know if this works better or worse than the
current design, but it is certainly simpler and we never actually
worried about the performance of the current one.
So you know, let's roll with this approach.
I do however ask that some testing is done on the patch forcing these OOM
situations just to see if we are missing something obvious.
the beauty is the patch can be very small:
1. patch 1 do not schedule refill ever, just retrigger napi
2. remove all the now dead code
this way patch 1 will be small and backportable to stable.
> >
> > > >
> > > > Not saying refill work is a great hack, but that is the reason for it.
> > > > --
> > > > MST
> > > >
> > >
> > > Thanks
> >
next prev parent reply other threads:[~2025-12-26 7:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 15:25 [PATCH net 0/3] virtio-net: fix the deadlock when disabling rx NAPI Bui Quang Minh
2025-12-23 15:25 ` [PATCH net 1/3] virtio-net: make refill work a per receive queue work Bui Quang Minh
2025-12-24 0:52 ` Jason Wang
2025-12-24 1:37 ` Xuan Zhuo
2025-12-24 1:47 ` Michael S. Tsirkin
2025-12-24 16:49 ` Bui Quang Minh
2025-12-25 15:55 ` Bui Quang Minh
2025-12-25 16:27 ` Michael S. Tsirkin
2025-12-25 7:33 ` Jason Wang
2025-12-25 16:27 ` Michael S. Tsirkin
2025-12-26 1:31 ` Jason Wang
2025-12-26 7:37 ` Michael S. Tsirkin [this message]
2025-12-29 2:57 ` Jason Wang
2025-12-30 16:28 ` Bui Quang Minh
2025-12-30 16:44 ` Michael S. Tsirkin
2025-12-24 16:43 ` Bui Quang Minh
2025-12-24 1:34 ` Michael S. Tsirkin
2025-12-24 10:19 ` Michael S. Tsirkin
2025-12-24 17:03 ` Bui Quang Minh
2025-12-23 15:25 ` [PATCH net 2/3] virtio-net: ensure rx NAPI is enabled before enabling refill work Bui Quang Minh
2025-12-24 1:45 ` Michael S. Tsirkin
2025-12-24 17:49 ` Bui Quang Minh
2025-12-24 10:20 ` Michael S. Tsirkin
2025-12-23 15:25 ` [PATCH net 3/3] virtio-net: schedule the pending refill work after being enabled Bui Quang Minh
2025-12-24 10:17 ` 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=20251226022727-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minhquangbui99@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--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).