Re: Sharing UMEM without XDP_SHARED_UMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 5 Dec 2024 at 15:00, Richard Patel <ripatel@xxxxxxx> wrote:
>
> Hello,
>
> Is it safe to share the same virtual memory region as UMEM between two zero-copy XSKs without setting XDP_SHARED_UMEM?
> The XSKs do not share the same (dev, queue) pair. They are backed by separate receive queues and have separate fill and completion rings.

It is safe to share a umem by just registering the same umem region
for each socket. This was the method before XDP_SHARED_UMEM. The
drawback is that it consumes more memory as the xsk code in the kernel
does not understand that it is indeed shared and structures could be
shared too.

> I have an application receiving and sending packets via two such XSKs on the same thread.
> I’d like to reuse buffers across both XSKs while ensuring each chunk is only submitted to one of the fill or TX rings.
>
> In principle, this seems safe but undocumented.
> If queue IDs or devices between two XSKs differ, the only notable difference in behavior when setting XDP_SHARED_UMEM is that xp_assign_dev_shared is called instead of xp_assign_dev. However, xdp_assign_dev_shared only copies XSK flags and then tail calls to xp_assign_dev.
>
> Is there any special behaviour introduced by XDP_SHARED_UMEM in this case that I’m missing?
> (Perhaps something to do with ref counting of memory pinning, or support for simultaneous DMAs from different devices into the same page?)
> And is it possible that future changes to the kernel AF_XDP code or kernel drivers might break such operation without XDP_SHARED_UMEM?
>
> Thanks
> Richard





[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux