[PATCH v2 1/3] lsslot: fix displaying cpu slots and caches with -b option

3 views
Skip to first unread message

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Feb 6, 2024, 8:10:39 PMFeb 6
to powerpc-utils-devel@googlegroups.com, Tyrel Datwyler
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 <tyr...@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 2a8407b8568e..af87e4e5e9ea 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

Tyrel Datwyler

<tyreld@linux.ibm.com>
unread,
Feb 7, 2024, 2:03:04 PMFeb 7
to powerpc-utils-devel@googlegroups.com
Reply all
Reply to author
Forward
0 new messages