From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
netdev@vger.kernel.org, bpf@vger.kernel.org, davem@davemloft.net,
kuba@kernel.org, ilias.apalodimas@linaro.org
Subject: Re: [PATCH net-next 2/4] net: page_pool: add bulk support for ptr_ring
Date: Thu, 29 Oct 2020 11:31:48 +0100 [thread overview]
Message-ID: <20201029103148.GA15697@lore-desk> (raw)
In-Reply-To: <20201029111329.79b86c00@carbon>
[-- Attachment #1: Type: text/plain, Size: 2386 bytes --]
> On Tue, 27 Oct 2020 20:04:08 +0100
> Lorenzo Bianconi <lorenzo@kernel.org> wrote:
>
> > +void page_pool_put_page_bulk(struct page_pool *pool, void **data,
> > + int count)
> > +{
> > + struct page *page_ring[XDP_BULK_QUEUE_SIZE];
>
> Maybe we could reuse the 'data' array instead of creating a new array
> (2 cache-lines long) for the array of pages?
I agree, I will try to reuse the data array for that
>
> > + int i, len = 0;
> > +
> > + for (i = 0; i < count; i++) {
> > + struct page *page = virt_to_head_page(data[i]);
> > +
> > + if (unlikely(page_ref_count(page) != 1 ||
> > + !pool_page_reusable(pool, page))) {
> > + page_pool_release_page(pool, page);
> > + put_page(page);
> > + continue;
> > + }
> > +
> > + if (pool->p.flags & PP_FLAG_DMA_SYNC_DEV)
> > + page_pool_dma_sync_for_device(pool, page, -1);
>
> Here we sync the entire DMA area (-1), which have a *huge* cost for
> mvneta (especially on EspressoBin HW). For this xdp_frame->len is
> unfortunately not enough. We will need the *maximum* length touch by
> (1) CPU and (2) remote device DMA engine. DMA-TX completion knows the
> length for (2). The CPU length (1) is max of original xdp_buff size
> and xdp_frame->len, because BPF-helpers could have shrinked the size.
> (tricky part is that xdp_frame->len isn't correct in-case of header
> adjustments, thus like mvneta_run_xdp we to calc dma_sync size, and
> store this in xdp_frame, maybe via param to xdp_do_redirect). Well, not
> sure if it is too much work to transfer this info, for this use-case.
I was thinking about that but I guess point (1) is tricky since "cpu length"
can be changed even in the middle by devmaps or cpumaps (not just in the driver
rx napi loop). I guess we can try to address this point in a subsequent series.
Agree?
Regards,
Lorenzo
>
> > +
> > + page_ring[len++] = page;
>
> > + }
> > +
> > + page_pool_ring_lock(pool);
> > + for (i = 0; i < len; i++) {
> > + if (__ptr_ring_produce(&pool->ring, page_ring[i]))
> > + page_pool_return_page(pool, page_ring[i]);
> > + }
> > + page_pool_ring_unlock(pool);
> > +}
> > +EXPORT_SYMBOL(page_pool_put_page_bulk);
>
>
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2020-10-29 10:32 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 19:04 [PATCH net-next 0/4] xdp: introduce bulking for page_pool tx return path Lorenzo Bianconi
2020-10-27 19:04 ` [PATCH net-next 1/4] net: xdp: introduce bulking for xdp " Lorenzo Bianconi
2020-10-28 9:27 ` Ilias Apalodimas
2020-10-28 10:23 ` Lorenzo Bianconi
2020-10-28 10:59 ` Ilias Apalodimas
2020-10-28 11:28 ` Lorenzo Bianconi
2020-10-28 11:34 ` Jesper Dangaard Brouer
2020-10-28 11:43 ` Lorenzo Bianconi
2020-10-29 13:52 ` Jesper Dangaard Brouer
2020-10-29 14:02 ` Lorenzo Bianconi
2020-10-29 14:08 ` Ilias Apalodimas
2020-10-27 19:04 ` [PATCH net-next 2/4] net: page_pool: add bulk support for ptr_ring Lorenzo Bianconi
2020-10-29 7:08 ` Ilias Apalodimas
2020-10-29 10:36 ` Lorenzo Bianconi
2020-10-29 7:25 ` Ilias Apalodimas
2020-10-29 10:37 ` Lorenzo Bianconi
2020-10-29 10:13 ` Jesper Dangaard Brouer
2020-10-29 10:31 ` Lorenzo Bianconi [this message]
2020-10-29 13:40 ` Jesper Dangaard Brouer
2020-10-27 19:04 ` [PATCH net-next 3/4] net: mvpp2: add xdp tx return bulking support Lorenzo Bianconi
2020-10-27 19:04 ` [PATCH net-next 4/4] net: mlx5: " Lorenzo Bianconi
2020-10-29 11:42 ` Shay Agroskin
2020-10-29 13:15 ` Lorenzo Bianconi
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=20201029103148.GA15697@lore-desk \
--to=lorenzo.bianconi@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=ilias.apalodimas@linaro.org \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
/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).