Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Megha Dey <megha.dey@intel.com>
Cc: tim.c.chen@linux.intel.com, davem@davemloft.net,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	fenghua.yu@intel.com, Megha Dey <megha.dey@linux.intel.com>
Subject: Re: [PATCH 0/7] crypto: SHA256 multibuffer implementation
Date: Mon, 27 Jun 2016 17:04:55 +0800	[thread overview]
Message-ID: <20160627090455.GA7140@gondor.apana.org.au> (raw)
In-Reply-To: <1466732448-27856-1-git-send-email-megha.dey@intel.com>

On Thu, Jun 23, 2016 at 06:40:41PM -0700, Megha Dey wrote:
> From: Megha Dey <megha.dey@linux.intel.com>
> 
> In this patch series, we introduce the multi-buffer crypto algorithm on
> x86_64 and apply it to SHA256 hash computation.  The multi-buffer technique
> takes advantage of the 8 data lanes in the AVX2 registers and allows
> computation to be performed on data from multiple jobs in parallel.
> This allows us to parallelize computations when data inter-dependency in
> a single crypto job prevents us to fully parallelize our computations.
> The algorithm can be extended to other hashing and encryption schemes
> in the future.
> 
> On multi-buffer SHA256 computation with AVX2, we see throughput increase
> up to 2.2x over the existing x86_64 single buffer AVX2 algorithm.
> 
> The multi-buffer crypto algorithm is described in the following paper:
> Processing Multiple Buffers in Parallel to Increase Performance on
> Intel® Architecture Processors
> http://www.intel.com/content/www/us/en/communications/communications-ia-multi-buffer-paper.html
> 
> The outline of the algorithm is sketched below:
> Any driver requesting the crypto service will place an async
> crypto request on the workqueue.  The multi-buffer crypto daemon will
> pull request from work queue and put each request in an empty data lane
> for multi-buffer crypto computation.  When all the empty lanes are filled,
> computation will commence on the jobs in parallel and the job with the
> shortest remaining buffer will get completed and be returned.  To prevent
> prolonged stall when there is no new jobs arriving, we will flush a crypto
> job if it has not been completed after a maximum allowable delay.
> 
> To accommodate the fragmented nature of scatter-gather, we will keep
> submitting the next scatter-buffer fragment for a job for multi-buffer
> computation until a job is completed and no more buffer fragments remain.
> At that time we will pull a new job to fill the now empty data slot.
> We call a get_completed_job function to check whether there are other
> jobs that have been completed when we job when we have no new job arrival
> to prevent extraneous delay in returning any completed jobs.
> 
> The multi-buffer algorithm should be used for cases where crypto jobs
> submissions are at a reasonable high rate.  For low crypto job submission
> rate, this algorithm will not be beneficial. The reason is at low rate,
> we do not fill out the data lanes before the maximum allowable latency,
> we will be flushing the jobs instead of processing them with all the
> data lanes full.  We will miss the benefit of parallel computation,
> and adding delay to the processing of the crypto job at the same time.
> Some tuning of the maximum latency parameter may be needed to get the
> best performance.
> 
> Note that the tcrypt SHA256 speed test, we wait for a previous job to
> be completed before submitting a new job.  Hence this is not a valid
> test for multi-buffer algorithm as it requires multiple outstanding jobs
> submitted to fill the all data lanes to be effective (i.e. 8 outstanding
> jobs for the AVX2 case). An updated version of the tcrypt test is also
> included which would contain a more appropriate test for this scenario.
> 
> As this is the first algorithm in the kernel's crypto library
> that we have tried to use multi-buffer optimizations, feedbacks
> and testings will be much appreciated.

All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  parent reply	other threads:[~2016-06-27  9:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-24  1:40 [PATCH 0/7] crypto: SHA256 multibuffer implementation Megha Dey
2016-06-24  1:40 ` [PATCH 1/7] crypto: sha256-mb - SHA256 multibuffer job manager and glue code Megha Dey
2016-06-24  1:40 ` [PATCH 2/7] crypto: sha256-mb - Enable multibuffer support Megha Dey
2016-06-24  1:40 ` [PATCH 3/7] crypto: sha256-mb - submit/flush routines for AVX2 Megha Dey
2016-06-24  1:40 ` [PATCH 4/7] crypto: sha256-mb - Algorithm data structures Megha Dey
2016-06-24  1:40 ` [PATCH 5/7] crypto: sha256-mb - Crypto computation (x8 AVX2) Megha Dey
2016-06-24  1:40 ` [PATCH 6/7] crypto: tcrypt - Add speed tests for SHA multibuffer algorithms Megha Dey
2016-06-24  1:40 ` [PATCH 7/7] crypto: sha1-mb - rename sha-mb to sha1-mb Megha Dey
2016-06-27  9:04 ` Herbert Xu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-03-24 20:25 [PATCH 0/7] crypto: SHA256 multibuffer implementation megha.dey
2016-04-04 23:06 ` Yu, Fenghua

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=20160627090455.GA7140@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=megha.dey@intel.com \
    --cc=megha.dey@linux.intel.com \
    --cc=tim.c.chen@linux.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