lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250528060744.GF9346@system.software.com>
Date: Wed, 28 May 2025 15:07:44 +0900
From: Byungchul Park <byungchul@...com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: willy@...radead.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	kernel_team@...ynix.com, kuba@...nel.org,
	ilias.apalodimas@...aro.org, harry.yoo@...cle.com, hawk@...nel.org,
	akpm@...ux-foundation.org, davem@...emloft.net,
	john.fastabend@...il.com, andrew+netdev@...n.ch,
	asml.silence@...il.com, toke@...hat.com, tariqt@...dia.com,
	edumazet@...gle.com, pabeni@...hat.com, saeedm@...dia.com,
	leon@...nel.org, ast@...nel.org, daniel@...earbox.net,
	david@...hat.com, lorenzo.stoakes@...cle.com,
	Liam.Howlett@...cle.com, vbabka@...e.cz, rppt@...nel.org,
	surenb@...gle.com, mhocko@...e.com, horms@...nel.org,
	linux-rdma@...r.kernel.org, bpf@...r.kernel.org,
	vishal.moola@...il.com
Subject: Re: [PATCH v2 16/16] mt76: use netmem descriptor and APIs for page
 pool

On Tue, May 27, 2025 at 08:32:55PM -0700, Mina Almasry wrote:
> On Tue, May 27, 2025 at 7:29 PM Byungchul Park <byungchul@...com> wrote:
> >
> > To simplify struct page, the effort to separate its own descriptor from
> > struct page is required and the work for page pool is on going.
> >
> > Use netmem descriptor and APIs for page pool in mt76 code.
> >
> > Signed-off-by: Byungchul Park <byungchul@...com>
> 
> This patch looks fine to me... but this is converting 1 driver to
> netmem. There are hundreds of other drivers in the tree. Are we
> converting all of them to netmem...?
> 
> The motivating reason for existing drivers to use netmem is because
> it's an abstract memory type that lets the driver support dma-buf
> memory and io_uring memory:
> 
> https://www.kernel.org/doc/Documentation/networking/netmem.rst
> 
> This driver does not use the page_pool, doesn't support dma-buf
> memory, or io_uring memory. Moving it to netmem I think will add
> overhead due to the netmem_is_net_iov checks while providing no
> tangible benefit AFAICT. Is your long term plan to convert all drivers
> to netmem? That maybe thousands of lines of code that need to be
> touched :(
> 
> > ---
> >  drivers/net/wireless/mediatek/mt76/dma.c      |  6 ++---
> >  drivers/net/wireless/mediatek/mt76/mt76.h     | 12 +++++-----
> >  .../net/wireless/mediatek/mt76/sdio_txrx.c    | 24 +++++++++----------
> >  drivers/net/wireless/mediatek/mt76/usb.c      | 10 ++++----
> >  4 files changed, 26 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
> > index 35b4ec91979e..cceff435ec4a 100644
> > --- a/drivers/net/wireless/mediatek/mt76/dma.c
> > +++ b/drivers/net/wireless/mediatek/mt76/dma.c
> > @@ -820,10 +820,10 @@ mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data,
> >         int nr_frags = shinfo->nr_frags;
> >
> >         if (nr_frags < ARRAY_SIZE(shinfo->frags)) {
> > -               struct page *page = virt_to_head_page(data);
> > -               int offset = data - page_address(page) + q->buf_offset;
> > +               netmem_ref netmem = netmem_compound_head(virt_to_netmem(data));
> 
> It may be worth adding virt_to_head_netmem helper instead of doing
> these 2 calls together everywhere.

Sounds good.  I will.

	Byungchul
> 
> -- 
> Thanks,
> Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ