[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRVVyI2RDVzFplnn@zn.tnic>
Date: Thu, 12 Aug 2021 19:09:28 +0200
From: Borislav Petkov <bp@...en8.de>
To: "Chang S. Bae" <chang.seok.bae@...el.com>
Cc: luto@...nel.org, tglx@...utronix.de, mingo@...nel.org,
x86@...nel.org, len.brown@...el.com, dave.hansen@...el.com,
thiago.macieira@...el.com, jing2.liu@...el.com,
ravi.v.shankar@...el.com, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH v9 07/26] x86/fpu/xstate: Convert the struct fpu 'state'
field to a pointer
On Fri, Jul 30, 2021 at 07:59:38AM -0700, Chang S. Bae wrote:
> diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h
> index f5a38a5f3ae1..c7826708f27f 100644
> --- a/arch/x86/include/asm/fpu/types.h
> +++ b/arch/x86/include/asm/fpu/types.h
> @@ -339,13 +339,30 @@ struct fpu {
> /*
> * @state:
> *
> - * In-memory copy of all FPU registers that we save/restore
> - * over context switches. If the task is using the FPU then
> - * the registers in the FPU are more recent than this state
> - * copy. If the task context-switches away then they get
> - * saved here and represent the FPU state.
> + * A pointer to indicate the in-memory copy of all FPU registers
> + * that are saved/restored over context switches.
> + *
> + * Initially @state points to @__default_state. When dynamic states
> + * get used, a memory is allocated for the larger state copy and
> + * @state is updated to point to it. Then, the state in ->state
> + * supersedes and invalidates the state in @__default_state.
> + *
> + * In general, if the task is using the FPU then the registers in
> + * the FPU are more recent than the state copy. If the task
> + * context-switches away then they get saved in ->state and
> + * represent the FPU state.
> + */
> + union fpregs_state *state;
> +
> + /*
> + * @__default_state:
> + *
> + * Initial in-memory copy of all FPU registers that saved/restored
> + * over context switches. When the task is switched to dynamic
> + * states, this copy is replaced with the new in-memory copy in
> + * ->state.
> */
> - union fpregs_state state;
> + union fpregs_state __default_state;
> /*
> * WARNING: 'state' is dynamically-sized. Do not put
^^^^^^
that needs to be __default_state as it is which is dynamically-sized.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists