($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
* [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
@ 2026-06-23  9:10 Maciej Fijalkowski
  2026-06-24  3:47 ` Vyavahare, Tushar
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Maciej Fijalkowski @ 2026-06-23  9:10 UTC (permalink / raw)
  To: netdev
  Cc: bpf, magnus.karlsson, stfomichev, kuba, pabeni, horms,
	tushar.vyavahare, kerneljasonxing, Maciej Fijalkowski

The UMEM state refactor made __send_pkts() use xsk->umem for Tx
address generation. At the same time, the shared-UMEM Tx setup copies the
Rx UMEM state into a Tx-local state object and resets base_addr and
next_buffer before configuring the Tx socket.

Passing that Tx-local object to xsk_configure() makes xsk->umem point to
the zero-based Tx allocator state. This breaks the BIDIRECTIONAL test once
the roles are switched: the same socket is then used for Rx validation, but
received descriptors from the other logical UMEM half are checked against
base_addr == 0. With the new UMEM bounds check, a valid address such as
base_addr + XDP_PACKET_HEADROOM is rejected as being outside the UMEM
window.

Keep xsk->umem as the shared/Rx UMEM view used for socket configuration
and Rx validation. Use the ifobject-local UMEM copy only for Tx descriptor
address generation, preserving the BIDIRECTIONAL test's intent of using
the proper logical UMEM half after the direction switch.

Fixes: b17631032769 ("selftests/xsk: Move UMEM state from ifobject to xsk_socket_info")
Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com
---
 tools/testing/selftests/bpf/prog_tests/test_xsk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
index d8a1c0d40e5a..50a8dbacb63d 100644
--- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
+++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
@@ -1169,8 +1169,8 @@ static int receive_pkts(struct test_spec *test)
 static int __send_pkts(struct ifobject *ifobject, struct xsk_socket_info *xsk, bool timeout)
 {
 	u32 i, idx = 0, valid_pkts = 0, valid_frags = 0, buffer_len;
+	struct xsk_umem_info *umem = ifobject->xsk_arr[0].umem_real;
 	struct pkt_stream *pkt_stream = xsk->pkt_stream;
-	struct xsk_umem_info *umem = xsk->umem;
 	bool use_poll = ifobject->use_poll;
 	struct pollfd fds = { };
 	int ret;
@@ -1524,7 +1524,7 @@ static int thread_common_ops_tx(struct test_spec *test, struct ifobject *ifobjec
 	umem_tx->base_addr = 0;
 	umem_tx->next_buffer = 0;
 
-	ret = xsk_configure(test, ifobject, umem_tx, true);
+	ret = xsk_configure(test, ifobject, umem_rx, true);
 	if (ret)
 		return ret;
 	ifobject->xsk = &ifobject->xsk_arr[0];
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-23  9:10 [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test Maciej Fijalkowski
@ 2026-06-24  3:47 ` Vyavahare, Tushar
  2026-06-25  2:33 ` Jakub Kicinski
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Vyavahare, Tushar @ 2026-06-24  3:47 UTC (permalink / raw)
  To: Fijalkowski, Maciej, netdev@vger.kernel.org
  Cc: bpf@vger.kernel.org, Karlsson, Magnus, stfomichev@gmail.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	kerneljasonxing@gmail.com



> -----Original Message-----
> From: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> Sent: Tuesday, June 23, 2026 2:40 PM
> To: netdev@vger.kernel.org
> Cc: bpf@vger.kernel.org; Karlsson, Magnus <magnus.karlsson@intel.com>;
> stfomichev@gmail.com; kuba@kernel.org; pabeni@redhat.com;
> horms@kernel.org; Vyavahare, Tushar <tushar.vyavahare@intel.com>;
> kerneljasonxing@gmail.com; Fijalkowski, Maciej
> <maciej.fijalkowski@intel.com>
> Subject: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
> 
> The UMEM state refactor made __send_pkts() use xsk->umem for Tx address
> generation. At the same time, the shared-UMEM Tx setup copies the Rx
> UMEM state into a Tx-local state object and resets base_addr and next_buffer
> before configuring the Tx socket.
> 
> Passing that Tx-local object to xsk_configure() makes xsk->umem point to the
> zero-based Tx allocator state. This breaks the BIDIRECTIONAL test once the
> roles are switched: the same socket is then used for Rx validation, but received
> descriptors from the other logical UMEM half are checked against base_addr
> == 0. With the new UMEM bounds check, a valid address such as base_addr +
> XDP_PACKET_HEADROOM is rejected as being outside the UMEM window.
> 
> Keep xsk->umem as the shared/Rx UMEM view used for socket configuration
> and Rx validation. Use the ifobject-local UMEM copy only for Tx descriptor
> address generation, preserving the BIDIRECTIONAL test's intent of using the
> proper logical UMEM half after the direction switch.
> 
> Fixes: b17631032769 ("selftests/xsk: Move UMEM state from ifobject to
> xsk_socket_info")
> Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com

Reviewed-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
Tested-by: Tushar Vyavahare <tushar.vyavahare@intel.com>

> ---
>  tools/testing/selftests/bpf/prog_tests/test_xsk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> index d8a1c0d40e5a..50a8dbacb63d 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> @@ -1169,8 +1169,8 @@ static int receive_pkts(struct test_spec *test)  static
> int __send_pkts(struct ifobject *ifobject, struct xsk_socket_info *xsk, bool
> timeout)  {
>  	u32 i, idx = 0, valid_pkts = 0, valid_frags = 0, buffer_len;
> +	struct xsk_umem_info *umem = ifobject->xsk_arr[0].umem_real;
>  	struct pkt_stream *pkt_stream = xsk->pkt_stream;
> -	struct xsk_umem_info *umem = xsk->umem;
>  	bool use_poll = ifobject->use_poll;
>  	struct pollfd fds = { };
>  	int ret;
> @@ -1524,7 +1524,7 @@ static int thread_common_ops_tx(struct test_spec
> *test, struct ifobject *ifobjec
>  	umem_tx->base_addr = 0;
>  	umem_tx->next_buffer = 0;
> 
> -	ret = xsk_configure(test, ifobject, umem_tx, true);
> +	ret = xsk_configure(test, ifobject, umem_rx, true);
>  	if (ret)
>  		return ret;
>  	ifobject->xsk = &ifobject->xsk_arr[0];
> --
> 2.43.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-23  9:10 [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test Maciej Fijalkowski
  2026-06-24  3:47 ` Vyavahare, Tushar
@ 2026-06-25  2:33 ` Jakub Kicinski
  2026-06-25 10:35   ` Maciej Fijalkowski
  2026-06-25 13:38 ` Jason Xing
  2026-06-25 14:47 ` Jakub Sitnicki
  3 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2026-06-25  2:33 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Tue, 23 Jun 2026 11:10:08 +0200 Maciej Fijalkowski wrote:
> Subject: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test

Do you want it in net? Either way - we'll need a rebase

> Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com

missing <> around the email 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-25  2:33 ` Jakub Kicinski
@ 2026-06-25 10:35   ` Maciej Fijalkowski
  2026-06-25 14:36     ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Fijalkowski @ 2026-06-25 10:35 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Wed, Jun 24, 2026 at 07:33:26PM -0700, Jakub Kicinski wrote:
> On Tue, 23 Jun 2026 11:10:08 +0200 Maciej Fijalkowski wrote:
> > Subject: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
> 
> Do you want it in net? Either way - we'll need a rebase

I have not checked if this has been -net propagated already, but the rule
of thumb on bpf side was that all selftests related effort goes to -next.
Is it different on netdev side?

> 
> > Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com
> 
> missing <> around the email 

oof.

> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-23  9:10 [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test Maciej Fijalkowski
  2026-06-24  3:47 ` Vyavahare, Tushar
  2026-06-25  2:33 ` Jakub Kicinski
@ 2026-06-25 13:38 ` Jason Xing
  2026-06-25 14:47 ` Jakub Sitnicki
  3 siblings, 0 replies; 9+ messages in thread
From: Jason Xing @ 2026-06-25 13:38 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, kuba, pabeni, horms,
	tushar.vyavahare

On Tue, Jun 23, 2026 at 5:10 PM Maciej Fijalkowski
<maciej.fijalkowski@intel.com> wrote:
>
> The UMEM state refactor made __send_pkts() use xsk->umem for Tx
> address generation. At the same time, the shared-UMEM Tx setup copies the
> Rx UMEM state into a Tx-local state object and resets base_addr and
> next_buffer before configuring the Tx socket.
>
> Passing that Tx-local object to xsk_configure() makes xsk->umem point to
> the zero-based Tx allocator state. This breaks the BIDIRECTIONAL test once
> the roles are switched: the same socket is then used for Rx validation, but
> received descriptors from the other logical UMEM half are checked against
> base_addr == 0. With the new UMEM bounds check, a valid address such as
> base_addr + XDP_PACKET_HEADROOM is rejected as being outside the UMEM
> window.
>
> Keep xsk->umem as the shared/Rx UMEM view used for socket configuration
> and Rx validation. Use the ifobject-local UMEM copy only for Tx descriptor
> address generation, preserving the BIDIRECTIONAL test's intent of using
> the proper logical UMEM half after the direction switch.
>
> Fixes: b17631032769 ("selftests/xsk: Move UMEM state from ifobject to xsk_socket_info")
> Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com

Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-25 10:35   ` Maciej Fijalkowski
@ 2026-06-25 14:36     ` Jakub Kicinski
  2026-06-25 15:21       ` Maciej Fijalkowski
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2026-06-25 14:36 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Thu, 25 Jun 2026 12:35:12 +0200 Maciej Fijalkowski wrote:
> On Wed, Jun 24, 2026 at 07:33:26PM -0700, Jakub Kicinski wrote:
> > On Tue, 23 Jun 2026 11:10:08 +0200 Maciej Fijalkowski wrote:  
> > > Subject: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test  
> > 
> > Do you want it in net? Either way - we'll need a rebase  
> 
> I have not checked if this has been -net propagated already, but the rule
> of thumb on bpf side was that all selftests related effort goes to -next.
> Is it different on netdev side?

We prefer -next too, but during the merge window net-next is closed.

What we definitely don't want is a -next patch with a Fixes tag.
So either net or drop the tag, please.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-23  9:10 [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test Maciej Fijalkowski
                   ` (2 preceding siblings ...)
  2026-06-25 13:38 ` Jason Xing
@ 2026-06-25 14:47 ` Jakub Sitnicki
  3 siblings, 0 replies; 9+ messages in thread
From: Jakub Sitnicki @ 2026-06-25 14:47 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, kuba, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Tue, Jun 23, 2026 at 11:10 AM +02, Maciej Fijalkowski wrote:
> The UMEM state refactor made __send_pkts() use xsk->umem for Tx
> address generation. At the same time, the shared-UMEM Tx setup copies the
> Rx UMEM state into a Tx-local state object and resets base_addr and
> next_buffer before configuring the Tx socket.
>
> Passing that Tx-local object to xsk_configure() makes xsk->umem point to
> the zero-based Tx allocator state. This breaks the BIDIRECTIONAL test once
> the roles are switched: the same socket is then used for Rx validation, but
> received descriptors from the other logical UMEM half are checked against
> base_addr == 0. With the new UMEM bounds check, a valid address such as
> base_addr + XDP_PACKET_HEADROOM is rejected as being outside the UMEM
> window.
>
> Keep xsk->umem as the shared/Rx UMEM view used for socket configuration
> and Rx validation. Use the ifobject-local UMEM copy only for Tx descriptor
> address generation, preserving the BIDIRECTIONAL test's intent of using
> the proper logical UMEM half after the direction switch.
>
> Fixes: b17631032769 ("selftests/xsk: Move UMEM state from ifobject to xsk_socket_info")
> Signed-off-by: Maciej Fijalkowski maciej.fijalkowski@intel.com
> ---
>  tools/testing/selftests/bpf/prog_tests/test_xsk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> index d8a1c0d40e5a..50a8dbacb63d 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> @@ -1169,8 +1169,8 @@ static int receive_pkts(struct test_spec *test)
>  static int __send_pkts(struct ifobject *ifobject, struct xsk_socket_info *xsk, bool timeout)
>  {
>  	u32 i, idx = 0, valid_pkts = 0, valid_frags = 0, buffer_len;
> +	struct xsk_umem_info *umem = ifobject->xsk_arr[0].umem_real;
>  	struct pkt_stream *pkt_stream = xsk->pkt_stream;
> -	struct xsk_umem_info *umem = xsk->umem;
>  	bool use_poll = ifobject->use_poll;
>  	struct pollfd fds = { };
>  	int ret;

IIUC, this works because umem_real happens to point at shared/Tx UMEM
view (base_addr=0).

> @@ -1524,7 +1524,7 @@ static int thread_common_ops_tx(struct test_spec *test, struct ifobject *ifobjec
>  	umem_tx->base_addr = 0;
>  	umem_tx->next_buffer = 0;
>  
> -	ret = xsk_configure(test, ifobject, umem_tx, true);
> +	ret = xsk_configure(test, ifobject, umem_rx, true);
>  	if (ret)
>  		return ret;
>  	ifobject->xsk = &ifobject->xsk_arr[0];

And this bit works because thread_common_ops_tx is only invoked in
shared test case.

Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-25 14:36     ` Jakub Kicinski
@ 2026-06-25 15:21       ` Maciej Fijalkowski
  2026-06-25 15:29         ` Jakub Kicinski
  0 siblings, 1 reply; 9+ messages in thread
From: Maciej Fijalkowski @ 2026-06-25 15:21 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Thu, Jun 25, 2026 at 07:36:36AM -0700, Jakub Kicinski wrote:
> On Thu, 25 Jun 2026 12:35:12 +0200 Maciej Fijalkowski wrote:
> > On Wed, Jun 24, 2026 at 07:33:26PM -0700, Jakub Kicinski wrote:
> > > On Tue, 23 Jun 2026 11:10:08 +0200 Maciej Fijalkowski wrote:  
> > > > Subject: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test  
> > > 
> > > Do you want it in net? Either way - we'll need a rebase  
> > 
> > I have not checked if this has been -net propagated already, but the rule
> > of thumb on bpf side was that all selftests related effort goes to -next.
> > Is it different on netdev side?
> 
> We prefer -next too, but during the merge window net-next is closed.
> 
> What we definitely don't want is a -next patch with a Fixes tag.
> So either net or drop the tag, please.

I have verified that offending commit is present in net tree. Could you
apply the v2 that I unfortunately sent already targeted at net-next, to
net tree?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test
  2026-06-25 15:21       ` Maciej Fijalkowski
@ 2026-06-25 15:29         ` Jakub Kicinski
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2026-06-25 15:29 UTC (permalink / raw)
  To: Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, stfomichev, pabeni, horms,
	tushar.vyavahare, kerneljasonxing

On Thu, 25 Jun 2026 17:21:31 +0200 Maciej Fijalkowski wrote:
> On Thu, Jun 25, 2026 at 07:36:36AM -0700, Jakub Kicinski wrote:
> > On Thu, 25 Jun 2026 12:35:12 +0200 Maciej Fijalkowski wrote:  
> > > On Wed, Jun 24, 2026 at 07:33:26PM -0700, Jakub Kicinski wrote:  
> > > I have not checked if this has been -net propagated already, but the rule
> > > of thumb on bpf side was that all selftests related effort goes to -next.
> > > Is it different on netdev side?  
> > 
> > We prefer -next too, but during the merge window net-next is closed.
> > 
> > What we definitely don't want is a -next patch with a Fixes tag.
> > So either net or drop the tag, please.  
> 
> I have verified that offending commit is present in net tree. Could you
> apply the v2 that I unfortunately sent already targeted at net-next, to
> net tree?

Will do. Hopefully it applies, cause net-next wasn't forwarded yet
so it doesn't include Tushar's patches.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-06-25 15:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23  9:10 [PATCH net-next] selftests/xsk: preserve UMEM view in bidi test Maciej Fijalkowski
2026-06-24  3:47 ` Vyavahare, Tushar
2026-06-25  2:33 ` Jakub Kicinski
2026-06-25 10:35   ` Maciej Fijalkowski
2026-06-25 14:36     ` Jakub Kicinski
2026-06-25 15:21       ` Maciej Fijalkowski
2026-06-25 15:29         ` Jakub Kicinski
2026-06-25 13:38 ` Jason Xing
2026-06-25 14:47 ` Jakub Sitnicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox