# HG changeset patch # User Taylor R Campbell # Date 1593986494 0 # Sun Jul 05 22:01:34 2020 +0000 # Branch trunk # Node ID e3ed1cb517acd719687149cf86009853595595c5 # Parent ccf3ee876dd2fa7edc8531fa6e52bbc168efa9ca WIP: fpu_save_lwp: try to avoid stts/MDL_FPU_IN_CPU race diff -r ccf3ee876dd2 -r e3ed1cb517ac sys/arch/x86/x86/fpu.c --- a/sys/arch/x86/x86/fpu.c Sun Jul 05 14:24:05 2020 +0000 +++ b/sys/arch/x86/x86/fpu.c Sun Jul 05 22:01:34 2020 +0000 @@ -155,8 +155,28 @@ fpu_save_lwp(struct lwp *l) kpreempt_disable(); if (l->l_md.md_flags & MDL_FPU_IN_CPU) { KASSERT((l->l_flag & LW_SYSTEM) == 0); +#if 1 + /* XXX inline fpu_area_save */ + switch (x86_fpu_save) { + case FPU_SAVE_FSAVE: + fnsave(area); + break; + case FPU_SAVE_FXSAVE: + fxsave(area); + break; + case FPU_SAVE_XSAVE: + xsave(area, x86_xsave_features); + break; + case FPU_SAVE_XSAVEOPT: + xsaveopt(area, x86_xsave_features); + break; + } + l->l_md.md_flags &= ~MDL_FPU_IN_CPU; + stts(); +#else fpu_area_save(area, x86_xsave_features); l->l_md.md_flags &= ~MDL_FPU_IN_CPU; +#endif } kpreempt_enable(); }