* Allowing SIMD in kernel mode without disabling preemption
@ 2019-05-18 16:27 ` Shawn Landden
0 siblings, 0 replies; 2+ messages in thread
From: Shawn Landden @ 2019-05-18 16:27 UTC (permalink / raw)
To: linux-rt-users, peterz, wireguard
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Allowing SIMD in kernel mode without disabling preemption
@ 2019-05-18 16:27 ` Shawn Landden
0 siblings, 0 replies; 2+ messages in thread
From: Shawn Landden @ 2019-05-18 16:27 UTC (permalink / raw)
To: linux-rt-users, peterz, wireguard
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
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-18 16:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-18 16:27 Allowing SIMD in kernel mode without disabling preemption Shawn Landden
2019-05-18 16:27 ` Shawn Landden
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.