[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.18] hw/smbios: Fix smbios_smp_sockets caculation



commit c107dab4940d19760560ded7651550de9441db28
Author:     Zhao Liu <zhao1.liu@xxxxxxxxx>
AuthorDate: Wed Jun 28 21:54:35 2023 +0800
Commit:     Michael Tokarev <mjt@xxxxxxxxxx>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    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@xxxxxxxxx>
    Message-Id: <20230628135437.1145805-3-zhao1.liu@xxxxxxxxxxxxxxx>
    Reviewed-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
    (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d)
    Signed-off-by: Michael Tokarev <mjt@xxxxxxxxxx>
---
 hw/smbios/smbios.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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++) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.