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

From: Alexander Lobakin
Date: Mon Feb 20 2023 - 10:49:31 EST


From: Martin Kafai Lau <martin.lau@xxxxxxxxx>
Date: Fri, 17 Feb 2023 12:32:36 -0800

> 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:

Userspace part tries to guess it :D Anyway, let's keep as it was for now.
Sent v5 without the static assertion, I hope it can still hit current
cycle? Or too late already?

> 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
>

Thanks,
Olek