mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: George Spelvin <linux@horizon.com>
Cc: herbert@gondor.apana.org.au, james.guilford@intel.com,
	JBeulich@suse.com, linux-kernel@vger.kernel.org,
	sandyw@twitter.com
Subject: Re: [RFC PATCH] crypto: crc32c-pclmul - Use pmovzxdq to shrink K_table
Date: Wed, 28 May 2014 16:28:14 -0700	[thread overview]
Message-ID: <1401319694.2970.411.camel@schen9-DESK> (raw)
In-Reply-To: <20140528230147.3263.qmail@ns.horizon.com>

On Wed, 2014-05-28 at 19:01 -0400, George Spelvin wrote:
> Thanks for the reply!
> 
> > Changing from the aligned move (movdqa) to unaligned move and zeroing
> > (pmovzxdq), is going to make things slower.  If the table is aligned
> > on 8 byte boundary, some of the table can span 2 cache lines, which
> > can slow things further.
> 
> Um, two notes:
> 1) This load is performed once per 3072-byte block, which
>    is a minimum of 128 cycles just for the crc32q instructions,
>    never mind all the pcmulqdq folderol.
> 
>    Is it really more than 2 cycles?  Heck, is it *any* overall
>    time given that it's preceded by a stretch of 384 instructions
>    that it's not data-dependent on?
> 
>    I'll do some benchmarking to find out.
> 
> 2) The shrunk table entries are 8 bytes long, and so can't
>    span a cache line.  Is there any benefit to using a
>    larger alignment, other than the very small issue of the
>    full table needing 1 more cache line to be fully cached?

I think you are fine.  Each entry should fit in a cache line
entirely.  With the reduced entry size, we will be fitting
twice as many entries per cache line so it may help to reduce
the cache miss.

>    
> > We are trading speed for only 4096 bytes of memory save,
> > which is likely not a good trade for most systems except for 
> > those really constrained of memory.  For this kind of non-performance
> > critical system, it may as well use the generic crc32c algorithm and
> > compile out this module.
> 
> I hadn't intended to cause any speed penalty at all.
> Do you really think there will be one?

If you can do some benchmarking to find out the change's
speed impact, that will help to eliminate concerns about
speed penalty.  

Thanks.

Tim

Tim




  reply	other threads:[~2014-05-28 23:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 14:40 George Spelvin
2014-05-28 15:32 ` George Spelvin
2014-05-28 22:15   ` [PATCH v2] crypto: crc32c-pclmul - Shrink K_table to 32-bit words George Spelvin
2014-05-28 23:02     ` Tim Chen
2014-05-28 23:55       ` George Spelvin
2014-05-29  3:26       ` George Spelvin
2014-05-29 16:33         ` Tim Chen
2014-05-28 20:47 ` [RFC PATCH] crypto: crc32c-pclmul - Use pmovzxdq to shrink K_table Jan Beulich
2014-05-28 21:47   ` George Spelvin
2014-05-29  6:44     ` Jan Beulich
2014-05-28 22:32 ` Tim Chen
2014-05-28 23:01   ` George Spelvin
2014-05-28 23:28     ` Tim Chen [this message]
2014-05-29 23:54       ` George Spelvin
2014-05-30  1:07         ` Tim Chen
2014-05-30  1:16           ` Dave Jones
2014-05-30 17:56             ` Tim Chen
2014-05-30 18:45               ` Dirk Brandewie
2014-05-30 19:32                 ` Tim Chen
2014-05-30 19:38                   ` Dirk Brandewie
2014-05-30 20:07                     ` Tim Chen
2014-05-30 20:15                       ` Dirk Brandewie
2014-05-30  1:37           ` George Spelvin
2014-05-30  5:25             ` George Spelvin
2014-05-30 16:10               ` Tim Chen
2014-05-30 16:52                 ` George Spelvin
2014-05-30 17:01                   ` Tim Chen
2014-06-07  3:08                     ` [PATCH v3] crypto: crc32c-pclmul - Shrink K_table to 32-bit words George Spelvin
2014-06-20 18:42                       ` 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=1401319694.2970.411.camel@schen9-DESK \
    --to=tim.c.chen@linux.intel.com \
    --cc=JBeulich@suse.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=james.guilford@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=sandyw@twitter.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

all inboxes | Powered by JetHome®