Re: [PATCH v2 4/6] x86/MCE: Make number of MCA banks per_cpu

From: Borislav Petkov
Date: Tue Apr 16 2019 - 09:55:18 EST


On Thu, Apr 11, 2019 at 08:18:03PM +0000, Ghannam, Yazen wrote:
> @@ -1478,15 +1480,16 @@ EXPORT_SYMBOL_GPL(mce_notify_irq);
>
> static int __mcheck_cpu_mce_banks_init(void)
> {
> + u8 n_banks = this_cpu_read(mce_num_banks);
> int i;
>
> per_cpu(mce_banks, smp_processor_id()) =
> - kcalloc(MAX_NR_BANKS, sizeof(struct mce_bank), GFP_KERNEL);
> + kcalloc(n_banks, sizeof(struct mce_bank), GFP_KERNEL);
>
> if (!this_cpu_read(mce_banks))
> return -ENOMEM;
>
> - for (i = 0; i < MAX_NR_BANKS; i++) {
> + for (i = 0; i < n_banks; i++) {
> struct mce_bank *b = &this_cpu_read(mce_banks)[i];
>
> b->ctl = -1ULL;
> @@ -1507,10 +1510,15 @@ static int __mcheck_cpu_cap_init(void)
> rdmsrl(MSR_IA32_MCG_CAP, cap);
>
> b = cap & MCG_BANKCNT_MASK;
> - if (WARN_ON_ONCE(b > MAX_NR_BANKS))
> + pr_debug("CPU%d supports %d MCE banks\n", smp_processor_id(), b);

What for?

You're removing the "Using" message because, yeah, it was worthless to
people. If anyone wants to count the banks:

$ ls /sys/devices/system/machinecheck/machinecheck0/bank* | wc -l
23

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.