[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171130101943.15f7ade4@gandalf.local.home>
Date: Thu, 30 Nov 2017 10:19:43 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-rt-users@...r.kernel.org, linux-kernel@...r.kernel.org,
tglx@...utronix.de, Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH RT] crypto: limit more FPU-enabled sections
On Thu, 30 Nov 2017 15:22:17 +0100
Sebastian Andrzej Siewior <bigeasy@...utronix.de> 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
Powered by blists - more mailing lists