Re: [PATCH] [2/4] x86: MCE: Implement dynamic machine check banks support v5

From: Andi Kleen
Date: Thu Feb 12 2009 - 16:08:19 EST


> Do we need a per cpu count of # of banks to handle one CPU having less
> banks than others case?
> Specifically, I am thinking of sequence:
> - CPU 0 has n banks
> - CPU 0 does below
> for (i = 0; i < banks; i++) {
> err = sysdev_create_file(&per_cpu(device_mce, cpu),
> &bank_attrs[i]);
> - CPU 1, which comes online later, has say n-2 banks. So, banks now becomes n-2.
> - Now whenever CPU 0 does sysdev_remove_file loop below, it will do it only for n-2 banks.

True, that would be a leak without per cpu banks count. Perhaps should take
it out, this is really not supposed to happen anyways. I'm sure
more things would break with an asymetric CPU configuration.

An alternative would be to figure out how to walk the sysfs data
structures for this, but that would be really too much effort
for something that shouldn't happen.

I think I'll just add a WARN_ON() for this case instead.

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