From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752538AbdK3PTs (ORCPT ); Thu, 30 Nov 2017 10:19:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:35650 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750923AbdK3PTq (ORCPT ); Thu, 30 Nov 2017 10:19:46 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 791A6218A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Thu, 30 Nov 2017 10:19:43 -0500 From: Steven Rostedt To: Sebastian Andrzej Siewior Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, Peter Zijlstra Subject: Re: [PATCH RT] crypto: limit more FPU-enabled sections Message-ID: <20171130101943.15f7ade4@gandalf.local.home> In-Reply-To: <20171130142216.GB12606@linutronix.de> References: <20171130142216.GB12606@linutronix.de> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Nov 2017 15:22:17 +0100 Sebastian Andrzej Siewior wrote: > diff --git a/arch/x86/crypto/camellia_aesni_avx2_glue.c b/arch/x86/crypto/camellia_aesni_avx2_glue.c > index 60907c139c4e..d7502c023475 100644 > --- a/arch/x86/crypto/camellia_aesni_avx2_glue.c > +++ b/arch/x86/crypto/camellia_aesni_avx2_glue.c > @@ -206,6 +206,32 @@ struct crypt_priv { > bool fpu_enabled; > }; > > +static void camellia_fpu_end_rt(struct crypt_priv *ctx) > +{ > +#if CONFIG_PREEMPT_RT_FULL > + bool fpu_enabled = ctx->fpu_enabled; > + > + if (!fpu_enabled) > + return; > + camellia_fpu_end(fpu_enabled); > + ctx->fpu_enabled = false; > +#endif > +} > + > +static void camellia_fpu_sched_rt(struct crypt_priv *ctx) > +{ > +#if CONFIG_PREEMPT_RT_FULL > + bool fpu_enabled = ctx->fpu_enabled; > + > + if (!fpu_enabled || !tif_need_resched_now()) > + return; > + camellia_fpu_end(fpu_enabled); > + kernel_fpu_end(); > + /* schedule due to preemptible */ > + kernel_fpu_begin(); > +#endif > +} I think it would be cleaner to do: #ifdef CONFIG_PREEMPT_RT_FULL static void camellia_fpu_end_rt(struct crypt_priv *ctx) { bool fpu_enabled = ctx->fpu_enabled; if (!fpu_enabled) return; camellia_fpu_end(fpu_enabled); ctx->fpu_enabled = false; } static void camellia_fpu_sched_rt(struct crypt_priv *ctx) { bool fpu_enabled = ctx->fpu_enabled; if (!fpu_enabled || !tif_need_resched_now()) return; camellia_fpu_end(fpu_enabled); kernel_fpu_end(); /* schedule due to preemptible */ kernel_fpu_begin(); } #else static inline void camellia_fpu_end_rt(struct crypt_priv *ctx) { } static void camellia_fpu_sched_rt(struct crypt_priv *ctx) { } #endif It really shows that these functions are only used by RT. IMO it's bad taste to have functions with the entire body encapsulated in #ifdefs. And the same goes for the other functions in this patch. -- Steve