linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: chandramouli narayanan <mouli@linux.intel.com>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net, hpa@zytor.com,
	ilya.albrekht@intel.com, maxim.locktyukhin@intel.com,
	ronen.zohar@intel.com, wajdi.k.feghali@intel.com,
	tim.c.chen@linux.intel.com, linux-crypto@vger.kernel.org
Subject: Re: [PATCH 2/2] SHA1 transform: x86_64 AVX2 optimization - glue & build-v2
Date: Mon, 17 Mar 2014 19:11:54 +0100	[thread overview]
Message-ID: <201403171911.55005.marex@denx.de> (raw)
In-Reply-To: <1395075232.7495.148.camel@pegasus.jf.intel.com>

On Monday, March 17, 2014 at 05:53:52 PM, chandramouli narayanan wrote:
> On Mon, 2014-03-17 at 17:06 +0100, Marek Vasut wrote:
> > On Monday, March 17, 2014 at 04:53:12 PM, chandramouli narayanan wrote:
> > > On Fri, 2014-03-14 at 06:40 +0100, Marek Vasut wrote:
> > > > On Wednesday, March 12, 2014 at 07:47:50 PM, chandramouli narayanan 
wrote:
> > > > > This git patch adds the glue, build and configuration changes
> > > > > to include x86_64 AVX2 optimization of SHA1 transform to
> > > > > crypto support. The patch has been tested with 3.14.0-rc1
> > > > > kernel.
> > > > > 
> > > > > Changes from the initial version of this patch are in
> > > > > a) check for BMI2 in addition to AVX2 support since
> > > > > __sha1_transform_avx2() uses rorx
> > > > > b) Since the module build has dependency on 64bit, it is
> > > > > redundant to check it in the code here.
> > > > > 
> > > > > On a Haswell desktop, with turbo disabled and all cpus running
> > > > > at maximum frequency, tcrypt shows AVX2 performance improvement
> > > > > from 3% for 256 bytes update to 16% for 1024 bytes update over
> > > > > AVX implementation.
> > > > > 
> > > > > Signed-off-by: Chandramouli Narayanan <mouli@linux.intel.com>
> > > > > 
> > > > > diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
> > > > > index 6ba54d6..61d6e28 100644
> > > > > --- a/arch/x86/crypto/Makefile
> > > > > +++ b/arch/x86/crypto/Makefile
> > > > > @@ -79,6 +79,9 @@ aesni-intel-y := aesni-intel_asm.o
> > > > > aesni-intel_glue.o fpu.o aesni-intel-$(CONFIG_64BIT) +=
> > > > > aesni-intel_avx-x86_64.o
> > > > > 
> > > > >  ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o
> > > > > 
> > > > > ghash-clmulni-intel_glue.o sha1-ssse3-y := sha1_ssse3_asm.o
> > > > > sha1_ssse3_glue.o
> > > > > +ifeq ($(avx2_supported),yes)
> > > > > +sha1-ssse3-y += sha1_avx2_x86_64_asm.o
> > > > 
> > > > Use:
> > > > 
> > > > sha1-ssse3-$(CONFIG_AS_AVX2) += sha1_avx2_x86_64_asm.o
> > > > 
> > > > And you will not need the CONFIG_AS_AVX2 ifdef in your previous
> > > > patch, no ? [...]
> > > > Best regards,
> > > > Marek Vasut
> > > 
> > > Sorry for the delayed reply. Agreed, I will fix the dependency.
> > 
> > No problem, thanks!
> > 
> > Best regards,
> > Marek Vasut
> 
> On second thoughts, with sha1-sse3-(CONFIG_AS_AVX2) +=
> sha1_avx2_x86_64_asm.o, I have build issues and sha1_transform_avx2
> undefined in sha1-sss3.ko.
> 
> I can rid #ifdef CONFIG_AS_AVX2 in patch1. The following works though:
> ifeq ($(avx2_supported),yes)
> sha1-ssse3-y += sha1_avx2_x86_64_asm.o
> endif

Looking throughout the arch/x86/crypto/Makefile , this sha1-ssse3.o thing is a 
bit odd I think. Why exactly does this not follow suit with the camellia or 
serpent ciphers ? I mean, look at their build rules, they handle all of 
SSE2/AVX/AVX2 implementation and it's build. Can we not clean up the SHA1-SSSE3 
to do exactly the same ? But please note I might be just plain wrong and if 
that's the case, let me know ;-)

btw. I noticed another nit in the code. You use __sha1_transform_avx2() , but 
there previous function using AVX1 is called sha1_transform_avx() . Drop those 
two underscores please for consistency's sake.

Thanks!

Best regards,
Marek Vasut

  reply	other threads:[~2014-03-17 18:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 18:47 [PATCH 2/2] SHA1 transform: x86_64 AVX2 optimization - glue & build-v2 chandramouli narayanan
2014-03-14  5:40 ` Marek Vasut
2014-03-17 15:53   ` chandramouli narayanan
2014-03-17 16:06     ` Marek Vasut
2014-03-17 16:53       ` chandramouli narayanan
2014-03-17 18:11         ` Marek Vasut [this message]
2014-03-17 19:09           ` chandramouli narayanan
2014-03-17 18:37         ` H. Peter Anvin

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=201403171911.55005.marex@denx.de \
    --to=marex@denx.de \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=ilya.albrekht@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=maxim.locktyukhin@intel.com \
    --cc=mouli@linux.intel.com \
    --cc=ronen.zohar@intel.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=wajdi.k.feghali@intel.com \
    /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 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).