netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test
@ 2020-08-05  8:40 Willem de Bruijn
  2020-08-05  8:48 ` ACK: " Colin Ian King
  2020-08-05 19:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Willem de Bruijn @ 2020-08-05  8:40 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, Willem de Bruijn, Colin Ian King

From: Willem de Bruijn <willemb@google.com>

The msg_zerocopy test pins the sender and receiver threads to separate
cores to reduce variance between runs.

But it hardcodes the cores and skips core 0, so it fails on machines
with the selected cores offline, or simply fewer cores.

The test mainly gives code coverage in automated runs. The throughput
of zerocopy ('-z') and non-zerocopy runs is logged for manual
inspection.

Continue even when sched_setaffinity fails. Just log to warn anyone
interpreting the data.

Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 tools/testing/selftests/net/msg_zerocopy.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c
index 4b02933cab8a..bdc03a2097e8 100644
--- a/tools/testing/selftests/net/msg_zerocopy.c
+++ b/tools/testing/selftests/net/msg_zerocopy.c
@@ -125,9 +125,8 @@ static int do_setcpu(int cpu)
 	CPU_ZERO(&mask);
 	CPU_SET(cpu, &mask);
 	if (sched_setaffinity(0, sizeof(mask), &mask))
-		error(1, 0, "setaffinity %d", cpu);
-
-	if (cfg_verbose)
+		fprintf(stderr, "cpu: unable to pin, may increase variance.\n");
+	else if (cfg_verbose)
 		fprintf(stderr, "cpu: %u\n", cpu);
 
 	return 0;
-- 
2.28.0.236.gb10cc79966-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* ACK: [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test
  2020-08-05  8:40 [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test Willem de Bruijn
@ 2020-08-05  8:48 ` Colin Ian King
  2020-08-05 19:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2020-08-05  8:48 UTC (permalink / raw)
  To: Willem de Bruijn, netdev; +Cc: davem, eric.dumazet, Willem de Bruijn

On 05/08/2020 09:40, Willem de Bruijn wrote:
> From: Willem de Bruijn <willemb@google.com>
> 
> The msg_zerocopy test pins the sender and receiver threads to separate
> cores to reduce variance between runs.
> 
> But it hardcodes the cores and skips core 0, so it fails on machines
> with the selected cores offline, or simply fewer cores.
> 
> The test mainly gives code coverage in automated runs. The throughput
> of zerocopy ('-z') and non-zerocopy runs is logged for manual
> inspection.
> 
> Continue even when sched_setaffinity fails. Just log to warn anyone
> interpreting the data.
> 
> Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---
>  tools/testing/selftests/net/msg_zerocopy.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/msg_zerocopy.c b/tools/testing/selftests/net/msg_zerocopy.c
> index 4b02933cab8a..bdc03a2097e8 100644
> --- a/tools/testing/selftests/net/msg_zerocopy.c
> +++ b/tools/testing/selftests/net/msg_zerocopy.c
> @@ -125,9 +125,8 @@ static int do_setcpu(int cpu)
>  	CPU_ZERO(&mask);
>  	CPU_SET(cpu, &mask);
>  	if (sched_setaffinity(0, sizeof(mask), &mask))
> -		error(1, 0, "setaffinity %d", cpu);
> -
> -	if (cfg_verbose)
> +		fprintf(stderr, "cpu: unable to pin, may increase variance.\n");
> +	else if (cfg_verbose)
>  		fprintf(stderr, "cpu: %u\n", cpu);
>  
>  	return 0;
> 

Thanks, you solution is good for my testing requirements

Acked-by: Colin Ian King <colin.king@canonical.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test
  2020-08-05  8:40 [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test Willem de Bruijn
  2020-08-05  8:48 ` ACK: " Colin Ian King
@ 2020-08-05 19:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-08-05 19:26 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, eric.dumazet, willemb, colin.king

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Wed,  5 Aug 2020 04:40:45 -0400

> From: Willem de Bruijn <willemb@google.com>
> 
> The msg_zerocopy test pins the sender and receiver threads to separate
> cores to reduce variance between runs.
> 
> But it hardcodes the cores and skips core 0, so it fails on machines
> with the selected cores offline, or simply fewer cores.
> 
> The test mainly gives code coverage in automated runs. The throughput
> of zerocopy ('-z') and non-zerocopy runs is logged for manual
> inspection.
> 
> Continue even when sched_setaffinity fails. Just log to warn anyone
> interpreting the data.
> 
> Fixes: 07b65c5b31ce ("test: add msg_zerocopy test")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-05 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  8:40 [PATCH net] selftests/net: relax cpu affinity requirement in msg_zerocopy test Willem de Bruijn
2020-08-05  8:48 ` ACK: " Colin Ian King
2020-08-05 19:26 ` David Miller

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 NNTP newsgroup(s).