Skip to content

Commit a52e735

Browse files
Ahmed S. DarwishKAGA-KOKO
authored andcommitted
tools/x86/kcpuid: Properly align long-description columns
When kcpuid is invoked with "--all --details", the detailed description column is not properly aligned for all bitfield rows: CPUID_0x4_ECX[0x0]: cache_level : 0x1 - Cache Level ... cache_self_init - Cache Self Initialization This is due to differences in output handling between boolean single-bit "bitflags" and multi-bit bitfields. For the former, the bitfield's value is not outputted as it is implied to be true by just outputting the bitflag's name in its respective line. If long descriptions were requested through the --all parameter, properly align the bitflag's description columns through extra tabs. With that, the sample output above becomes: CPUID_0x4_ECX[0x0]: cache_level : 0x1 - Cache Level ... cache_self_init - Cache Self Initialization Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240718134755.378115-3-darwi@linutronix.de
1 parent 39e4700 commit a52e735

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/arch/x86/kcpuid/kcpuid.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,9 @@ static void decode_bits(u32 value, struct reg_desc *rdesc, enum cpuid_reg reg)
449449
if (start == end) {
450450
/* single bit flag */
451451
if (value & (1 << start))
452-
printf("\t%-20s %s%s\n",
452+
printf("\t%-20s %s%s%s\n",
453453
bdesc->simp,
454+
show_flags_only ? "" : "\t\t\t",
454455
show_details ? "-" : "",
455456
show_details ? bdesc->detail : ""
456457
);

0 commit comments

Comments
 (0)