Re: [PATCH bpf-next 1/2] bpf: Fix an issue in bpf_prog_test_run_xdp when page size greater than 4K

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/08, Yonghong Song wrote:
> The bpf selftest xdp_adjust_tail/xdp_adjust_frags_tail_grow failed on
> arm64 with 64KB page:
>    xdp_adjust_tail/xdp_adjust_frags_tail_grow:FAIL
> 
> In bpf_prog_test_run_xdp(), the xdp->frame_sz is set to 4K, but later on
> when constructing frags, with 64K page size, the frag data_len could
> be more than 4K. This will cause problems in bpf_xdp_frags_increase_tail().
> 
> Limiting the data_len to be 4K for each frag fixed the above test failure.
> 
> Signed-off-by: Yonghong Song <yonghong.song@xxxxxxxxx>
> ---
>  net/bpf/test_run.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index aaf13a7d58ed..5529ec007954 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -1214,6 +1214,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
>  	u32 repeat = kattr->test.repeat;
>  	struct netdev_rx_queue *rxqueue;
>  	struct skb_shared_info *sinfo;
> +	const u32 frame_sz = 4096;
>  	struct xdp_buff xdp = {};
>  	int i, ret = -EINVAL;
>  	struct xdp_md *ctx;
> @@ -1255,7 +1256,7 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
>  		headroom -= ctx->data;
>  	}
>  

[..]

> -	max_data_sz = 4096 - headroom - tailroom;
> +	max_data_sz = frame_sz - headroom - tailroom;

I wonder whether we should do s/4096/PAGE_SIZE/ here instead. Have you
tried that? If we are on a 64K page arch, we should not try to preserve
4K page limits.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux