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
[email protected]
https://lists.zx2c4.com/mailman/listinfo/wireguard

Reply via email to