[PATCH 0/4] i386/cpu: Fix topological field encoding & overflow

Zhao Liu posted 4 patches 11 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250227062523.124601-1-zhao1.liu@intel.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>
target/i386/cpu.c | 35 ++++++++++++++++++++++++++++-------
1 file changed, 28 insertions(+), 7 deletions(-)
[PATCH 0/4] i386/cpu: Fix topological field encoding & overflow
Posted by Zhao Liu 11 months, 2 weeks ago
Hi,

This series collects and organizes several topology-related cleanups and
fixes, based on b69801dd6b1e ("Merge tag 'for_upstream' of
https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging").

Patch 1 is picked from Chuang's v6 [1].

Patch 2-3 are picked from Qian's v4 [2], though it had previously gone
through sufficient review (got R/b tags), I dropped its R/b tags because
of my code change.

Patch 4 is newly added, inspired by patch 3, to also perform a check on
AMD's cache CPUID. This is to consider the current maximum number of
supported CPUs, which is approaching the overflow boundary.

In addition to the 0x1, 0x4, and 0x8000001d leaves involved in the patch
series, there is also the 0x1f leaf related to topology. However, the
upper limit for CPUID.1FH.EBX[bits 15:0] is 65,535 threads, which
provides enough room. Therefore, this field does not currently require
overflow checks.

This series correct the CPUIDs, but it doesn't affect the Guest's live
migration. Therefore, I did not add the compat property for this.

[1]: https://lore.kernel.org/qemu-devel/20241009035638.59330-1-xuchuangxclwt@bytedance.com/
[2]: https://lore.kernel.org/qemu-devel/20230829042405.932523-2-qian.wen@intel.com/

Thanks and Best Regards,
Zhao
---
Chuang Xu (1):
  i386/cpu: Fix number of addressable IDs field for CPUID.01H.EBX[23:16]

Qian Wen (2):
  i386/cpu: Fix cpu number overflow in CPUID.01H.EBX[23:16]
  i386/cpu: Fix overflow of cache topology fields in CPUID.04H

Zhao Liu (1):
  i386/cpu: Honor maximum value for CPUID.8000001DH.EAX[25:14]

 target/i386/cpu.c | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

-- 
2.34.1
Re: [PATCH 0/4] i386/cpu: Fix topological field encoding & overflow
Posted by Zhao Liu 8 months, 3 weeks ago
Hi Paolo,

A gentle poke. There's no conflict for now. Do you agree with these
fixes?

Thanks,
Zhao

On Thu, Feb 27, 2025 at 02:25:19PM +0800, Zhao Liu wrote:
> Date: Thu, 27 Feb 2025 14:25:19 +0800
> From: Zhao Liu <zhao1.liu@intel.com>
> Subject: [PATCH 0/4] i386/cpu: Fix topological field encoding & overflow
> X-Mailer: git-send-email 2.34.1
> 
> Hi,
> 
> This series collects and organizes several topology-related cleanups and
> fixes, based on b69801dd6b1e ("Merge tag 'for_upstream' of
> https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging").
> 
> Patch 1 is picked from Chuang's v6 [1].
> 
> Patch 2-3 are picked from Qian's v4 [2], though it had previously gone
> through sufficient review (got R/b tags), I dropped its R/b tags because
> of my code change.
> 
> Patch 4 is newly added, inspired by patch 3, to also perform a check on
> AMD's cache CPUID. This is to consider the current maximum number of
> supported CPUs, which is approaching the overflow boundary.
> 
> In addition to the 0x1, 0x4, and 0x8000001d leaves involved in the patch
> series, there is also the 0x1f leaf related to topology. However, the
> upper limit for CPUID.1FH.EBX[bits 15:0] is 65,535 threads, which
> provides enough room. Therefore, this field does not currently require
> overflow checks.
> 
> This series correct the CPUIDs, but it doesn't affect the Guest's live
> migration. Therefore, I did not add the compat property for this.
> 
> [1]: https://lore.kernel.org/qemu-devel/20241009035638.59330-1-xuchuangxclwt@bytedance.com/
> [2]: https://lore.kernel.org/qemu-devel/20230829042405.932523-2-qian.wen@intel.com/
> 
> Thanks and Best Regards,
> Zhao
> ---
> Chuang Xu (1):
>   i386/cpu: Fix number of addressable IDs field for CPUID.01H.EBX[23:16]
> 
> Qian Wen (2):
>   i386/cpu: Fix cpu number overflow in CPUID.01H.EBX[23:16]
>   i386/cpu: Fix overflow of cache topology fields in CPUID.04H
> 
> Zhao Liu (1):
>   i386/cpu: Honor maximum value for CPUID.8000001DH.EAX[25:14]
> 
>  target/i386/cpu.c | 35 ++++++++++++++++++++++++++++-------
>  1 file changed, 28 insertions(+), 7 deletions(-)
> 
> -- 
> 2.34.1
> 
>