RE: [PATCH v3 06/10] x86/mce: Break up __mcheck_cpu_apply_quirks()

From: Zhuo, Qiuxu
Date: Tue Oct 29 2024 - 21:39:57 EST


Hi Yazen,

> From: Yazen Ghannam <yazen.ghannam@xxxxxxx>
> [...]
> > +static void apply_quirks_amd(struct cpuinfo_x86 *c) {
> > + struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
> > + struct mca_config *cfg = &mca_cfg;
> > +
> > + /* This should be disabled by the BIOS, but isn't always */
> > + if (c->x86 == 15 && this_cpu_read(mce_num_banks) > 4) {
> > + /*
> > + * disable GART TBL walk error reporting, which
> > + * trips off incorrectly with the IOMMU & 3ware
> > + * & Cerberus:
> > + */
> > + clear_bit(10, (unsigned long *)&mce_banks[4].ctl);
> > + }
>
> Newline here please.

OK.
Will update it in next version.

> > + if (c->x86 < 0x11 && cfg->bootlog < 0) {
> > + /*
> > + * Lots of broken BIOS around that don't clear them
> > + * by default and leave crap in there. Don't log:
> > + */
> > + cfg->bootlog = 0;
> > + }
>
> And here.

And will update it in next version.

> [...]

> > +static void apply_quirks_intel(struct cpuinfo_x86 *c) {
> > + struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
> > + struct mca_config *cfg = &mca_cfg;
>
> Is there a benefit to this pointer? We use mca_cfg.FIELD in most other places.

This could make the diff smaller for easier review, and I also believe that fewer direct
uses of global variables in functions are better. Additionally, there are multiple uses of
'mca_cfg' in the function, the local variable 'cfg' is shorter and more convenient to use.

[ Certainly, if the global variable 'mca_cfg' is only used once in the function, directly
using it might be more convenient. ]

Just from my perspective, no strong preference. 😊

-Qiuxu