Re: [GIT PULL] EDAC updates for v6.9

From: Borislav Petkov
Date: Tue Mar 12 2024 - 03:45:39 EST


On Mon, Mar 11, 2024 at 06:12:54PM -0700, Linus Torvalds wrote:
> Ho humm. Lookie here:
>
> static inline unsigned int topology_amd_nodes_per_pkg(void)
> { return 0; };
>
> that's the UP case.
>
> Yeah, I'm assuming nobody tests this for UP,

Unless it gets randomly enabled in my randconfig builds once in a blue
moon, I'd say pretty seldomly. I've heard people raise the question
multiple times whether we should simply make CONFIG_SMP default y on x86
and frankly, it'll get rid of a whole bunch of stupid corner cases like
that...

> but it's clearly wrong to potentially do that modulus by zero.

Yep.

> So I made the merge also change that UP case of
> topology_amd_nodes_per_pkg() to return 1.
>
> Because dammit, not only is a mod-by-zero wrong, a UP system most
> definitely has one node per package, not zero.

Yap, that's the the straight-forward thing to do, thanks for fixing it!

--
Regards/Gruss,
Boris.

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