Re: [PATCH bpf-next v4] bpf, test_run: fix &xdp_frame misplacement for LIVE_FRAMES

From: Martin KaFai Lau
Date: Fri Feb 17 2023 - 15:32:47 EST


On 2/15/23 10:54 AM, Alexander Lobakin wrote:
+#if BITS_PER_LONG == 64 && PAGE_SIZE == SZ_4K
+/* tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c:%MAX_PKT_SIZE
+ * must be updated accordingly when any of these changes, otherwise BPF
+ * selftests will fail.
+ */
+#ifdef __s390x__
+#define TEST_MAX_PKT_SIZE 3216
+#else
+#define TEST_MAX_PKT_SIZE 3408

I have to revert this patch for now. It is not right to assume cache line size:
https://lore.kernel.org/bpf/50c35055-afa9-d01e-9a05-ea5351280e4f@xxxxxxxxx/

Please resubmit and consider if this static_assert is really needed in the kernel test_run.c.

+#endif
+static_assert(SKB_WITH_OVERHEAD(TEST_XDP_FRAME_SIZE - XDP_PACKET_HEADROOM) ==
+ TEST_MAX_PKT_SIZE);
+#endif