Re: [PATCH] x86/cacheinfo: Don't use cpu_llc_shared_map for !CONFIG_SMP

From: Saurabh Singh Sengar
Date: Thu Aug 18 2022 - 08:29:31 EST


On Thu, Aug 18, 2022 at 01:57:47PM +0200, Borislav Petkov wrote:
> On Wed, Aug 17, 2022 at 09:52:25PM -0700, Saurabh Singh Sengar wrote:
> > Shall I mention here "Non-SMP AMD processor" instead ?
>
> You should explain what that is.
>
> Is that a CONFIG_SMP=n kernel which you boot on a AMD CPU?

Yes, thats correct.

>
> IOW, how do I reproduce the issue you're describing below, here locally?

Boot latest linux kernel on AMD CPU, having CONGIG_SMP=n.
Once booted execute lscpu (just lscpu without any argument ), this will cause segfault.
Please make a note issue is observed with 2.34 version (default lscpu version with
Ubuntu 20.04.4) of lscpu.

Also, if for the above test we take linux kernel code before below commit,
shared_cpu_map file gets created and lscpu just works fine.
b81dce77ced ("cpumask: Fix invalid uniprocessor mask assumption")

>
> Send dmesg pls.
>

dmesg :
We get only 2 lines of dmesg for this segfault.
Step 1: dmesg -c
Step 2: lscpu
Step 3: dmesg
below is the output of step 3.

Dmesg:
[ 6951.530138] lscpu[99034]: segfault at 0 ip 00005557bc9c35ba sp 00007ffced2681c8 error 4 in lscpu[5557bc9c0000+e000]
[ 6951.530145] Code: 4d 39 c2 76 33 48 c1 e9 06 49 89 c8 4c 8d 2c cd 00 00 00 00 44 89 c9 4f 8b 04 c3 83 e1 3f 4d 0f a3 c8 73 14 4c 8b 02 4d 8b 00 <4f> 8b 04 28 49 d3 e8 41 83 e0 01 44 01 c3 48 89 c1 49 39 c4 74 38

> Also, what is the use case?
>

Explained above, putting here more precise steps:
Step 1: Build linux kernel for AMD processor supporting L3 cache with CONFIG_SMP=n.
Step 2: Boot this kernel.
Step 3: Once in command prompt, enter lscpu

If lspu is version 2.34 like the one I have (default with Ubuntu 20.04.4),
segfault will be observed.


> Why would you even build with SMP off?

This is caught in our testing.

>
> Feel free to explain more verbosely what you're trying to accomplish.
>
> Thx.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette

Please let me know if any thing is unclear or need more info reproducing the scenario.

- Saurabh