Re: [PATCH 23/27] x86/fpu: Defer FPU state load until return to userspace

From: Sebastian Andrzej Siewior
Date: Mon Apr 15 2019 - 05:14:51 EST


On 2019-04-12 19:29:31 [+0200], Borislav Petkov wrote:
> > - in kernel_fpu_begin() we may trash the task's FPU state (by saving its
> > registers or by resetting fpu_fpregs_owner_ctx).
>
> Do we care?
>
> You mean, in case you have workloads which might involve a lot of
> in-kernel FPU use which would punish task context switches?

Well, depends how you look on it. So for instance:
- Does kernel_fpu_begin() save task's FPU registers or are they already
stored and it is a nop.
- The task avoid loading its registers on return to userland but that
FPU usage in BH made it impossible.
- Is there any FPU usage in BH?

And there is this: My program usually works but with this scheduling
pattern and FPU usage in kernel it computes wrong result.

Sebastian