<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <tt><font size="-1">LGTM<br>
        Acked-by: Ian May <a class="moz-txt-link-rfc2396E" href="mailto:ian.may@canonical.com"><ian.may@canonical.com></a></font></tt><font
      size="-1"><br>
    </font><br>
    <div class="moz-cite-prefix"><tt>On 8/6/20 4:59 AM, Colin King
        wrote:</tt><br>
    </div>
    <blockquote type="cite"
      cite="mid:20200806095944.43862-2-colin.king@canonical.com">
      <pre class="moz-quote-pre" wrap="">From: Willem de Bruijn <a class="moz-txt-link-rfc2396E" href="mailto:willemb@google.com"><willemb@google.com></a>

BugLink: <a class="moz-txt-link-freetext" href="https://bugs.launchpad.net/bugs/1812620">https://bugs.launchpad.net/bugs/1812620</a>

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 <a class="moz-txt-link-rfc2396E" href="mailto:colin.king@canonical.com"><colin.king@canonical.com></a>
Signed-off-by: Willem de Bruijn <a class="moz-txt-link-rfc2396E" href="mailto:willemb@google.com"><willemb@google.com></a>
Acked-by: Colin Ian King <a class="moz-txt-link-rfc2396E" href="mailto:colin.king@canonical.com"><colin.king@canonical.com></a>
Signed-off-by: David S. Miller <a class="moz-txt-link-rfc2396E" href="mailto:davem@davemloft.net"><davem@davemloft.net></a>
(cherry picked from commit 16f6458f2478b55e2b628797bc81a4455045c74e linux-next)
Signed-off-by: Colin Ian King <a class="moz-txt-link-rfc2396E" href="mailto:colin.king@canonical.com"><colin.king@canonical.com></a>
---
 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;
</pre>
    </blockquote>
    <br>
  </body>
</html>