SPE & Interrupt context (was how to make use of SPE instructions)

Scott Wood scottwood at freescale.com
Wed Jan 28 15:21:23 AEDT 2015


On Tue, 2015-01-27 at 05:09 +0000, Markus Stockhausen wrote:
> On Tue, 2015-01-20 at 14:53 +0000, Markus Stockhausen wrote:
> > > Von: Scott Wood [scottwood at freescale.com]
> > > Gesendet: Dienstag, 20. Januar 2015 08:38
> > > An: Markus Stockhausen
> > > Cc: Michael Ellerman; linuxppc-dev at lists.ozlabs.org
> > > Betreff: Re: AW: How to make use of SPE instructions?
> > > ...
> > > 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.
> > 
> 
> Hi Scott,
> 
> thanks for your helpful feedback. As you might have seen I sent a first
> patch for the sha256 kernel module that takes care about preemption.
> 
> Herbert Xu noticed that my module won't run in for IPsec as all
> work will be done from interrupt context. Do you have a tip how I can
> mitigate the check I implemented:
> 
> static bool spe_usable(void)
> {
>   return !in_interrupt();
> }
> 
> Intel guys have something like that
> 
> bool irq_fpu_usable(void)
> {
>   return !in_interrupt() ||
>     interrupted_user_mode() ||
>     interrupted_kernel_fpu_idle();
> }
> 
> But I have no idea how to transfer it to the PPC/SPE case.

I'm not sure what sort of tip you're looking for, other than
implementing it myself. :-)

-Scott




More information about the Linuxppc-dev mailing list