public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Vishwanath Seshagiri <vishs@meta.com>
Cc: "Michael S . Tsirkin" <mst@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 15:35:23 +0800	[thread overview]
Message-ID: <CACGkMEtBhTtzjxaUnN_3+gHUUq0v9C0f38OJ52HAz9WhoAnWrg@mail.gmail.com> (raw)
In-Reply-To: <130cf9d5-79fd-4d12-ae3e-3cafebde02ce@meta.com>

On Sat, Mar 14, 2026 at 12:51 AM Vishwanath Seshagiri <vishs@meta.com> wrote:
>
>
>
> On 3/13/26 1:21 PM, Jason Wang wrote:
> >> -static void put_xdp_frags(struct xdp_buff *xdp)
> >> +static void put_xdp_frags(struct receive_queue *rq, struct xdp_buff *xdp)
> >>   {
> >>          struct skb_shared_info *shinfo;
> >>          struct page *xdp_page;
> >> @@ -1781,7 +1660,7 @@ static void put_xdp_frags(struct xdp_buff *xdp)
> >>                  shinfo = xdp_get_shared_info_from_buff(xdp);
> >>                  for (i = 0; i < shinfo->nr_frags; i++) {
> >>                          xdp_page = skb_frag_page(&shinfo->frags[i]);
> >> -                       put_page(xdp_page);
> >> +                       page_pool_put_page(rq->page_pool, xdp_page, -1, true);
> >>                  }
> >>          }
> >>   }
> >> @@ -1873,7 +1752,7 @@ static struct page *xdp_linearize_page(struct net_device *dev,
> >>          if (page_off + *len + tailroom > PAGE_SIZE)
> >>                  return NULL;
> >>
> >> -       page = alloc_page(GFP_ATOMIC);
> >> +       page = page_pool_alloc_pages(rq->page_pool, GFP_ATOMIC);
> >>          if (!page)
> >>                  return NULL;
> >>
> >> @@ -1896,8 +1775,12 @@ static struct page *xdp_linearize_page(struct net_device *dev,
> >>                  p = virt_to_head_page(buf);
> >>                  off = buf - page_address(p);
> >>
> >> +               if (rq->use_page_pool_dma)
> >> +                       page_pool_dma_sync_for_cpu(rq->page_pool, p,
> >> +                                                  off, buflen);
> >
> > Intresting, I think we need a patch for -stable to sync for cpu as
> > well (and probably the XDP_TX path).
>
> In the old code, I believed the sync was handled implicitly inside
> virtnet_rq_get_buf() -> virtnet_rq_unmap() before data was accessed.
> Could you point me at the specific path you're concerned about for
> -stable? I want to make sure I understand the issue correctly before
> sending a fix.

You're right; the code seems fine.

(Note that, when big_packets is true but small is used, we will go
virtqueue_get_buf(), so the unamp is done via deatch_buf().

>
> >
> >
> >> +
> >>                  if (check_mergeable_len(dev, ctx, buflen)) {
> >> -                       put_page(p);
> >> +                       page_pool_put_page(rq->page_pool, p, -1, true);
> >>                          goto err_buf;
> >>                  }
>
> Sorry for missing that comment in the earlier email

No worries.

Thanks

>


  reply	other threads:[~2026-03-16  7:35 UTC|newest]

Thread overview: 21+ 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 [this message]
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
2026-03-17  2:30 ` patchwork-bot+netdevbpf
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=CACGkMEtBhTtzjxaUnN_3+gHUUq0v9C0f38OJ52HAz9WhoAnWrg@mail.gmail.com \
    --to=jasowang@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=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox