From 9a621715150e5df454fa07c2ee6eeecfbd004cea Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 15 Mar 2023 09:51:51 +0100 Subject: [PATCH] 6.1-stable patches added patches: revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch --- ...p_frame-misplacement-for-live_frames.patch | 106 ++++++++++++++++++ queue-6.1/series | 1 + 2 files changed, 107 insertions(+) create mode 100644 queue-6.1/revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch diff --git a/queue-6.1/revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch b/queue-6.1/revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch new file mode 100644 index 00000000000..cc97d7970a5 --- /dev/null +++ b/queue-6.1/revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch @@ -0,0 +1,106 @@ +From 181127fb76e62d06ab17a75fd610129688612343 Mon Sep 17 00:00:00 2001 +From: Martin KaFai Lau +Date: Fri, 17 Feb 2023 12:13:09 -0800 +Subject: Revert "bpf, test_run: fix &xdp_frame misplacement for LIVE_FRAMES" + +From: Martin KaFai Lau + +commit 181127fb76e62d06ab17a75fd610129688612343 upstream. + +This reverts commit 6c20822fada1b8adb77fa450d03a0d449686a4a9. + +build bot failed on arch with different cache line size: +https://lore.kernel.org/bpf/50c35055-afa9-d01e-9a05-ea5351280e4f@intel.com/ + +Signed-off-by: Martin KaFai Lau +Signed-off-by: Greg Kroah-Hartman +--- + net/bpf/test_run.c | 29 +++------------ + tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | 7 +-- + 2 files changed, 9 insertions(+), 27 deletions(-) + +--- a/net/bpf/test_run.c ++++ b/net/bpf/test_run.c +@@ -97,11 +97,8 @@ reset: + struct xdp_page_head { + struct xdp_buff orig_ctx; + struct xdp_buff ctx; +- union { +- /* ::data_hard_start starts here */ +- DECLARE_FLEX_ARRAY(struct xdp_frame, frame); +- DECLARE_FLEX_ARRAY(u8, data); +- }; ++ struct xdp_frame frm; ++ u8 data[]; + }; + + struct xdp_test_data { +@@ -119,20 +116,6 @@ struct xdp_test_data { + #define TEST_XDP_FRAME_SIZE (PAGE_SIZE - sizeof(struct xdp_page_head)) + #define TEST_XDP_MAX_BATCH 256 + +-#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 +-#endif +-static_assert(SKB_WITH_OVERHEAD(TEST_XDP_FRAME_SIZE - XDP_PACKET_HEADROOM) == +- TEST_MAX_PKT_SIZE); +-#endif +- + static void xdp_test_run_init_page(struct page *page, void *arg) + { + struct xdp_page_head *head = phys_to_virt(page_to_phys(page)); +@@ -149,8 +132,8 @@ static void xdp_test_run_init_page(struc + headroom -= meta_len; + + new_ctx = &head->ctx; +- frm = head->frame; +- data = head->data; ++ frm = &head->frm; ++ data = &head->data; + memcpy(data + headroom, orig_ctx->data_meta, frm_len); + + xdp_init_buff(new_ctx, TEST_XDP_FRAME_SIZE, &xdp->rxq); +@@ -240,7 +223,7 @@ static void reset_ctx(struct xdp_page_he + head->ctx.data = head->orig_ctx.data; + head->ctx.data_meta = head->orig_ctx.data_meta; + head->ctx.data_end = head->orig_ctx.data_end; +- xdp_update_frame_from_buff(&head->ctx, head->frame); ++ xdp_update_frame_from_buff(&head->ctx, &head->frm); + } + + static int xdp_recv_frames(struct xdp_frame **frames, int nframes, +@@ -302,7 +285,7 @@ static int xdp_test_run_batch(struct xdp + head = phys_to_virt(page_to_phys(page)); + reset_ctx(head); + ctx = &head->ctx; +- frm = head->frame; ++ frm = &head->frm; + xdp->frame_cnt++; + + act = bpf_prog_run_xdp(prog, ctx); +--- a/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c ++++ b/tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +@@ -63,13 +63,12 @@ static int attach_tc_prog(struct bpf_tc_ + } + + /* The maximum permissible size is: PAGE_SIZE - sizeof(struct xdp_page_head) - +- * SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) - XDP_PACKET_HEADROOM = +- * 3408 bytes for 64-byte cacheline and 3216 for 256-byte one. ++ * sizeof(struct skb_shared_info) - XDP_PACKET_HEADROOM = 3368 bytes + */ + #if defined(__s390x__) +-#define MAX_PKT_SIZE 3216 ++#define MAX_PKT_SIZE 3176 + #else +-#define MAX_PKT_SIZE 3408 ++#define MAX_PKT_SIZE 3368 + #endif + static void test_max_pkt_size(int fd) + { diff --git a/queue-6.1/series b/queue-6.1/series index 42131f08094..c86e735a4e1 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -139,3 +139,4 @@ media-rc-gpio-ir-recv-add-remove-function.patch drm-amd-display-allow-subvp-on-vactive-pipes-that-are-2560x1440-60.patch drm-amd-display-adjust-mall-size-available-for-dcn32-and-dcn321.patch filelocks-use-mount-idmapping-for-setlease-permission-check.patch +revert-bpf-test_run-fix-xdp_frame-misplacement-for-live_frames.patch -- 2.47.3