MPTCP Archive mirror
 help / color / mirror / Atom feed
From: Geliang Tang <tanggeliang@kylinos.cn>
To: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v5 01/10] Squash to "selftests/bpf: Add bpf scheduler test" 1 nonblock
Date: Wed, 03 Apr 2024 15:45:23 +0800	[thread overview]
Message-ID: <cefdf3b0414d664f2d797060460c4de7b4cc1d97.camel@kylinos.cn> (raw)
In-Reply-To: <f0b66813ae8274e5653988d80d16171508f05796.1712042049.git.tanggeliang@kylinos.cn>

On Tue, 2024-04-02 at 15:15 +0800, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> BPF tests fail sometimes with "bytes != total_bytes" errors:
> 
>  # test_default:PASS:sched_init:default 0 nsec
>  # send_data:PASS:pthread_create 0 nsec
>  # send_data:FAIL:recv 936000 != 10485760 nr_recv:-1 errno:11
>  # default: 3041 ms
>  # server:FAIL:send 7579500 != 10485760 nr_sent:-1 errno:11
>  # send_data:FAIL:pthread_join thread_ret:-11 \
> 		test_default:PASS:has_bytes_sent addr_1 0 nsec
>  # test_default:PASS:has_bytes_sent addr_2 0 nsec
>  # close_netns:PASS:setns 0 nsec
> 
> Here errno 11 is EAGAIN. This patch sets server socket to nonblock
> to fix this. It makes BPF tests stable.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/bpf/prog_tests/mptcp.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> index 6e28215d7404..d3d51aee440d 100644
> --- a/tools/testing/selftests/bpf/prog_tests/mptcp.c
> +++ b/tools/testing/selftests/bpf/prog_tests/mptcp.c
> @@ -88,6 +88,16 @@ static void cleanup_netns(struct nstoken *nstoken)
>  	SYS_NOFAIL("ip netns del %s", NS_TEST);
>  }
>  
> +static int set_nonblock(int fd)
> +{
> +	int flags = fcntl(fd, F_GETFL);
> +
> +	if (flags == -1)
> +		return -1;
> +
> +	return fcntl(fd, flags | O_NONBLOCK);

This fix is incorrect. fcntl shouldn't be used like this. I'll think
about how to modify it again. BTW, Other patches in this series are
still valid. But needs to be rebased.

Thanks,
-Geliang

> +}
> +
>  static int verify_tsk(int map_fd, int client_fd)
>  {
>  	int err, cfd = client_fd;
> @@ -466,6 +476,7 @@ static void test_default(void)
>  	server_fd = start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0);
>  	client_fd = connect_to_fd(server_fd, 0);
>  
> +	set_nonblock(server_fd);
>  	send_data(server_fd, client_fd, "default");
>  	ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr_1");
>  	ASSERT_OK(has_bytes_sent(ADDR_2), "has_bytes_sent addr_2");
> @@ -639,6 +650,7 @@ static void test_burst(void)
>  	server_fd = start_mptcp_server(AF_INET, ADDR_1, PORT_1, 0);
>  	client_fd = connect_to_fd(server_fd, 0);
>  
> +	set_nonblock(server_fd);
>  	send_data(server_fd, client_fd, "bpf_burst");
>  	ASSERT_OK(has_bytes_sent(ADDR_1), "has_bytes_sent addr 1");
>  	ASSERT_OK(has_bytes_sent(ADDR_2), "has_bytes_sent addr 2");


  reply	other threads:[~2024-04-03  7:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  7:15 [PATCH mptcp-next v5 00/10] refactor mptcp bpf tests Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 01/10] Squash to "selftests/bpf: Add bpf scheduler test" 1 nonblock Geliang Tang
2024-04-03  7:45   ` Geliang Tang [this message]
2024-04-02  7:15 ` [PATCH mptcp-next v5 02/10] selftests/bpf: Add RUN_MPTCP_TEST macro Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 03/10] Squash to "selftests/bpf: Add bpf scheduler test" 2 verify Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 04/10] Squash to "selftests/bpf: Add bpf scheduler test" 3 time Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 05/10] selftests/bpf: Add MPTCP_SCHED_TEST macro Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 06/10] Squash to "selftests/bpf: Add bpf_first scheduler & test" Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 07/10] Squash to "selftests/bpf: Add bpf_bkup " Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 08/10] Squash to "selftests/bpf: Add bpf_rr " Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 09/10] Squash to "selftests/bpf: Add bpf_red " Geliang Tang
2024-04-02  7:15 ` [PATCH mptcp-next v5 10/10] Squash to "selftests/bpf: Add bpf_burst " Geliang Tang
2024-04-02  8:07 ` [PATCH mptcp-next v5 00/10] refactor mptcp bpf tests MPTCP CI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cefdf3b0414d664f2d797060460c4de7b4cc1d97.camel@kylinos.cn \
    --to=tanggeliang@kylinos.cn \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).