Re: [PATCH v2] x86: fpu: Keep xfd_state always in sync with MSR_IA32_XFD

From: Thomas Gleixner
Date: Fri May 12 2023 - 08:53:17 EST


On Fri, May 12 2023 at 11:38, Adamos Ttofari wrote:
> if (cpu_feature_enabled(X86_FEATURE_XFD))
> - wrmsrl(MSR_IA32_XFD, init_fpstate.xfd);
> + xfd_set_state(init_fpstate.xfd);

> @@ -914,8 +915,7 @@ void fpu__resume_cpu(void)
> xfeatures_mask_independent());
> }
>
> - if (fpu_state_size_dynamic())
> - wrmsrl(MSR_IA32_XFD, current->thread.fpu.fpstate->xfd);
> + xfd_update_state(current->thread.fpu.fpstate);

How is that supposed to work?

this_cpu(xfd_state) == current->thread.fpu.fpstate->xfd

So the MSR write won't happen.

Thanks,

tglx