[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <B7F1A300-3E61-4CB4-8BCA-316FE68B7222@intel.com>
Date: Sun, 3 Oct 2021 22:35:41 +0000
From: "Bae, Chang Seok" <chang.seok.bae@...el.com>
To: Thomas Gleixner <tglx@...utronix.de>
CC: "bp@...e.de" <bp@...e.de>, "Lutomirski, Andy" <luto@...nel.org>,
"mingo@...nel.org" <mingo@...nel.org>,
"x86@...nel.org" <x86@...nel.org>,
"Brown, Len" <len.brown@...el.com>,
"lenb@...nel.org" <lenb@...nel.org>,
"Hansen, Dave" <dave.hansen@...el.com>,
"Macieira, Thiago" <thiago.macieira@...el.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Shankar, Ravi V" <ravi.v.shankar@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [PATCH v10 04/28] x86/fpu/xstate: Modify address finders to
handle both static and dynamic buffers
On Oct 1, 2021, at 06:15, Thomas Gleixner <tglx@...utronix.de> wrote:
> On Wed, Aug 25 2021 at 08:53, Chang S. Bae wrote:
>
>> Have all the functions finding XSTATE address take a struct fpu * pointer
>> in preparation for dynamic state buffer support.
>>
>> init_fpstate is a special case, which is indicated by a null pointer
>> parameter to get_xsave_addr() and __raw_xsave_addr().
>
> Same comment vs. subject. Prepare ...
How about:
"Prepare address finders to handle dynamic features"
>> + if (fpu)
>> + xsave = &fpu->state.xsave;
>> + else
>> + xsave = &init_fpstate.xsave;
>> +
>> + return xsave + xstate_comp_offsets[xfeature_nr];
>
> So you have the same conditionals and the same comments vs. that NULL
> pointer oddity how many times now all over the place?
>
> That can be completely avoided:
>
> Patch 1:
>
> -union fpregs_state init_fpstate __ro_after_init;
> +static union fpregs_state init_fpstate __ro_after_init;
> +struct fpu init_fpu = { .state = &init_fpstate } __ro_after_init;
>
> and make all users of init_fpstate access it through init_fpu.
>
> Patches 2..N which change arguments from fpregs_state to fpu:
>
> - fun(init_fpu->state);
> + fun(&init_fpu);
>
> Patch M which adds state_mask:
>
> @fpu__init_system_xstate()
> + init_fpu.state_mask = xfeatures_mask_all;
>
> Hmm?
Okay, a NULL pointer is odd and it as an argument should be avoided. Defining
a separate struct fpu for the initial state can make every function expect a
valid struct fpu pointer.
I think that the patch set will have such order (once [1] is dropped out) of,
- patch1 (new): a cleanup patch for fpstate_init_xstate() in patch1
- patch2 (new): the above init_fpu goes into this, and
- patch3-5: changes arguments to fpu,
- patch6 (new): finally patch 6 to add ->state_mask and ->state_size.
…
Thanks,
Chang
[1] https://lore.kernel.org/lkml/20210825155413.19673-2-chang.seok.bae@intel.com/
Powered by blists - more mailing lists