[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-9.0.2 13/22] i386/cpu: fixup number of addressable IDs for proce
From: |
Michael Tokarev |
Subject: |
[Stable-9.0.2 13/22] i386/cpu: fixup number of addressable IDs for processor cores in the physical package |
Date: |
Fri, 5 Jul 2024 00:00:43 +0300 |
From: Chuang Xu <xuchuangxclwt@bytedance.com>
When QEMU is started with:
-cpu host,host-cache-info=on,l3-cache=off \
-smp 2,sockets=1,dies=1,cores=1,threads=2
Guest can't acquire maximum number of addressable IDs for processor cores in
the physical package from CPUID[04H].
When creating a CPU topology of 1 core per package, host-cache-info only
uses the Host's addressable core IDs field (CPUID.04H.EAX[bits 31-26]),
resulting in a conflict (on the multicore Host) between the Guest core
topology information in this field and the Guest's actual cores number.
Fix it by removing the unnecessary condition to cover 1 core per package
case. This is safe because cores_per_pkg will not be 0 and will be at
least 1.
Fixes: d7caf13b5fcf ("x86: cpu: fixup number of addressable IDs for logical
processors sharing cache")
Signed-off-by: Guixiong Wei <weiguixiong@bytedance.com>
Signed-off-by: Yipeng Yin <yinyipeng@bytedance.com>
Signed-off-by: Chuang Xu <xuchuangxclwt@bytedance.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Message-ID: <20240611032314.64076-1-xuchuangxclwt@bytedance.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 903916f0a017fe4b7789f1c6c6982333a5a71876)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
(Mjt: fixup for 9.0 due to other changes in this area past 9.0)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index e693f8ca9a..02a2da04a7 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6097,10 +6097,8 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t count,
if (*eax & 31) {
int host_vcpus_per_cache = 1 + ((*eax & 0x3FFC000) >> 14);
int vcpus_per_socket = cs->nr_cores * cs->nr_threads;
- if (cs->nr_cores > 1) {
- *eax &= ~0xFC000000;
- *eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
- }
+ *eax &= ~0xFC000000;
+ *eax |= (pow2ceil(cs->nr_cores) - 1) << 26;
if (host_vcpus_per_cache > vcpus_per_socket) {
*eax &= ~0x3FFC000;
*eax |= (pow2ceil(vcpus_per_socket) - 1) << 14;
--
2.39.2
- [Stable-9.0.2 03/22] ui/gtk: Draw guest frame at refresh cycle, (continued)
- [Stable-9.0.2 03/22] ui/gtk: Draw guest frame at refresh cycle, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 06/22] stdvga: fix screen blanking, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 07/22] accel/tcg: Fix typo causing tb->page_addr[1] to not be recorded, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 05/22] hw/audio/virtio-snd: Always use little endian audio format, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 08/22] linux-user: Make TARGET_NR_setgroups affect only the current thread, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 09/22] target/sparc: use signed denominator in sdiv helper, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 10/22] tcg/loongarch64: Fix tcg_out_movi vs some pcrel pointers, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 12/22] tests: Update our CI to use CentOS Stream 9 instead of 8, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 11/22] migration: Fix file migration with fdset, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 14/22] target/arm: Fix VCMLA Dd, Dn, Dm[idx], Michael Tokarev, 2024/07/04
- [Stable-9.0.2 13/22] i386/cpu: fixup number of addressable IDs for processor cores in the physical package,
Michael Tokarev <=
- [Stable-9.0.2 15/22] target/arm: Fix FJCVTZS vs flush-to-zero, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 19/22] iotests/244: Don't store data-file with protocol in image, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 18/22] qcow2: Don't open data_file with BDRV_O_NO_IO, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 16/22] hw/core: allow parameter=1 for SMP topology on any machine, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 17/22] tests: add testing of parameter=1 for SMP topology, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 20/22] iotests/270: Don't store data-file with json: prefix in image, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 21/22] block: Parse filenames only when explicitly requested, Michael Tokarev, 2024/07/04
- [Stable-9.0.2 22/22] tcg/optimize: Fix TCG_COND_TST* simplification of setcond2, Michael Tokarev, 2024/07/04