Re: [PATCH] x86/mce: Increase maximum number of banks to 64

From: Borislav Petkov
Date: Tue Aug 25 2020 - 14:34:40 EST


On Mon, Aug 24, 2020 at 10:11:05AM -0500, Yazen Ghannam wrote:
> Thanks. Yeah, they're identical:
> text data bss dec hex filename
> 15710076 13519306 5398528 34627910 2106146 vmlinux-32banks
> 15710076 13519306 5398528 34627910 2106146 vmlinux-64banks

So I went crazy here and built allmodconfigs for hypothetical CPUs which
support up to 4K MCA banks:

text data bss dec hex filename
24618040 27211906 35409988 87239934 5332cfe vmlinux-32banks
24618040 27211906 35409988 87239934 5332cfe vmlinux-64banks
24618040 27211906 35409988 87239934 5332cfe vmlinux-128banks

For the first three - up to 128 banks, the sizes don't change.

24618000 27216002 35401796 87235798 5331cd6 vmlinux-256banks

Somewhere after 128 banks, it grows the data section but by exactly 4K,
i.e., one more page:

27216002 - 27211906 = 4096

The last page is not full, of course.

27216002 % 4096 = 2178
27211906 % 4096 = 2178

24618000 27220098 35401796 87239894 5332cd6 vmlinux-512banks

The same happens here.

27220098 - 27216002 = 4096
27220098 % 4096 = 2178

And so on:

24618000 27228290 35393604 87239894 5332cd6 vmlinux-1024banks
24618000 27244674 35377220 87239894 5332cd6 vmlinux-2048banks
24618000 27277442 35344452 87239894 5332cd6 vmlinux-4Kbanks

So what I think happens is, the first 128 banks fit within the same
.data section page thus vmlinux doesn't increase.

I guess there might be a .config which could cause that data increase
when the 32->64 banks move won't fit in the last .data page. It depends
on where those ~2K you computed and I snipped, land.

But since most kernels are allmodconfig builds, I guess we should be
fine.

So yeah, I guess we can take this one after you summarize the findings
of this thread in v2's commit message. :-)

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette