Skip to contentSkip to conversation

tools/misc/xenpm: fix getting info when some CPUs are offline

PATCH In review Marek Marczykowski-Górecki 2 participants 2 messages Oct 31, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/misc/xenpm: fix getting info when some CPUs are offline

Use physinfo.max_cpu_id instead of physinfo.nr_cpus to get max CPU id. This fixes for example 'xenpm get-cpufreq-para' with smt=off, which otherwise would miss half of the cores.

---
Reported by @tfm1:
https://github.com/QubesOS/qubes-issues/issues/4456

Changes in v2:
- fix off by one error

---
 tools/misc/xenpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/misc/xenpm.c +1 -1
index 86c12ea5fb..65aa4c9d42 100644
@@ -1231,7 +1231,7 @@ int main(int argc, char *argv[])
         xc_interface_close(xc_handle);
         return ret;
     }
-    max_cpu_nr = physinfo.nr_cpus;
+    max_cpu_nr = physinfo.max_cpu_id + 1;
 
     /* calculate how many options match with user's input */
     for ( i = 0; i < ARRAY_SIZE(main_options); i++ )
Signature · 7 lines
2.17.2


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v2 1/1
#1 lore raw
Quoted 5 lines · Marek Marczykowski-Górecki

Use physinfo.max_cpu_id instead of physinfo.nr_cpus to get max CPU id. This fixes for example 'xenpm get-cpufreq-para' with smt=off, which otherwise would miss half of the cores.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel