File lsslot-fix-displaying-cpu-slots-and-caches-with-b-op.patch of Package powerpc-utils.35048

From 01bc16de40385467cd32440da43ff02b0f0e856c Mon Sep 17 00:00:00 2001
From: Tyrel Datwyler <tyreld@linux.ibm.com>
Date: Thu, 1 Feb 2024 07:02:49 +0530
Subject: [PATCH 1/3] lsslot: fix displaying cpu slots and caches with -b
 option

The format string for printing the drc-name, OFDT-node, and drc-index in
list_cpus_and_caches() contains a spurious '%' qualifier at the end of
the string. Historically, this was ignored by compilers and the string
populated anyways. However, we since observed lsslot built on SLES 15
SP6 where the string is not populated.

Removing the spurious '%' fixes the issue.

Without patch:
localhost:~ # lsslot -c cpu -b
drc-name  OFDT-node         drc_index  thread id(s)     l2-cache       l3-cache
28 29 2a 2b 2c 2d 2e 2f  N/A            N/A
20 21 22 23 24 25 26 27  N/A            N/A
18 19 1a 1b 1c 1d 1e 1f  N/A            N/A
10 11 12 13 14 15 16 17  N/A            N/A
8 9 a b c d e f  N/A            N/A
0 1 2 3 4 5 6 7  N/A            N/A

With patch:
localhost:~/powerpc-utils # ./src/drmgr/lsslot -c cpu -b
drc-name  OFDT-node         drc_index  thread id(s)     l2-cache       l3-cache
CPU 41    PowerPC,POWER10@28  10000028   28 29 2a 2b 2c 2d 2e 2f  N/A            N/A
CPU 33    PowerPC,POWER10@20  10000020   20 21 22 23 24 25 26 27  N/A            N/A
CPU 25    PowerPC,POWER10@18  10000018   18 19 1a 1b 1c 1d 1e 1f  N/A            N/A
CPU 17    PowerPC,POWER10@10  10000010   10 11 12 13 14 15 16 17  N/A            N/A
CPU 9     PowerPC,POWER10@8   10000008   8 9 a b c d e f  N/A            N/A
CPU 1     PowerPC,POWER10@0   10000000   0 1 2 3 4 5 6 7  N/A            N/A

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
 src/drmgr/lsslot_chrp_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/drmgr/lsslot_chrp_cpu.c b/src/drmgr/lsslot_chrp_cpu.c
index 2a8407b..af87e4e 100644
--- a/src/drmgr/lsslot_chrp_cpu.c
+++ b/src/drmgr/lsslot_chrp_cpu.c
@@ -86,7 +86,7 @@ list_cpus_and_caches(struct dr_info *dr_info)
 	struct thread *t;
 	int thread_id_field_sz = 17;
 	char *fmt_s = "%-10s%-18s%-11s%-17s%-15s%-15s\n";
-	char *fmt = "%-10s%-18s%-11x%";
+	char *fmt = "%-10s%-20s%-11x";
 	char *fmt_caches = "%-15s%-15s\n";
 
 	printf(fmt_s, "drc-name", "OFDT-node", "drc_index", "thread id(s)",
-- 
2.43.0

openSUSE Build Service is sponsored by