Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-02-04 Thread Borislav Petkov
On Wed, Feb 03, 2021 at 04:10:24AM +, Bae, Chang Seok wrote: > Okay, how about: > “ > This alignment bit is set if the state is saved on a 64B-aligned address in > the compacted format buffer. > " I'd prefer: /* * True if the buffer of the corresponding XFEATURE is located on the next 64 *

Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-02-02 Thread Bae, Chang Seok
On Jan 26, 2021, at 12:17, Borislav Petkov wrote: > On Wed, Dec 23, 2020 at 07:57:03AM -0800, Chang S. Bae wrote: >> >> +int alloc_xstate_buffer(struct fpu *fpu, u64 mask) >> +if (newsz > fpu_kernel_xstate_max_size) { >> +pr_warn_once("x86/fpu: xstate buffer too large (%u > %u

Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-02-02 Thread Bae, Chang Seok
On Jan 27, 2021, at 02:41, Borislav Petkov wrote: > On Wed, Jan 27, 2021 at 01:23:57AM +, Bae, Chang Seok wrote: >> The xstate buffer may expand on the fly. The size has to be correctly >> calculated if needed. CPUID provides essential information for the >> calculation. Instead of reading

Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-01-27 Thread Borislav Petkov
On Wed, Jan 27, 2021 at 01:23:57AM +, Bae, Chang Seok wrote: > The xstate buffer may expand on the fly. The size has to be correctly > calculated if needed. CPUID provides essential information for the > calculation. Instead of reading CPUID repeatedly, store them -- the offset and > size are

Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-01-26 Thread Bae, Chang Seok
On Jan 26, 2021, at 12:17, Borislav Petkov wrote: > On Wed, Dec 23, 2020 at 07:57:03AM -0800, Chang S. Bae wrote: >> >> +/* >> + * @state_mask: >> + * >> + * The state component bitmap. It indicates the saved xstate in >> + * either @state or @state_ptr. The map value starts

Re: [PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2021-01-26 Thread Borislav Petkov
On Wed, Dec 23, 2020 at 07:57:03AM -0800, Chang S. Bae wrote: > diff --git a/arch/x86/include/asm/fpu/types.h > b/arch/x86/include/asm/fpu/types.h > index f5a38a5f3ae1..3fc6dbbe3ede 100644 > --- a/arch/x86/include/asm/fpu/types.h > +++ b/arch/x86/include/asm/fpu/types.h > @@ -336,14 +336,33 @@

[PATCH v3 07/21] x86/fpu/xstate: Introduce helpers to manage dynamic xstate buffers

2020-12-23 Thread Chang S. Bae
The static per-task xstate buffer contains the extended register states -- but it is not expandable at runtime. Introduce runtime methods and new fpu struct fields to support the expansion. fpu->state_mask indicates the saved states per task and fpu->state_ptr points to the dynamically allocated