Re: [PATCH net-next v6 01/23] asm: simd context helper API
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2018-09-28 13:45:37
Also in:
linux-arch, linux-crypto, lkml
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: 2018-09-28 13:45:37
Also in:
linux-arch, linux-crypto, lkml
On Fri, Sep 28, 2018 at 10:28 AM Ard Biesheuvel [off-list ref] 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.
quoted
+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.
quoted
+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); + } +#endifCould 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.