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: <c928d9aa-1609-4f5f-943c-fec72091e989@intel.com>
Date: Fri, 18 Oct 2024 12:44:00 -0700
From: Sohil Mehta <sohil.mehta@...el.com>
To: Qiuxu Zhuo <qiuxu.zhuo@...el.com>, <tony.luck@...el.com>, <bp@...en8.de>
CC: <tglx@...utronix.de>, <dave.hansen@...ux.intel.com>, <mingo@...hat.com>,
	<hpa@...or.com>, <x86@...nel.org>, <linux-edac@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 06/10] x86/mce: Convert multiple if () statements into
 a switch() statement

> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
> index 725c1d6fb1e5..40672fe0991a 100644
> --- a/arch/x86/kernel/cpu/mce/core.c
> +++ b/arch/x86/kernel/cpu/mce/core.c
> @@ -1892,7 +1892,8 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
>  	}
>  
>  	/* This should be disabled by the BIOS, but isn't always */

This comment is specific to the AMD and placing it before the switch
makes it seem generic to the entire switch statement. It should probably
be moved inside the AMD case just above the disable GART TLB check.

> -	if (c->x86_vendor == X86_VENDOR_AMD) {
> +	switch (c->x86_vendor) {
> +	case X86_VENDOR_AMD:
>  		if (c->x86 == 15 && this_cpu_read(mce_num_banks) > 4) {
>  			/*
>  			 * disable GART TBL walk error reporting, which
> @@ -1925,9 +1926,9 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
>  		if (c->x86 >= 0x17 && c->x86 <= 0x1A)
>  			mce_flags.zen_ifu_quirk = 1;
>  
> -	}
> +		break;
>  


Also, why not include the unknown vendor check (right above) inside the
switch case as well?

if (c->x86_vendor == X86_VENDOR_UNKNOWN) {
	pr_info("unknown CPU type - not enabling MCE support\n");
	return -EOPNOTSUPP;
}

This seems to follow the same pattern as others and can be the first
case inside the switch.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ