[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.0.5 02/43] hw/smbios: Fix smbios_smp_sockets caculation
From: |
Michael Tokarev |
Subject: |
[Stable-8.0.5 02/43] hw/smbios: Fix smbios_smp_sockets caculation |
Date: |
Sat, 9 Sep 2023 15:59:28 +0300 |
From: Zhao Liu <zhao1.liu@intel.com>
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>
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d2007e70fb..d67415d44d 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1088,8 +1088,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++) {
--
2.39.2
- [Stable-8.0.5 00/43] Patch Round-up for stable 8.0.5, freeze on 2023-09-19, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 01/43] machine: Add helpers to get cores/threads per socket, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 02/43] hw/smbios: Fix smbios_smp_sockets caculation,
Michael Tokarev <=
- [Stable-8.0.5 03/43] hw/smbios: Fix thread count in type4, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 04/43] hw/smbios: Fix core count in type4, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 05/43] hw/i2c: Fix bitbang_i2c_data trace event, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 06/43] dump: kdump-zlib data pages not dumped with pvtime/aarch64, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 07/43] hw/nvme: fix oob memory read in fdp events log, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 08/43] hw/nvme: fix compliance issue wrt. iosqes/iocqes, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 09/43] hw/nvme: fix CRC64 for guard tag, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 10/43] hw/nvme: fix null pointer access in directive receive, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 11/43] hw/nvme: fix null pointer access in ruh update, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 12/43] linux-user/elfload: Set V in ELF_HWCAP for RISC-V, Michael Tokarev, 2023/09/09