[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241113142530.GA3181969@yaz-khff2.amd.com>
Date: Wed, 13 Nov 2024 09:25:30 -0500
From: Yazen Ghannam <yazen.ghannam@....com>
To: "Zhuo, Qiuxu" <qiuxu.zhuo@...el.com>
Cc: "bp@...en8.de" <bp@...en8.de>, "Luck, Tony" <tony.luck@...el.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"mingo@...hat.com" <mingo@...hat.com>,
"hpa@...or.com" <hpa@...or.com>,
"Mehta, Sohil" <sohil.mehta@...el.com>,
"nik.borisov@...e.com" <nik.borisov@...e.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 5/8] x86/mce: Convert family/model mixed checks to
VFM-based checks
On Wed, Nov 13, 2024 at 12:10:31PM +0000, Zhuo, Qiuxu wrote:
> Hi Yazen,
>
> > From: Yazen Ghannam <yazen.ghannam@....com>
> > [...]
> > > @@ -1954,6 +1954,10 @@ static void apply_quirks_intel(struct
> > > cpuinfo_x86 *c) {
> > > struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
> > >
> > > + /* Older CPUs (prior to family 6) don't need quirks. */
> > > + if (c->x86_vfm < INTEL_PENTIUM_PRO)
> > > + return;
> > > +
> >
> > Is it possible for pre-"family 6" to get here?
> >
> > Family 5 is "ancient" which has its own MCE init path. And I assume anything
> > older doesn't support MCE/MCA. Is this correct?
>
> Yes, there is an early return in __mcheck_cpu_ancient_init() for Family 5.
> However, this code explicitly indicates that "prior to families 6 don't need quirks"
> and addresses concerns like:
>
> https://lore.kernel.org/all/dcfdba92-7004-413d-8011-12771636d11f@intel.com/
>
Right, but my point is that this check would never be executed, since
the older systems would not get here during init. So this seems like
dead code.
> > > /*
> > > * SDM documents that on family 6 bank 0 should not be written
> > > * because it aliases to another special BIOS controlled @@ -1962,22
> > > +1966,21 @@ static void apply_quirks_intel(struct cpuinfo_x86 *c)
> > > * Don't ignore bank 0 completely because there could be a
> > > * valid event later, merely don't write CTL0.
> > > */
> > > - if (c->x86 == 6 && c->x86_model < 0x1A &&
> > this_cpu_read(mce_num_banks) > 0)
> > > + if (c->x86_vfm < INTEL_NEHALEM_EP &&
> > this_cpu_read(mce_num_banks) >
> > > +0)
> >
> > The "> 0" is not needed, since mce_num_banks is unsigned int.
>
> I don't get your point here.
> But it needs to check for the case where mce_num_banks == 0.
>
The check is "mce_num_banks > 0", and mce_num_banks is an unsigned int.
Therefore, the check is reduced to "mce_num_banks != 0". In this case,
you can just do "if (mce_num_banks)" to the same effect.
Thanks,
Yazen
Powered by blists - more mailing lists