OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
@ 2026-11-06 14:54 Eva Kurchatova
  2026-11-06 14:57 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eva Kurchatova @ 2026-11-06 14:54 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Larysa Zaremba <larysa.zaremba@intel.com>

Referenced commit reduced the scope of the variable pkt, so now it has to
be reinitialized via pkt_stream_get_next_rx_pkt(), which also increments
some counters. When the packet is interrupted by the batch ending, pkt
stream therefore proceeds to the next packet, while xsk ring still contains
the previous one, this results in a pkt_nb mismatch.

Decrement the affected counters when packet is interrupted.

Fixes: 8913e653e9b8 ("selftests/xsk: Iterate over all the sockets in the receive pkts function")
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Link: https://lore.kernel.org/r/20260203155103.2305816-2-larysa.zaremba@intel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
(cherry picked from commit 42e41b2a0afa04ca49ee2725aadf90ccb058ed28)

Rebase note: applied to xskxceiver.c, which mainline split into
prog_tests/test_xsk.c in commit 3ab77f35a75e ("selftests/bpf:
test_xsk: Split xskxceiver"), missing here. The code is the same.

https://virtuozzo.atlassian.net/browse/VSTOR-153754
Feature: fix selftests

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 tools/testing/selftests/bpf/xskxceiver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index a4a0b4e2516c..04fda63b6350 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1260,6 +1260,8 @@ static int __receive_pkts(struct test_spec *test, struct xsk_socket_info *xsk)
 			xsk_ring_prod__cancel(&umem->fq, nb_frags);
 		}
 		frags_processed -= nb_frags;
+		pkt_stream_cancel(pkt_stream);
+		pkts_sent--;
 	}
 
 	if (ifobj->use_fill_ring)
-- 
2.56.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
  2026-11-06 14:54 [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet Eva Kurchatova
@ 2026-11-06 14:57 ` no-reply
  2026-11-12 17:34 ` Konstantin Khorenko
  2026-11-12 17:34 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2026-11-06 14:57 UTC (permalink / raw)
  To: khorenko, Eva Kurchatova; +Cc: devel

> From: Larysa Zaremba <larysa.zaremba@intel.com>
> 
> Referenced commit reduced the scope of the variable pkt, so now it has to
> be reinitialized via pkt_stream_get_next_rx_pkt(), which also increments
> some counters. When the packet is interrupted by the batch ending, pkt
> stream therefore proceeds to the next packet, while xsk ring still contains
> the previous one, this results in a pkt_nb mismatch.
> 
> Decrement the affected counters when packet is interrupted.
> 
> Fixes: 8913e653e9b8 ("selftests/xsk: Iterate over all the sockets in the receive pkts function")
> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
> Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
> Link: https://lore.kernel.org/r/20260203155103.2305816-2-larysa.zaremba@intel.com
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> (cherry picked from commit 42e41b2a0afa04ca49ee2725aadf90ccb058ed28)
> 
> Rebase note: applied to xskxceiver.c, which mainline split into
> prog_tests/test_xsk.c in commit 3ab77f35a75e ("selftests/bpf:
> test_xsk: Split xskxceiver"), missing here. The code is the same.
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-153754
> Feature: fix selftests
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261106145505.132348-1-eva.kurchatova@virtuozzo.com?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
  2026-11-06 14:54 [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet Eva Kurchatova
  2026-11-06 14:57 ` no-reply
@ 2026-11-12 17:34 ` Konstantin Khorenko
  2026-11-12 17:34 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 17:34 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

Applying with these fixes on my side:
- Rebase note: 3ab77f35a75e moved the code to test_xsk.c, the move
  to prog_tests/ is d1aec26fce25. The note now names both.

On Fri, 6 Nov 2026 16:54:56 +0200, Eva Kurchatova <eva.kurchatova@virtuozzo.com> wrote:
> Rebase note: applied to xskxceiver.c, which mainline split into
> prog_tests/test_xsk.c in commit 3ab77f35a75e ("selftests/bpf:
> test_xsk: Split xskxceiver"), missing here. The code is the same.

3ab77f35a75e created tools/testing/selftests/bpf/test_xsk.c. The file
went to prog_tests/ later, in d1aec26fce25 ("selftests/bpf: test_xsk:
Integrate test_xsk.c to test_progs framework"). The note now reads:

  Rebase note: applied to xskxceiver.c. Mainline moved this code to
  test_xsk.c in commit 3ab77f35a75e ("selftests/bpf: test_xsk: Split
  xskxceiver") and then to prog_tests/ in commit d1aec26fce25
  ("selftests/bpf: test_xsk: Integrate test_xsk.c to test_progs
  framework"). Neither is here. The code is the same.

Separate patches, not needed for this one; I created a task for
each:

1. 2233ef8bba81 ("selftests/bpf: test_xsk: Initialize bitmap before
   use"). send_pkts() and receive_pkts() in xskxceiver.c still use
   DECLARE_BITMAP() without bitmap_zero(). Stack garbage in the bitmap
   can make send_pkts() return before sending anything, even with one
   socket, and the test then fails on the rx timeout.
   https://virtuozzo.atlassian.net/browse/VSTOR-154851

2. 88af9fefed41 ("selftests/xsk: fix number of Tx frags in invalid
   packet"), the other patch of the same upstream series. It only
   matters for TOO_MANY_FRAGS in zero-copy mode with an odd
   xdp_zc_max_segs, so it is needed only if the suite runs on a NIC
   in ZC mode.
   https://virtuozzo.atlassian.net/browse/VSTOR-154852

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
  2026-11-06 14:54 [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet Eva Kurchatova
  2026-11-06 14:57 ` no-reply
  2026-11-12 17:34 ` Konstantin Khorenko
@ 2026-11-12 17:34 ` Konstantin Khorenko
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Khorenko @ 2026-11-12 17:34 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Fri, 06 Nov 2026 16:54:56 +0200, Eva Kurchatova wrote:
> ms/selftests/xsk: properly handle batch ending in the middle of a packet

Applied to branch-rh10-6.12.0-211.52.1.22.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.22.21.vz10, thanks!

[1/1] ms/selftests/xsk: properly handle batch ending in the middle of a packet
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/5426ce5b9b1f

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

end of thread, other threads:[~2026-11-12 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06 14:54 [Devel] [PATCH hci-8.1] ms/selftests/xsk: properly handle batch ending in the middle of a packet Eva Kurchatova
2026-11-06 14:57 ` no-reply
2026-11-12 17:34 ` Konstantin Khorenko
2026-11-12 17:34 ` Konstantin Khorenko

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