From: "Michael S. Tsirkin" <mst@redhat.com>
To: Vishwanath Seshagiri <vishs@meta.com>
Cc: "Jason Wang" <jasowang@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"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>, "David Wei" <dw@davidwei.uk>,
"Matteo Croce" <technoboy85@gmail.com>,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH net-next v11] virtio_net: add page_pool support for buffer allocation
Date: Mon, 16 Mar 2026 08:04:41 -0400 [thread overview]
Message-ID: <20260316080419-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <6d43dbbb-7d04-4442-8743-3963b61195cd@meta.com>
On Mon, Mar 16, 2026 at 05:27:57PM +0530, Vishwanath Seshagiri wrote:
> On 3/16/26 4:13 PM, Michael S. Tsirkin wrote:
> > On Mon, Mar 16, 2026 at 05:56:20AM -0400, Michael S. Tsirkin wrote:
> > > On Tue, Mar 10, 2026 at 11:31:04AM -0700, Vishwanath Seshagiri wrote:
> > > > @@ -5857,7 +5863,7 @@ static int virtnet_xsk_pool_enable(struct net_device *dev,
> > > > /* In big_packets mode, xdp cannot work, so there is no need to
> > > > * initialize xsk of rq.
> > > > */
> > > > - if (vi->big_packets && !vi->mergeable_rx_bufs)
> > > > + if (!vi->rq[qid].page_pool)
> > > > return -ENOENT;
> > > > if (qid >= vi->curr_queue_pairs)
> > >
> > >
> > >
> > > It seems that a qid that exceeds curr_queue_pairs would previously get
> > > -EINVAL and now gets -ENOENT.
> >
> > Or maybe this if (qid >= vi->curr_queue_pairs) is dead code?
> > I looked at it some more and I can't find a path where this
> > triggers.
> >
> > > Maybe reorder the checks:
> > >
> > > if (qid >= vi->curr_queue_pairs)
> > > return -EINVAL;
> > >
> > > /* In big_packets mode, xdp cannot work, so there is no need to
> > > * initialize xsk of rq.
> > > */
> > > if (!vi->rq[qid].page_pool)
> > > return -ENOENT;
> > >
> > >
> > > Alternatively I think we can completely drop this chunk: we already seem
> > > to init page_pull at all times except for big packets mode, so the
> > > current code is fine I think.
>
> Yes, I agree qid >= curr_queue_pairs appears to be dead code.
> xsk_reg_pool_at_qid() in the XSK core already validates
> queue_id < max(real_num_rx_queues, real_num_tx_queues) before
> ndo_bpf is called, and real_num_rx_queues == curr_queue_pairs is an
> invariant in virtio_net. Both paths hold rtnl_lock so no race is
> possible. That said, I'll adopt your suggested reorder for v12 to ensure
> vi->rq[qid] isn't accessed before a bounds check, even if the check
> is currently redundant.
I think we can just take this as-is, and do more cleanups on top.
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > >
> > >
> > > --
> > > MST
> >
next prev parent reply other threads:[~2026-03-16 12:04 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 18:31 [PATCH net-next v11] virtio_net: add page_pool support for buffer allocation Vishwanath Seshagiri
2026-03-13 7:51 ` Jason Wang
2026-03-13 9:26 ` Vishwanath Seshagiri
2026-03-16 7:41 ` Jason Wang
2026-03-13 16:50 ` Vishwanath Seshagiri
2026-03-16 7:35 ` Jason Wang
2026-03-16 9:56 ` Michael S. Tsirkin
2026-03-16 10:43 ` Michael S. Tsirkin
2026-03-16 11:57 ` Vishwanath Seshagiri
2026-03-16 12:04 ` Michael S. Tsirkin [this message]
2026-03-17 2:30 ` patchwork-bot+netdevbpf
2026-03-23 15:01 ` Omar Elghoul
2026-03-23 15:01 ` Omar Elghoul
2026-03-23 15:52 ` Michael S. Tsirkin
2026-03-23 16:54 ` Omar Elghoul
2026-03-23 17:10 ` Michael S. Tsirkin
2026-03-23 16:58 ` Michael S. Tsirkin
2026-03-23 17:09 ` Omar Elghoul
2026-03-23 17:50 ` Vishwanath Seshagiri
2026-03-23 23:37 ` Michael S. Tsirkin
2026-03-24 0:34 ` Jason Wang
2026-03-24 8:20 ` Aithal, Srikanth
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=20260316080419-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jasowang@redhat.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=technoboy85@gmail.com \
--cc=virtualization@lists.linux.dev \
--cc=vishs@meta.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.