parisc: Fix /proc/cpuinfo output for lscpu
authorHelge Deller <deller@gmx.de>
Fri, 18 Aug 2023 20:48:04 +0000 (22:48 +0200)
committerHelge Deller <deller@gmx.de>
Tue, 22 Aug 2023 08:24:46 +0000 (10:24 +0200)
The lscpu command is broken since commit cab56b51ec0e ("parisc: Fix
device names in /proc/iomem") added the PA pathname to all PA
devices, includig the CPUs.

lscpu parses /proc/cpuinfo and now believes it found different CPU
types since every CPU is listed with an unique identifier (PA
pathname).

Fix this problem by simply dropping the PA pathname when listing the
CPUs in /proc/cpuinfo. There is no need to show the pathname in this
procfs file.

Fixes: cab56b51ec0e ("parisc: Fix device names in /proc/iomem")
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: <stable@vger.kernel.org> # v4.9+
arch/parisc/kernel/processor.c

index 762289b9984ea32d0e6006101d8296dfad7d24b8..a0e2d37c5b3b530818b22069b09bba9e88418936 100644 (file)
@@ -378,10 +378,18 @@ int
 show_cpuinfo (struct seq_file *m, void *v)
 {
        unsigned long cpu;
+       char cpu_name[60], *p;
+
+       /* strip PA path from CPU name to not confuse lscpu */
+       strlcpy(cpu_name, per_cpu(cpu_data, 0).dev->name, sizeof(cpu_name));
+       p = strrchr(cpu_name, '[');
+       if (p)
+               *(--p) = 0;
 
        for_each_online_cpu(cpu) {
-               const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
 #ifdef CONFIG_SMP
+               const struct cpuinfo_parisc *cpuinfo = &per_cpu(cpu_data, cpu);
+
                if (0 == cpuinfo->hpa)
                        continue;
 #endif
@@ -426,8 +434,7 @@ show_cpuinfo (struct seq_file *m, void *v)
 
                seq_printf(m, "model\t\t: %s - %s\n",
                                 boot_cpu_data.pdc.sys_model_name,
-                                cpuinfo->dev ?
-                                cpuinfo->dev->name : "Unknown");
+                                cpu_name);
 
                seq_printf(m, "hversion\t: 0x%08x\n"
                                "sversion\t: 0x%08x\n",