fix: arm64: collapse per-core CPU info lists to a single line (#576)

Store the per-core implementer/part/arch/variant/revision lists
space-separated (no embedded newlines, which also cleans up JSON and
prometheus output) and dedup them for the human-readable display, so
homogeneous systems show e.g. "0x41" instead of repeating it per core.
This commit is contained in:
Stéphane Lesimple
2026-06-02 17:21:31 +00:00
committed by GitHub
parent 645a79846b
commit 7d9345a32f
2 changed files with 21 additions and 8 deletions
+9 -3
View File
@@ -384,6 +384,12 @@ check_kernel_info() {
fi
}
# Collapse a whitespace-separated list to its unique values, preserving first-seen order.
# Used to prettify the per-core ARM lists for display (e.g. "0x41 0x41 0x41 0x41" -> "0x41").
_uniq_list() {
echo "$1" | awk '{ for (i = 1; i <= NF; i++) if (!seen[$i]++) printf "%s%s", (n++ ? " " : ""), $i }'
}
# Display hardware-level CPU mitigation support (microcode features, ARCH_CAPABILITIES, etc.)
check_cpu() {
local capabilities ret spec_ctrl_msr codename ucode_str
@@ -393,13 +399,13 @@ check_cpu() {
pr_info " * Vendor: $cpu_vendor"
pr_info " * Model name: $cpu_friendly_name"
if [ -n "${cpu_impl_list:-}" ]; then
pr_info " * Implementer(s): $cpu_impl_list"
pr_info " * Implementer(s): $(_uniq_list "$cpu_impl_list")"
fi
if [ -n "${cpu_part_list:-}" ]; then
pr_info " * Part(s): $cpu_part_list"
pr_info " * Part(s): $(_uniq_list "$cpu_part_list")"
fi
if [ -n "${cpu_arch_list:-}" ]; then
pr_info " * Architecture(s): $cpu_arch_list"
pr_info " * Architecture(s): $(_uniq_list "$cpu_arch_list")"
fi
if has_runtime; then
pr_info_nol " * Running as VM guest: "