From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave.Martin@arm.com (Dave Martin) Date: Thu, 29 Mar 2018 10:36:19 +0100 Subject: [PATCH resend 2/2] arm64: assembler: add macros to conditionally yield the NEON under PREEMPT In-Reply-To: References: <20180328124129.6459-1-ard.biesheuvel@linaro.org> <20180328124129.6459-3-ard.biesheuvel@linaro.org> <20180328171812.GN16308@e103592.cambridge.arm.com> Message-ID: <20180329093605.GP16308@e103592.cambridge.arm.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thu, Mar 29, 2018 at 10:02:18AM +0100, Ard Biesheuvel wrote: > On 28 March 2018 at 18:18, Dave Martin wrote: > > On Wed, Mar 28, 2018 at 02:41:29PM +0200, Ard Biesheuvel wrote: > >> Add support macros to conditionally yield the NEON (and thus the CPU) > >> that may be called from the assembler code. > >> > >> In some cases, yielding the NEON involves saving and restoring a non > >> trivial amount of context (especially in the CRC folding algorithms), > >> and so the macro is split into three, and the code in between is only > >> executed when the yield path is taken, allowing the context to be preserved. > >> The third macro takes an optional label argument that marks the resume > >> path after a yield has been performed. > > > > Minor comments below, mostly just suggestions/observations. > > > > With the missing #include in asm-offsets.c fixed (if you think it's > > appropriate): > > > > Reviewed-by: Dave Martin > > > > Thanks Dave > > Replies below > > >> Signed-off-by: Ard Biesheuvel > >> --- > >> arch/arm64/include/asm/assembler.h | 64 ++++++++++++++++++++ > >> arch/arm64/kernel/asm-offsets.c | 2 + > >> 2 files changed, 66 insertions(+) > >> > >> diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h > >> index d354eb7f2f0c..fb11514273d9 100644 > >> --- a/arch/arm64/include/asm/assembler.h > >> +++ b/arch/arm64/include/asm/assembler.h > >> @@ -623,4 +623,68 @@ USER(\label, ic ivau, \tmp2) // invalidate I line PoU > >> .endif > >> .endm > >> > >> +/* > >> + * Check whether to yield to another runnable task from kernel mode NEON code > >> + * (which runs with preemption disabled). > >> + * > >> + * if_will_cond_yield_neon > >> + * // pre-yield patchup code > >> + * do_cond_yield_neon > >> + * // post-yield patchup code > >> + * endif_yield_neon