From cca149c6e8de5fb3247c07cae884851a19db93c9 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Sat, 11 Sep 2021 12:14:23 +0800 Subject: [PATCH] tools/power turbostat: reduce debug output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mainline inclusion from mainline-v5.0-rc1 commit 0ec712e36c1d5bafe6e65e53a19f136b778866cd category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I47H3V CVE: NA -------------------------------- A recent turbostat release increased topo.max_cpu_num to make it convenient to handle sysfs bitmaps of 32-cpus. But users, who regularly make use of "--debug", then saw a bunch of output for cpus that were not present. Remove that extra output by checking a cpu is online before dumping its info. Signed-off-by: Len Brown Cc: Prarit Bhargava Signed-off-by: Jackie Liu Reviewed-by: 江国庆 Signed-off-by: Zheng Zengkai Reviewed-by: Hanjun Guo Reviewed-by: Xie XiuQi Signed-off-by: Yang Yingliang --- tools/power/x86/turbostat/turbostat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index 99a3bf1bd332..add69424ac54 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -5002,6 +5002,8 @@ void topology_probe() return; for (i = 0; i <= topo.max_cpu_num; ++i) { + if (cpu_is_not_present(i)) + continue; fprintf(outf, "cpu %d pkg %d node %d lnode %d core %d thread %d\n", i, cpus[i].physical_package_id, -- GitLab