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: <CAHS8izM4yJGat4BrKDQW8cV83vxa0ZS5n5zX-o64Rh0PnETTDg@mail.gmail.com>
Date: Mon, 6 Jan 2025 13:05:37 -0800
From: Mina Almasry <almasrymina@...gle.com>
To: David Wei <dw@...idwei.uk>
Cc: io-uring@...r.kernel.org, netdev@...r.kernel.org, 
	Jens Axboe <axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, 
	"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jesper Dangaard Brouer <hawk@...nel.org>, David Ahern <dsahern@...nel.org>, 
	Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>, 
	Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v9 03/20] net: generalise net_iov chunk owners

On Tue, Dec 17, 2024 at 4:37 PM David Wei <dw@...idwei.uk> wrote:
>
> From: Pavel Begunkov <asml.silence@...il.com>
>
> Currently net_iov stores a pointer to struct dmabuf_genpool_chunk_owner,
> which serves as a useful abstraction to share data and provide a
> context. However, it's too devmem specific, and we want to reuse it for
> other memory providers, and for that we need to decouple net_iov from
> devmem. Make net_iov to point to a new base structure called
> net_iov_area, which dmabuf_genpool_chunk_owner extends.
>
> Reviewed-by: Mina Almasry <almasrymina@...gle.com>
> Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
> Signed-off-by: David Wei <dw@...idwei.uk>
> ---
>  include/net/netmem.h | 21 ++++++++++++++++++++-
>  net/core/devmem.c    | 25 +++++++++++++------------
>  net/core/devmem.h    | 25 +++++++++----------------
>  3 files changed, 42 insertions(+), 29 deletions(-)
>
> diff --git a/include/net/netmem.h b/include/net/netmem.h
> index 1b58faa4f20f..c61d5b21e7b4 100644
> --- a/include/net/netmem.h
> +++ b/include/net/netmem.h
> @@ -24,11 +24,20 @@ struct net_iov {
>         unsigned long __unused_padding;
>         unsigned long pp_magic;
>         struct page_pool *pp;
> -       struct dmabuf_genpool_chunk_owner *owner;
> +       struct net_iov_area *owner;
>         unsigned long dma_addr;
>         atomic_long_t pp_ref_count;
>  };
>
> +struct net_iov_area {
> +       /* Array of net_iovs for this area. */
> +       struct net_iov *niovs;
> +       size_t num_niovs;
> +
> +       /* Offset into the dma-buf where this chunk starts.  */

Probably could use a rewriting of the comment. I think net_iov_area is
meant to be a memory-type agnostic struct, so it shouldn't refer to
dma-bufs here.

But on second thought I'm not sure base_virtual belongs in the common
struct because i'm not sure yet how it applies to other memory
providers. for dmabuf, each 'chunk' is physically and virtually
contiguous, and the virtual address is well-defined to be the offset
in bytes into the dmabuf, but that is very dmabuf specific.

Consider keeping this in dmabuf_genpool_chunk_owner if we don't plan
to use this same field with the same semantics for other memory
providers, or re-write the comment.

-- 
Thanks,
Mina

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ