All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Anderson <dianders@chromium.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	David Laight <David.Laight@aculab.com>
Subject: Re: [PATCH v2 2/2] crypto: xor - use ktime for template benchmarking
Date: Mon, 28 Sep 2020 16:47:45 -0700	[thread overview]
Message-ID: <CAD=FV=WGnm2bSe-1yJ46yLHv43Grpse6DXC7CFaWMd_W9--EGw@mail.gmail.com> (raw)
In-Reply-To: <20200926102651.31598-3-ardb@kernel.org>

Hi,

On Sat, Sep 26, 2020 at 3:27 AM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> Currently, we use the jiffies counter as a time source, by staring at
> it until a HZ period elapses, and then staring at it again and perform
> as many XOR operations as we can at the same time until another HZ
> period elapses, so that we can calculate the throughput. This takes
> longer than necessary, and depends on HZ, which is undesirable, since
> HZ is system dependent.
>
> Let's use the ktime interface instead, and use it to time a fixed
> number of XOR operations, which can be done much faster, and makes
> the time spent depend on the performance level of the system itself,
> which is much more reasonable. To ensure that we have the resolution
> we need even on systems with 32 kHz time sources, while not spending too
> much time in the benchmark on a slow CPU, let's switch to 3 attempts of
> 800 repetitions each: that way, we will only misidentify algorithms that
> perform within 10% of each other as the fastest if they are faster than
> 10 GB/s to begin with, which is not expected to occur on systems with
> such coarse clocks.
>
> On ThunderX2, I get the following results:
>
> Before:
>
>   [72625.956765] xor: measuring software checksum speed
>   [72625.993104]    8regs     : 10169.000 MB/sec
>   [72626.033099]    32regs    : 12050.000 MB/sec
>   [72626.073095]    arm64_neon: 11100.000 MB/sec
>   [72626.073097] xor: using function: 32regs (12050.000 MB/sec)
>
> After:
>
>   [72599.650216] xor: measuring software checksum speed
>   [72599.651188]    8regs           : 10491 MB/sec
>   [72599.652006]    32regs          : 12345 MB/sec
>   [72599.652871]    arm64_neon      : 11402 MB/sec
>   [72599.652873] xor: using function: 32regs (12345 MB/sec)

What are the chances of 12345 coming up?  ;-)

>
> Link: https://lore.kernel.org/linux-crypto/20200923182230.22715-3-ardb@kernel.org/
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
>  crypto/xor.c | 38 +++++++++-----------
>  1 file changed, 16 insertions(+), 22 deletions(-)

This looks good to me.  Thanks for taking this on!

Reviewed-by: Douglas Anderson <dianders@chromium.org>

  reply	other threads:[~2020-09-28 23:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26 10:26 [PATCH v2 0/2] crypto: xor - defer and optimize boot time benchmark Ard Biesheuvel
2020-09-26 10:26 ` [PATCH v2 1/2] crypto: xor - defer load time benchmark to a later time Ard Biesheuvel
2020-09-26 10:26 ` [PATCH v2 2/2] crypto: xor - use ktime for template benchmarking Ard Biesheuvel
2020-09-28 23:47   ` Doug Anderson [this message]
2020-10-02 11:55 ` [PATCH v2 0/2] crypto: xor - defer and optimize boot time benchmark Herbert Xu

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='CAD=FV=WGnm2bSe-1yJ46yLHv43Grpse6DXC7CFaWMd_W9--EGw@mail.gmail.com' \
    --to=dianders@chromium.org \
    --cc=David.Laight@aculab.com \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@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.