Re: [PATCH 2/8] x86, mce: remove redundant mce_available() checks

From: Hidetoshi Seto
Date: Mon Jun 20 2011 - 00:48:20 EST


(2011/06/17 23:39), Borislav Petkov wrote:
>> @@ -1418,8 +1414,15 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
>> if (__mcheck_cpu_ancient_init(c))
>> return;
>>
>> - if (!mce_available(c))
>> + if (!mce_available(c)) {
>> + /*
>> + * Asymmetric configurations are not supported today.
>> + * If mce_banks is allocated there must be a cpu passed here.
>> + */
>> + WARN_ON(!mce_disabled && mce_banks);
>> + mce_disabled = 1;
>> return;
>> + }
>
> I don't think this will ever happen so why complicate the code
> needlessly? This can only be executed if at least one of the cores on
> the system has CPUID(1)_EDX, bits 7 and 14 cleared and that's just
> silly.

This is a guard against such silly situation, isn't it?
I don't think it looks so complicated and needless.

I think this code will not run on systems with single socket as
long as the processor vendors are in the right mind.
But in cases when it is numa with strange nodes or when it is
migrated to/from misconfigured virtual machine I can't say that
with certainty.

>
> Besides, mcheck_init_device() already confirms we don't support
> MCE-asymmetric configs:
>
> if (!mce_available(&boot_cpu_data))
> return -EIO;

Without above check, mcheck_init_device() will not notice the
issue when boot cpu is mce capable but others are not.

Maybe I should have another patch to do well with silly
configurations, and let this patch to a simple cleanup.


Thanks,
H.Seto

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/