Re: [PATCH] x86, mce: Don't initialize MCEs on unknown CPUs

From: Ingo Molnar
Date: Mon Aug 17 2009 - 07:58:10 EST



* Andi Kleen <ak@xxxxxxxxxxxxxxx> wrote:

> Ingo Molnar wrote:
>
>>
>> btw., i found the bug - it's due to:
>>
>> # CONFIG_CPU_SUP_INTEL is not set
>
> Ah, thanks for debugging. Very tricky and nasty. Perhaps these options are more trouble
> than what they save in code.
>
>> static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)
>> @@ -1342,11 +1352,10 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
>> if (!mce_available(c))
>> return;
>> - if (mce_cap_init() < 0) {
>> + if (mce_cap_init() < 0 || mce_cpu_quirks(c) < 0) {
>> mce_disabled = 1;
>> return;
>> }
>> - mce_cpu_quirks(c);
>
> I'm very pedantic here and it's more a theoretical problem, but
> mce_cap_init() allocates memory which you leak and this could
> rerun on each CPU hotplug. So if you have a unknown CPU and do a
> lot of CPU hotadds in a loop then you would eventually fill all
> memory. Better kfree() the bank arrays.

Not really, we dont re-run mce_cap_init() if MCE is disabled so
there's no memory leak that would fill all memory.

Ingo
--
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/