linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Landden <slandden@gmail.com>
To: linux-rt-users@vger.kernel.org, peterz@infradead.org,
	wireguard@lists.zx2c4.com
Subject: Allowing SIMD in kernel mode without disabling preemption
Date: Sat, 18 May 2019 11:27:34 -0500	[thread overview]
Message-ID: <CA+49okpOX5-N33BLPEEeBTW4Wcn7sBWog7cBNT=ENLvOZ_MKVQ@mail.gmail.com> (raw)

I ported the x86 approach to allowing SIMD in kernel mode, even in an
interrupt, to powerpc[1], but I couldn't help wonder if it would be
possible without disabling preemption.

The scheduler just has to check the per-cpu in_kernel_fpu, and if it
is set, save the fpu state of the kernel thread, similar to what is
done for user-space threads with use_mode().

This way WireGuard would be fast even on preempt-rt kernels (it
currently turns off SIMD on them). Other crypto in the kernel is
woorse, and just unconditionally turns off preempt for each block of
data (look at arch/x86/crypto/chacha_glue.c ). Note that
kernel_fpu_begin() disables preemption, but I don't believe it has to.

Is there any complications with this approach that I am missing?

-Shawn Landden

[1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-May/190704.html

                 reply	other threads:[~2019-05-18 16:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CA+49okpOX5-N33BLPEEeBTW4Wcn7sBWog7cBNT=ENLvOZ_MKVQ@mail.gmail.com' \
    --to=slandden@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=wireguard@lists.zx2c4.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).