Re: [PATCH 2/4] x86/cpuid: refactor setup_clear_cpu_cap/clear_feature

From: Maxim Levitsky
Date: Wed Jun 22 2022 - 12:01:00 EST


On Wed, 2022-06-22 at 08:07 -0700, Dave Hansen wrote:
> On 6/22/22 07:48, Maxim Levitsky wrote:
> > Simplify the code a bit by always passing &boot_cpu_data
> > in case the setup_clear_cpu_cap was called.
> >
> > Also unify clear_cpu_cap and do_clear_cpu_cap.
>
> Please always add a "()" suffix to functions. "foo" is a variable, but
> "foo()" is a function.
Will do next time!


>
> I also really like when a changelog has a clear problem statement. I
> _think_ the problem here is something along the lines of the 'c'
> argument to clear_feature() having different behavior when it is NULL
> versus '&boot_cpu_data'.

To be honest I didn't try to fix any problem here, I just wanted to simplify
clear_feature() a bit by avoiding a recursive call to clear_cpu_cap.

>
> Basically, there's no reason to support clearing a bit in
> '&boot_cpu_data' without also setting that bit in 'cpu_caps_cleared'.

> > {
> > - do_clear_cpu_cap(NULL, feature);
> > + clear_cpu_cap(&boot_cpu_data, feature);
> > }

I'll try to think about a better changelog message for this.

Thank you!
Best regards,
Maxim Levitsky