aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Liu <zhao1.liu@intel.com>2023-06-28 21:54:35 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2023-09-11 10:53:50 +0300
commit056bada5d2fab42fa0b262dac29a83495bc08e80 (patch)
tree4a56c4be986f65157b5c45ef4189149d509df2b7
parent9bb8c4fb6bc376202589d52406efd67e4ef820a2 (diff)
hw/smbios: Fix smbios_smp_sockets caculation
smp.sockets is the number of sockets which is configured by "-smp" ( otherwise, the default is 1). Trying to recalculate it here with another rules leads to errors, such as: 1. 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology") changes the meaning of smp.cores but doesn't fix original smp.cores uses. With the introduction of cluster, now smp.cores means the number of cores in one cluster. So smp.cores * smp.threads just means the threads in a cluster not in a socket. 2. On the other hand, we shouldn't use smp.cpus here because it indicates the initial number of online CPUs at the boot time, and is not mathematically related to smp.sockets. So stop reinventing the another wheel and use the topo values that has been calculated. Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology") Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Message-Id: <20230628135437.1145805-3-zhao1.liu@linux.intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d) Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r--hw/smbios/smbios.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 66a020999b..74e4aee5a9 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1087,8 +1087,7 @@ void smbios_get_tables(MachineState *ms,
smbios_build_type_2_table();
smbios_build_type_3_table();
- smbios_smp_sockets = DIV_ROUND_UP(ms->smp.cpus,
- ms->smp.cores * ms->smp.threads);
+ smbios_smp_sockets = ms->smp.sockets;
assert(smbios_smp_sockets >= 1);
for (i = 0; i < smbios_smp_sockets; i++) {