All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Colin King <colin.king@canonical.com>,
	"David S . Miller" <davem@davemloft.net>,
	Shuah Khan <shuah@kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK" 
	<linux-kselftest@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/net: skip msg_zerocopy test if we have less than 4 CPUs
Date: Wed, 5 Aug 2020 10:06:41 +0200	[thread overview]
Message-ID: <CA+FuTSd9K+s1rXUFpb_RWEC-uAgwU1Vz44zaUPaZK0cfsX4kwA@mail.gmail.com> (raw)
In-Reply-To: <b99004ea-cd9d-bec3-5f9f-82dcb00a6284@gmail.com>

On Wed, Aug 5, 2020 at 2:54 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 8/4/20 5:30 AM, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The current test will exit with a failure if it cannot set affinity on
> > specific CPUs which is problematic when running this on single CPU
> > systems. Add a check for the number of CPUs and skip the test if
> > the CPU requirement is not met.
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  tools/testing/selftests/net/msg_zerocopy.sh | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/testing/selftests/net/msg_zerocopy.sh b/tools/testing/selftests/net/msg_zerocopy.sh
> > index 825ffec85cea..97bc527e1297 100755
> > --- a/tools/testing/selftests/net/msg_zerocopy.sh
> > +++ b/tools/testing/selftests/net/msg_zerocopy.sh
> > @@ -21,6 +21,11 @@ readonly DADDR6='fd::2'
> >
> >  readonly path_sysctl_mem="net.core.optmem_max"
> >
> > +if [[ $(nproc) -lt 4 ]]; then
> > +     echo "SKIP: test requires at least 4 CPUs"
> > +     exit 4
> > +fi
> > +
> >  # No arguments: automated test
> >  if [[ "$#" -eq "0" ]]; then
> >       $0 4 tcp -t 1
> >
>
> Test explicitly uses CPU 2 and 3, right ?
>
> nproc could be 500, yet cpu 2 or 3 could be offline
>
> # cat /sys/devices/system/cpu/cpu3/online
> 0
> # echo $(nproc)
> 71

The cpu affinity is only set to bring some stability across runs.

The test does not actually verify that a run with zerocopy is some
factor faster than without, as that factor is hard to choose across
all platforms. As a result the automated run mainly gives code coverage.

It's preferable to always run. And on sched_setaffinity failure log a
message about possible jitter and continue. I can send that patch, if
the approach sounds good.

WARNING: multiple messages have this Message-ID (diff)
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Colin King <colin.king@canonical.com>,
	"David S . Miller" <davem@davemloft.net>,
	Shuah Khan <shuah@kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	kernel-janitors@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] selftests/net: skip msg_zerocopy test if we have less than 4 CPUs
Date: Wed, 05 Aug 2020 08:06:41 +0000	[thread overview]
Message-ID: <CA+FuTSd9K+s1rXUFpb_RWEC-uAgwU1Vz44zaUPaZK0cfsX4kwA@mail.gmail.com> (raw)
In-Reply-To: <b99004ea-cd9d-bec3-5f9f-82dcb00a6284@gmail.com>

On Wed, Aug 5, 2020 at 2:54 AM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 8/4/20 5:30 AM, Colin King wrote:
> > From: Colin Ian King <colin.king@canonical.com>
> >
> > The current test will exit with a failure if it cannot set affinity on
> > specific CPUs which is problematic when running this on single CPU
> > systems. Add a check for the number of CPUs and skip the test if
> > the CPU requirement is not met.
> >
> > Signed-off-by: Colin Ian King <colin.king@canonical.com>
> > ---
> >  tools/testing/selftests/net/msg_zerocopy.sh | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/testing/selftests/net/msg_zerocopy.sh b/tools/testing/selftests/net/msg_zerocopy.sh
> > index 825ffec85cea..97bc527e1297 100755
> > --- a/tools/testing/selftests/net/msg_zerocopy.sh
> > +++ b/tools/testing/selftests/net/msg_zerocopy.sh
> > @@ -21,6 +21,11 @@ readonly DADDR6='fd::2'
> >
> >  readonly path_sysctl_mem="net.core.optmem_max"
> >
> > +if [[ $(nproc) -lt 4 ]]; then
> > +     echo "SKIP: test requires at least 4 CPUs"
> > +     exit 4
> > +fi
> > +
> >  # No arguments: automated test
> >  if [[ "$#" -eq "0" ]]; then
> >       $0 4 tcp -t 1
> >
>
> Test explicitly uses CPU 2 and 3, right ?
>
> nproc could be 500, yet cpu 2 or 3 could be offline
>
> # cat /sys/devices/system/cpu/cpu3/online
> 0
> # echo $(nproc)
> 71

The cpu affinity is only set to bring some stability across runs.

The test does not actually verify that a run with zerocopy is some
factor faster than without, as that factor is hard to choose across
all platforms. As a result the automated run mainly gives code coverage.

It's preferable to always run. And on sched_setaffinity failure log a
message about possible jitter and continue. I can send that patch, if
the approach sounds good.

  reply	other threads:[~2020-08-05  8:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 12:30 [PATCH] selftests/net: skip msg_zerocopy test if we have less than 4 CPUs Colin King
2020-08-04 12:30 ` Colin King
2020-08-04 23:06 ` David Miller
2020-08-04 23:06   ` David Miller
2020-08-05  0:54 ` Eric Dumazet
2020-08-05  0:54   ` Eric Dumazet
2020-08-05  8:06   ` Willem de Bruijn [this message]
2020-08-05  8:06     ` Willem de Bruijn
2020-08-05  8:22     ` Colin Ian King
2020-08-05  8:22       ` Colin Ian King
2020-08-05  8:44       ` Willem de Bruijn
2020-08-05  8:44         ` Willem de Bruijn
2020-08-05  8:48         ` Colin Ian King
2020-08-05  8:48           ` Colin Ian King

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=CA+FuTSd9K+s1rXUFpb_RWEC-uAgwU1Vz44zaUPaZK0cfsX4kwA@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=colin.king@canonical.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shuah@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.