[PATCH] hyperv: fix the number of threads per core

The operands were reversed, producing an incorrect result. Co-authored-by: Sri Ramanujam <sramanujam@datto.com> Signed-off-by: Matt Coleman <matt@datto.com> --- src/hyperv/hyperv_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 20d372b274..9b181ebfff 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -310,7 +310,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) } info->cores = processorList->data.common->NumberOfCores; - info->threads = info->cores / processorList->data.common->NumberOfLogicalProcessors; + info->threads = processorList->data.common->NumberOfLogicalProcessors / info->cores; info->cpus = info->sockets * info->cores; result = 0; -- 2.27.0

On 9/16/20 12:27 AM, Matt Coleman wrote:
The operands were reversed, producing an incorrect result.
Co-authored-by: Sri Ramanujam <sramanujam@datto.com> Signed-off-by: Matt Coleman <matt@datto.com> --- src/hyperv/hyperv_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 20d372b274..9b181ebfff 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -310,7 +310,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) }
info->cores = processorList->data.common->NumberOfCores; - info->threads = info->cores / processorList->data.common->NumberOfLogicalProcessors; + info->threads = processorList->data.common->NumberOfLogicalProcessors / info->cores; info->cpus = info->sockets * info->cores;
result = 0;
Yep, NumberOfLogicalProcessors includes threads: https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor#... Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal
participants (2)
-
Matt Coleman
-
Michal Privoznik