lkml.org 
[lkml]   [2021]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v7 20/26] x86/fpu/amx: Initialize child's AMX state
    Date
    Assure that a forked child starts AMX registers in the INIT-state.

    Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
    Reviewed-by: Len Brown <len.brown@intel.com>
    Cc: x86@kernel.org
    Cc: linux-kernel@vger.kernel.org
    ---
    Changes from v5:
    * Introduced a new define. (Andy Lutomirski)

    Changes from v4:
    * Added as a new patch. This was missing on previous versions.
    ---
    arch/x86/include/asm/fpu/xstate.h | 3 +++
    arch/x86/kernel/fpu/core.c | 3 +++
    2 files changed, 6 insertions(+)

    diff --git a/arch/x86/include/asm/fpu/xstate.h b/arch/x86/include/asm/fpu/xstate.h
    index dbf0db1df9bf..bd7df0e7fc2b 100644
    --- a/arch/x86/include/asm/fpu/xstate.h
    +++ b/arch/x86/include/asm/fpu/xstate.h
    @@ -80,6 +80,9 @@
    XFEATURE_MASK_INDEPENDENT | \
    XFEATURE_MASK_SUPERVISOR_UNSUPPORTED)

    +/* Volatile states that a child does not inherit. */
    +#define XFEATURE_MASK_CLEARED_ON_CLONE XFEATURE_MASK_XTILE
    +
    #ifdef CONFIG_X86_64
    #define REX_PREFIX "0x48, "
    #else
    diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
    index ed127c4d182b..e8912b5b9369 100644
    --- a/arch/x86/kernel/fpu/core.c
    +++ b/arch/x86/kernel/fpu/core.c
    @@ -299,6 +299,9 @@ int fpu_clone(struct task_struct *dst)
    save_fpregs_to_fpstate(dst_fpu);
    fpregs_unlock();

    + if (xfeatures_mask_all & XFEATURE_MASK_CLEARED_ON_CLONE)
    + dst_fpu->state->xsave.header.xfeatures &= ~XFEATURE_MASK_CLEARED_ON_CLONE;
    +
    set_tsk_thread_flag(dst, TIF_NEED_FPU_LOAD);

    trace_x86_fpu_copy_src(src_fpu);
    --
    2.17.1
    \
     
     \ /
      Last update: 2021-07-10 15:10    [W:4.202 / U:0.176 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site