On Feb 19, 2021, at 07:00, Borislav Petkov <b...@suse.de> wrote:
> On Wed, Dec 23, 2020 at 07:57:07AM -0800, Chang S. Bae wrote:
>> 
>> 
>> +/*
>> + * Available once those arrays for the offset, size, and alignment info are 
>> set up,
>> + * by setup_xstate_features().
>> + */
> 
> That's kinda clear, right? Apparently, we do cache FPU attributes in
> xstate.c so what is that comment actually trying to tell us? Or do you
> want to add some sort of an assertion to this function in case it gets
> called before setup_xstate_features()?

Yes, it looks apparent without saying that. I don’t think assertion needed.

> I think you should simply add kernel-doc style comment explaining what
> the inputs are and what the function gives, which would be a lot more
> useful.

Maybe something like this:

/**
 * get_xstate_comp_offset() - Find the feature's offset in the compacted format
 * @mask:               This bitmap tells which components reserved in the 
format.
 * @feature_nr: Feature number
 *
 * Returns:             The offset value
 */

>> +static unsigned int get_xstate_comp_offset(struct fpu *fpu, int feature_nr)
>> +{
>> +    return __get_xstate_comp_offset(fpu->state_mask, feature_nr);
>> +}
> 
> Just get rid of the __ variant and have a single function with the
> following signature:
> 
>       static unsigned int get_xstate_comp_offset(u64 mask, int feature_nr)

Yeah, I should have done like this.

Thanks,
Chang

Reply via email to