All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	tglx@linutronix.de, Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH RT] crypto: limit more FPU-enabled sections
Date: Thu, 30 Nov 2017 16:41:08 +0100	[thread overview]
Message-ID: <20171130154108.GC11362@linutronix.de> (raw)
In-Reply-To: <20171130102948.22d451cd@gandalf.local.home>

On 2017-11-30 10:29:48 [-0500], Steven Rostedt wrote:
> > +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);
> 
> I haven't looked deeply, but why does this call the camellia_fpu_end()
> but other *_fpu_sched_rt() do not call the equivalent?

There is lrw_encrypt() which as "end" function after the end of the full
operation. So encrypt_callback() might be invoked multiple times but
only the first invocation does the fpu-enable part.

#1 We need to disable-FTP after one invocation of encrypt_callback()
   because blkcipher_walk_done() might alloc/free/map memory.

#2 That camellia_fpu_sched_rt() is only RT specific in order to enable
   preempt if need-resched is set for a RT task. For !RT we continue.

> > +	kernel_fpu_end();
> > +	/* schedule due to preemptible */
> > +	kernel_fpu_begin();
> > +#endif
> > +}
> > +
> 
> These are duplicate functions. Shouldn't they go into a header file?
> 
> Also, they are very similar:

That whole thing is kind of ugly, yes. That *_fpu_end_rt() use a struct
crypt_priv but this is defined in each cipher file.

I would keep it for now until we decide if we keep fixing those things
are disable for RT because it is not worth it. As I said, this is only
x86 specific and we have something similar on ARM with NEON.
But I guess the decision here will be postponed until someone posts
numbers with SW and with this workaround and cyclictest with a cycle of
1 - 10 ms.

Sebastian

  reply	other threads:[~2017-11-30 15:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-30 14:22 [PATCH RT] crypto: limit more FPU-enabled sections Sebastian Andrzej Siewior
2017-11-30 14:30 ` Sebastian Andrzej Siewior
2017-12-01 10:43   ` [PATCH RT] arm*: disable NEON in kernel mode Sebastian Andrzej Siewior
2017-12-01 13:45     ` Sebastian Andrzej Siewior
2017-12-01 13:45       ` Sebastian Andrzej Siewior
2017-12-01 14:18       ` Mark Rutland
2017-12-01 14:18         ` Mark Rutland
2017-12-01 14:36         ` Sebastian Andrzej Siewior
2017-12-01 14:36           ` Sebastian Andrzej Siewior
2017-12-01 15:03           ` Ard Biesheuvel
2017-12-01 15:03             ` Ard Biesheuvel
2017-12-01 17:58             ` Dave Martin
2017-12-01 17:58               ` Dave Martin
2017-12-01 18:08               ` Russell King - ARM Linux
2017-12-01 18:08                 ` Russell King - ARM Linux
2017-12-01 18:24                 ` Dave Martin
2017-12-01 18:24                   ` Dave Martin
2017-12-01 19:20                   ` Ard Biesheuvel
2017-12-01 19:20                     ` Ard Biesheuvel
2017-12-04  9:21                   ` Sebastian Andrzej Siewior
2017-12-04  9:21                     ` Sebastian Andrzej Siewior
2017-12-01 17:14           ` Peter Zijlstra
2017-12-01 17:14             ` Peter Zijlstra
2017-12-01 17:31             ` Russell King - ARM Linux
2017-12-01 17:31               ` Russell King - ARM Linux
2017-12-01 17:39               ` Peter Zijlstra
2017-12-01 17:39                 ` Peter Zijlstra
2017-11-30 15:19 ` [PATCH RT] crypto: limit more FPU-enabled sections Steven Rostedt
2017-11-30 15:22   ` Sebastian Andrzej Siewior
2017-12-01 10:44     ` [PATCH RT v2] " Sebastian Andrzej Siewior
2017-12-01 11:32       ` Peter Zijlstra
2017-12-01 13:32         ` Sebastian Andrzej Siewior
2017-12-01 13:44           ` Peter Zijlstra
2017-12-01 13:50             ` Sebastian Andrzej Siewior
2017-12-01 14:03               ` [PATCH RT v3] " Sebastian Andrzej Siewior
2017-11-30 15:29 ` [PATCH RT] " Steven Rostedt
2017-11-30 15:41   ` Sebastian Andrzej Siewior [this message]
2017-11-30 16:18     ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171130154108.GC11362@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.