Re: [PATCH net-next v6 01/23] asm: simd context helper API
From: Jason A. Donenfeld
Date: Fri Sep 28 2018 - 09:45:38 EST
On Fri, Sep 28, 2018 at 10:28 AM Ard Biesheuvel
<ard.biesheuvel@xxxxxxxxxx> wrote:
> Given that this patch applies to all architectures at once, it is
> probably better to drop the unrelated reordering hunks to avoid
> conflicts.
Ack. Will retain order for v7.
> > +static __must_check inline bool may_use_simd(void)
> > +{
> > + return !in_interrupt();
> > +}
> > +
>
> Remember this guy?
>
> https://marc.info/?l=linux-arch&m=149631094625176&w=2
>
> That was never merged, so let's get it right this time.
Wow, nice memory. I had forgotten all about that. Queued for v7.
> > +static inline void simd_relax(simd_context_t *ctx)
> > +{
> > +#ifdef CONFIG_PREEMPT
> > + if ((*ctx & HAVE_SIMD_IN_USE) && need_resched()) {
> > + simd_put(ctx);
> > + simd_get(ctx);
> > + }
> > +#endif
>
> Could we return a bool here indicating whether we rescheduled or not?
> In some cases, we could pass that into the asm code as a 'reload'
> param, allowing repeated loads of key schedules, round constant tables
> or S-boxes to be elided.
Sure, sounds easy enough.