Re: [PATCH 08/22] x86/fpu: Remove user_fpu_begin()

From: Sebastian Andrzej Siewior
Date: Tue Feb 05 2019 - 13:16:10 EST


On 2019-01-25 16:18:40 [+0100], Borislav Petkov wrote:
> Reviewed-by: Borislav Petkov <bp@xxxxxxx>
thanks.

> Should we do this microoptimization in addition, to save us the
> activation when the kernel thread here:
>
> taskA -> kernel thread -> taskA
>
> doesn't call kernel_fpu_begin() and thus fpu_fpregs_owner_ctx remains
> the same?

This might work now but at the end of the series this case will be
handled. The switch
taskA -> kernel thread

will save taskA's registers. The switch
kernel thread -> taskA

will only set TF flag to restore FPU registers on the return to
userland. The load happens only the ctx pointer is different.

> It would be a bit more correct as it won't invoke the
> trace_x86_fpu_regs_activated() TP in case the FPU context is the same.

The trace point is not wrong. As of now the same context will be loaded
again.

Sebastian