Re: [PATCH RESEND 2/5] x86/MCE: Handle MCA controls in a per_cpu way
From: Borislav Petkov
Date: Tue Apr 09 2019 - 16:34:32 EST
On Mon, Apr 08, 2019 at 06:55:59PM +0000, Ghannam, Yazen wrote:
> We already have the case where some banks are not initialized either
> due to quirks or because they are Read-as-Zero, but we don't try to
> skip creating their files. With this full set (see patch 5), an unused
> bank will return a control value of 0.
So set_bank() is changed to do:
@@ -2088,7 +2097,7 @@ static ssize_t set_bank(struct device *s, struct device_attribute *attr,
if (kstrtou64(buf, 0, &new) < 0)
- if (bank >= mca_cfg.banks)
+ if (bank >= per_cpu(num_banks, s->id))
How would that work if the disabled/not-present bank is in the middle?
The old example: bank3 on CPU5.
> Would that be sufficient to indicate that a bank is not used?
Well, it should not allow for any control bits to be set and it should
have the proper bank number.
> But I do have a couple of thoughts:
> 1) Will missing banks confuse users? As mentioned, we already have the
> case of unused/uninitialized banks today, but we don't skip their file
> creation. a) Will this affect any userspace tools?
I guess it would be easier if we keep creating all files but denote properly
which banks are disabled.
> 2) Is the added complexity for file creation/destruction worth it? As
> mentioned, the file will return 0 for unused/uninitialized banks.
Good mailing practices for 400: avoid top-posting and trim the reply.