From: Jakub Sitnicki <jakub@cloudflare.com>
To: John Fastabend <john.fastabend@gmail.com>
Cc: lmb@cloudflare.com, daniel@iogearbox.net, netdev@vger.kernel.org,
bpf@vger.kernel.org, ast@kernel.org
Subject: Re: [bpf-next PATCH 05/10] bpf: selftests, improve test_sockmap total bytes counter
Date: Thu, 7 May 2020 10:55:50 +0200 [thread overview]
Message-ID: <20200507105550.35adc82f@toad> (raw)
In-Reply-To: <158871187408.7537.17124775242608386871.stgit@john-Precision-5820-Tower>
On Tue, 05 May 2020 13:51:14 -0700
John Fastabend <john.fastabend@gmail.com> wrote:
> The recv thread in test_sockmap waits to receive all bytes from sender but
> in the case we use pop data it may wait for more bytes then actually being
> sent. This stalls the test harness for multiple seconds. Because this
> happens in multiple tests it slows time to run the selftest.
>
> Fix by doing a better job of accounting for total bytes when pop helpers
> are used.
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
> tools/testing/selftests/bpf/test_sockmap.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_sockmap.c b/tools/testing/selftests/bpf/test_sockmap.c
> index a81ed5d..36aca86 100644
> --- a/tools/testing/selftests/bpf/test_sockmap.c
> +++ b/tools/testing/selftests/bpf/test_sockmap.c
> @@ -502,9 +502,10 @@ static int msg_loop(int fd, int iov_count, int iov_length, int cnt,
> * paths.
> */
> total_bytes = (float)iov_count * (float)iov_length * (float)cnt;
> - txmsg_pop_total = txmsg_pop;
> if (txmsg_apply)
> - txmsg_pop_total *= (total_bytes / txmsg_apply);
> + txmsg_pop_total = txmsg_pop * (total_bytes / txmsg_apply);
> + else
> + txmsg_pop_total = txmsg_pop * cnt;
> total_bytes -= txmsg_pop_total;
> err = clock_gettime(CLOCK_MONOTONIC, &s->start);
> if (err < 0)
> @@ -638,9 +639,13 @@ static int sendmsg_test(struct sockmap_options *opt)
>
> rxpid = fork();
> if (rxpid == 0) {
> + iov_buf -= (txmsg_pop - txmsg_start_pop + 1);
> if (opt->drop_expected)
> exit(0);
>
> + if (!iov_buf) /* zero bytes sent case */
> + exit(0);
You probably want to call _exit() from the child to prevent flushing
stdio buffers twice.
> +
> if (opt->sendpage)
> iov_count = 1;
> err = msg_loop(rx_fd, iov_count, iov_buf,
>
next prev parent reply other threads:[~2020-05-07 8:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 20:49 [bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements John Fastabend
2020-05-05 20:49 ` [bpf-next PATCH 01/10] bpf: selftests, move sockmap bpf prog header into progs John Fastabend
2020-05-05 20:50 ` [bpf-next PATCH 02/10] bpf: selftests, remove prints from sockmap tests John Fastabend
2020-05-05 20:50 ` [bpf-next PATCH 03/10] bpf: selftests, sockmap test prog run without setting cgroup John Fastabend
2020-05-07 8:31 ` Jakub Sitnicki
2020-05-07 18:10 ` John Fastabend
2020-05-05 20:50 ` [bpf-next PATCH 04/10] bpf: selftests, print error in test_sockmap error cases John Fastabend
2020-05-05 20:51 ` [bpf-next PATCH 05/10] bpf: selftests, improve test_sockmap total bytes counter John Fastabend
2020-05-07 8:55 ` Jakub Sitnicki [this message]
2020-05-05 20:51 ` [bpf-next PATCH 06/10] bpf: selftests, break down test_sockmap into subtests John Fastabend
2020-05-05 20:51 ` [bpf-next PATCH 07/10] bpf: selftests, provide verbose option for selftests execution John Fastabend
2020-05-05 20:52 ` [bpf-next PATCH 08/10] bpf: selftests, add whitelist option to test_sockmap John Fastabend
2020-05-05 20:52 ` [bpf-next PATCH 09/10] bpf: selftests, add blacklist " John Fastabend
2020-05-05 20:52 ` [bpf-next PATCH 10/10] bpf: selftests, add ktls tests " John Fastabend
2020-05-05 21:04 ` [bpf-next PATCH 00/10] bpf: selftests, test_sockmap improvements John Fastabend
2020-05-07 10:37 ` Jakub Sitnicki
2020-05-07 18:12 ` John Fastabend
2020-05-08 21:34 ` Andrii Nakryiko
2020-05-09 14:55 ` John Fastabend
2020-05-12 3:13 ` Andrii Nakryiko
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=20200507105550.35adc82f@toad \
--to=jakub@cloudflare.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=lmb@cloudflare.com \
--cc=netdev@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.