lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a25f878e-83d9-440a-9741-4cf86db4a716@intel.com>
Date: Fri, 13 Sep 2024 08:47:52 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: Borislav Petkov <bp@...en8.de>, Tony W Wang-oc <TonyWWang-oc@...oxin.com>
Cc: tglx@...utronix.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
 x86@...nel.org, hpa@...or.com, tony.luck@...el.com,
 linux-kernel@...r.kernel.org, linux-edac@...r.kernel.org,
 CobeChen@...oxin.com, TimGuo@...oxin.com, LeoLiu-oc@...oxin.com,
 Lyle Li <LyleLi@...oxin.com>
Subject: Re: [PATCH v1 1/3] x86/mce: Add centaur vendor to support Zhaoxin MCA

On 9/13/24 07:27, Borislav Petkov wrote:
>> +	if (c->x86_vendor == X86_VENDOR_CENTAUR) {
>> +		/*
>> +		 * All newer Centaur CPUs support MCE broadcasting. Enable
>> +		 * synchronization with a one second timeout.
>> +		 */
>> +		if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) ||
>> +		     c->x86 > 6) {
>> +			if (cfg->monarch_timeout < 0)
>> +				cfg->monarch_timeout = USEC_PER_SEC;
>> +		}
>> +	}
> So if centaur == zhaoxin, why aren't you moving this hunk to
> mce_zhaoxin_feature_init() instead?

The centaur and zhaoxin logic is also _really_ close here:

>                 if (c->x86 > 6 || (c->x86_model == 0x19 || c->x86_model == 0x1f)) {
>                         if (cfg->monarch_timeout < 0)
>                                 cfg->monarch_timeout = USEC_PER_SEC;
>                 }

vs

>         if ((c->x86 == 6 && c->x86_model == 0xf && c->x86_stepping >= 0xe) ||
>              c->x86 > 6) {
>                 if (cfg->monarch_timeout < 0)
>                         cfg->monarch_timeout = USEC_PER_SEC;
>         }

I'd just randomly guess that the zhaoxin version is buggy because it
doesn't do a c->x86 check before the "(c->x86_model == 0x19 ||
c->x86_model == 0x1f)".

So instead of copying and pasting the same block over and over, can we
consolidate it a bit?

foo()
{
	/* Older CPUs do not do MCE broadcast: */
	if (c->x86 < 6)
		return;
	/* All newer ones do: */
	if (c->x86 > 6)
		goto mce_broadcast;

	/* Family 6 is mixed: */
	if (c->x86_vendor == X86_VENDOR_CENTAUR) {
		if (c->x86_model == 0xf &&
		    c->x86_stepping >= 0xe)
			goto mce_broadcast;
	} else if (c->x86_vendor == X86_VENDOR_ZHAOXIN) {
		if (c->x86_model == 0x19 ||
		    c->x86_model == 0x1f))
			goto mce_broadcast;
	}

	return;

mce_broadcast:
	if (cfg->monarch_timeout < 0)
		cfg->monarch_timeout = USEC_PER_SEC;
}


Heck, the Intel code can even go in there I think.  Wouldn't that tell
the story a bit better?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ