linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Markus Stockhausen <stockhausen@collogia.de>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: How long am I allowed to disable preemption? (was How to make use of SPE instructions?)
Date: Mon, 26 Jan 2015 20:28:38 -0600	[thread overview]
Message-ID: <1422325718.10544.31.camel@freescale.com> (raw)
In-Reply-To: <12EF8D94C6F8734FB2FF37B9FBEDD1735F913EE6@EXCHANGE.collogia.de>

On Tue, 2015-01-20 at 14:53 +0000, Markus Stockhausen wrote:
> > Von: Scott Wood [scottwood@freescale.com]
> > Gesendet: Dienstag, 20. Januar 2015 08:38
> > An: Markus Stockhausen
> > Cc: Michael Ellerman; linuxppc-dev@lists.ozlabs.org
> > Betreff: Re: AW: How to make use of SPE instructions?
> > ...
> > > I did some tests with the tcrypt module and I get a hashing speed of
> > > ~ 46MByte/s for 2K data chunks. Stock module gives 29MByte/s. In
> > > other words ~22,000 hashes per second. Overhead of the tcrypt data
> > > feeder of around 10% included. That are worst case 46us per hash and
> > > therefore 46us inside a non preemptive task.
> > ...
> > It's OK if the worst case is really 46 us, but if you can find a way to
> > break it up a bit without affecting throughput too much, I'd do so.
> 
> Hi Scott (and all),
> 
> with your answer I'm a bit confused about disabling preemption inside the 
> kernel right now. I understand that the interval between preempt_disable()
> and preempt_enable() should not take too long. But when I look at other
> kernel hash crypto modules I see that nobody really cares about that.

"Some people don't care about that" doesn't imply "nobody cares about
that".

>  Take sha256_ssse3_update() in sha256_ssse3_glue.c for example. It runs
> 
>   kernel_fpu_begin();
>   res = __sha256_ssse3_update(desc, data, len, partial);
>   kernel_fpu_end();
> 
> The kernel_fpu_xxx() enables/disables preemption like I need to do. 
>
> Nevertheless parameter len can be any number of bytes. Just take 
> reasonable parameters of 256K of input data, a 3GHz core and 13 
> cycles/byte of SHA256 throughput. That will be a 1ms timeframe.

That's bad.  Don't create more bad stuff. :-)

> Can I rely on that implementation, or do I have to take special care 
> because I'm only programming for a single core CPU? 

Not sure what you mean here.

> With your advice I would place a enable/disable preemption call after 
> 1K of processed data. But wil that be sufficient if I only reeanble it
> for a short timeframe like this:
> 
>   do {
>     disable_preemption()
>     ... calc hashes for 1K of data with 16.000 CPU cycles (or 20us) ...
>     enable_preemption()
>   while (dataleft>0);

Yes, it's sufficient.  When you enable preemption it will check to see
whether there is a pending reschedule.

-Scott

      reply	other threads:[~2015-01-27  2:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 14:53 How long am I allowed to disable preemption? (was How to make use of SPE instructions?) Markus Stockhausen
2015-01-27  2:28 ` Scott Wood [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=1422325718.10544.31.camel@freescale.com \
    --to=scottwood@freescale.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=stockhausen@collogia.de \
    /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).