OSDN Git Service

hw/smbios: Fix smbios_smp_sockets caculation
authorZhao Liu <zhao1.liu@intel.com>
Wed, 28 Jun 2023 13:54:35 +0000 (21:54 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 10 Jul 2023 20:17:08 +0000 (16:17 -0400)
commitd79a284a44bb7d88b233fb6bb12ea3723f43469d
tree39b51432c13389a24ad2933064d05cbcfe80ead2
parenta1d027be95bc375238e5b9292c6aa661a8ddef4c
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>
hw/smbios/smbios.c