On Wed, 23 Apr 2025 22:20:41 +0700 Bui Quang Minh wrote:
> I've tried to make the setup_xsk into each test. However, I've an issue 
> that the XDP socket destruct waits for an RCU grace period as I see this 
> sock's flag SOCK_RCU_FREE is set. So if we start the next test right 
> away, we can have the error when setting up XDP socket again because 
> previous XDP socket has not unbound the network interface's queue yet. I 
> can resolve the issue by putting the sleep(1) after closing the socket 
> in xdp_helper:
> 
> diff --git a/tools/testing/selftests/net/lib/xdp_helper.c 
> b/tools/testing/selftests/net/lib/xdp_helper.c
> index f21536ab95ba..e882bb22877f 100644
> --- a/tools/testing/selftests/net/lib/xdp_helper.c
> +++ b/tools/testing/selftests/net/lib/xdp_helper.c
> @@ -162,5 +162,6 @@ int main(int argc, char **argv)
>           */
> 
>          close(sock_fd);
> +       sleep(1);
>          return 0;
>   }
> 
> Do you think it's enough or do you have a better suggestion here?

Interesting :S What errno does the kernel return? EBUSY?
Perhaps we could loop for a second retrying the bind()
if kernel returns EBUSY in case it's just a socket waiting
to be cleaned up?

Reply via email to