Linux cryptographic layer development
 help / color / mirror / Atom feed
From: chandramouli narayanan <mouli@linux.intel.com>
To: Jussi Kivilinna <jussi.kivilinna@iki.fi>
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 - resend with email correction
Date: Thu, 27 Feb 2014 12:12:25 -0800	[thread overview]
Message-ID: <1393531945.7495.101.camel@pegasus.jf.intel.com> (raw)
In-Reply-To: <530F9050.9080006@iki.fi>

On Thu, 2014-02-27 at 21:21 +0200, Jussi Kivilinna wrote:
> On 27.02.2014 19:42, 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.
> > 
> > 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>
> > 
> <..snip..>
> >  static int __init sha1_ssse3_mod_init(void)
> >  {
> > +	char *algo_name;
> >  	/* test for SSSE3 first */
> > -	if (cpu_has_ssse3)
> > +	if (cpu_has_ssse3) {
> >  		sha1_transform_asm = sha1_transform_ssse3;
> > +		algo_name = "SSSE3";
> > +	}
> >  
> >  #ifdef CONFIG_AS_AVX
> >  	/* allow AVX to override SSSE3, it's a little faster */
> > -	if (avx_usable())
> > -		sha1_transform_asm = sha1_transform_avx;
> > +	if (avx_usable()) {
> > +		if (cpu_has_avx) {
> > +			sha1_transform_asm = sha1_transform_avx;
> > +			algo_name = "AVX";
> > +		}
> > +#ifdef CONFIG_AS_AVX2
> > +		if (cpu_has_avx2) {
> 
> Wouldn't you need to check also for BMI2 as __sha1_transform_avx2 uses 'rorx'?
> 
> For example, commit 16c0c4e1656c14ef9deac189a4240b5ca19c6919 added BMI2 check for SHA-256.
> 
> -Jussi

Good catch! I will add the check for AVX and BMI2.
- mouli

> 
> > +			/* allow AVX2 to override AVX, it's a little faster */
> > +			sha1_transform_asm = __sha1_transform_avx2;
> > +			algo_name = "AVX2";
> > +		}
> > +#endif
> > +	}
> >  #endif

      reply	other threads:[~2014-02-27 20:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 17:42 [PATCH 2/2] SHA1 transform: x86_64 AVX2 optimization - glue & build - resend with email correction chandramouli narayanan
2014-02-27 19:21 ` Jussi Kivilinna
2014-02-27 20:12   ` chandramouli narayanan [this message]

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=1393531945.7495.101.camel@pegasus.jf.intel.com \
    --to=mouli@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=ilya.albrekht@intel.com \
    --cc=jussi.kivilinna@iki.fi \
    --cc=linux-crypto@vger.kernel.org \
    --cc=maxim.locktyukhin@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