tools/power/turbostat: Obey allowed CPUs when accessing CPU counters
authorZhang Rui <rui.zhang@intel.com>
Wed, 4 Oct 2023 05:52:02 +0000 (13:52 +0800)
committerZhang Rui <rui.zhang@intel.com>
Fri, 20 Oct 2023 02:27:09 +0000 (10:27 +0800)
for_all_cpus/for_all_cpus_2 are used for accessing the per CPU counters,
and they should follow the cpu_allowed_set instead of cpu_present_set.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
tools/power/x86/turbostat/turbostat.c

index d8f44ea5b4bf903944fc515f0385a5c1f1a38d06..202cf5231d7a51fcbc0460cd5a6f6a6a64ea6b93 100644 (file)
@@ -1182,7 +1182,7 @@ int for_all_cpus(int (func) (struct thread_data *, struct core_data *, struct pk
 
                                        t = GET_THREAD(thread_base, thread_no, core_no, node_no, pkg_no);
 
-                                       if (cpu_is_not_present(t->cpu_id))
+                                       if (cpu_is_not_allowed(t->cpu_id))
                                                continue;
 
                                        c = GET_CORE(core_base, core_no, node_no, pkg_no);
@@ -3618,7 +3618,7 @@ int for_all_cpus_2(int (func) (struct thread_data *, struct core_data *,
 
                                        t = GET_THREAD(thread_base, thread_no, core_no, node_no, pkg_no);
 
-                                       if (cpu_is_not_present(t->cpu_id))
+                                       if (cpu_is_not_allowed(t->cpu_id))
                                                continue;
 
                                        t2 = GET_THREAD(thread_base2, thread_no, core_no, node_no, pkg_no);