qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] i386/cpu: Intel cache model & topo CPUID enhencement
@ 2025-07-11 10:45 Zhao Liu
  2025-07-11 10:45 ` [PATCH v2 1/9] i386/cpu: Introduce cache model for SierraForest Zhao Liu
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Zhao Liu @ 2025-07-11 10:45 UTC (permalink / raw)
  To: Paolo Bonzini, Daniel P . Berrangé, Igor Mammedov,
	Eduardo Habkost
  Cc: Ewan Hai, Jason Zeng, Xiaoyao Li, Tao Su, Yi Lai, Dapeng Mi,
	Tejus GK, Manish Mishra, qemu-devel, Zhao Liu

Hi,

This series is based on another series dedicated to cleaning up the
legacy cache models:

https://lore.kernel.org/qemu-devel/20250711102143.1622339-1-zhao1.liu@intel.com/

And this series focuses only on improvements to the named CPU models:
 * Add cache model for Intel CPUs (and YongFeng).
 * Enable 0x1f CPUID leaf for specific Intel CPUs, which already have
   this leaf on host by default.

You can also find the patches at here (branch: cache-model-v3.0-rebase-
07-10-2025):

https://gitlab.com/zhao.liu/qemu/-/tree/cache-model-v3.0-rebase-07-10-2025?ref_type=heads


Change Log
==========

Changes since RFC (20250423114702.1529340-1-zhao1.liu@intel.com):
 * Split CPUID fixes into another series.
 * Since TDX was merged, rebase and rename 0x1f property to
   "x-force-cpuid-0x1f". (Igor)
 * Include cache model for YongFeng from Ewai.


Intel Cache Model
=================

AMD has supports cache model for a long time. And this feature strats
from the Eduardo's idea [1].

Unfortunately, Intel does not support this, and I have received some
feedback (from Tejus on mail list [2] and kvm forum, and from Jason).

Additionally, after clearly defining the cache topology for QEMU's
cache model, outdated cache models can easily raise more questions. For
example, the default legacy cache model's L3 is per die, but SPR's
real L3 is per socket. Users may question how the L3 topology changes
when multiple dies are created (discussed with Daniel on [3]).

So, in this series, I have added cache models for SRF, GNR, and SPR
(because these are the only machines I can find at the moment :-) ).

Note that the cache models are based on the Scalable Performance (SP)
version, and the Xeon Advanced Performance (AP) version may have
different cache sizes. However, SP is sufficient as the default cache
model baseline. In the future, I will consider adding additional
parameters in "smp-cache" to adjust cache sizes to meet different needs.

[1]: https://lore.kernel.org/qemu-devel/20180320175427.GU3417@localhost.localdomain/
[2]: https://lore.kernel.org/qemu-devel/6766AC1F-96D1-41F0-AAEB-CE4158662A51@nutanix.com/
[3]: https://lore.kernel.org/qemu-devel/ZkTrsDdyGRFzVULG@redhat.com/

0x1f CPUID by default (for some CPUs)
=====================================

Once the cache model can be clearly defined, another issue is the
topology.

Currently, the cache topology is actually tied to the CPU topology.
However, in recent Intel CPUs (from cascadelake-AP - 2nd xeon [4]),
CPU topology information is primarily expressed using the 0x1f leaf.

Due to compatibility issues and historical reasons, the Guest's 0x1f
is not unconditionally exposed.

The discrepancy between having 0x1f on the Host but not on the Guest
does indeed cause problems (Manish mentioned in [5]).

Manish and Xiaoyao (for TDX) both attempted to enable 0x1f by default
for Intel CPUs [6] [7], but following Igor's suggestion, it is more
appropriate to enable it by default only for certain CPU models [8].

So, as I update the CPU model at this time, I think it's time to revisit
the community's idea.

I enable the 0x1f leaf for SRF, GNR and SPR by default for better
emulation of real silicons.

Change Log
==========

Changes Since v1:
 * Polish the note and enable 0x1f leaf for YongFeng.
 * Add R-b/T-b tags.


Reference
=========

[4]: https://lore.kernel.org/qemu-devel/ZpoWskY4XE%2F98jss@intel.com/
[5]: https://lore.kernel.org/qemu-devel/PH0PR02MB738410511BF51B12DB09BE6CF6AC2@PH0PR02MB7384.namprd02.prod.outlook.com/
[6]: https://lore.kernel.org/qemu-devel/20240722101859.47408-1-manish.mishra@nutanix.com/
[7]: https://lore.kernel.org/qemu-devel/20240813033145.279307-1-xiaoyao.li@intel.com/
[8]: https://lore.kernel.org/qemu-devel/20240723170321.0ef780c5@imammedo.users.ipa.redhat.com/
[9]: https://lore.kernel.org/qemu-devel/20250401130205.2198253-34-xiaoyao.li@intel.com/

Thanks and Best Regards,
Zhao

---
Ewan Hai (1):
  i386/cpu: Introduce cache model for YongFeng

Manish Mishra (1):
  i386/cpu: Add a "x-force-cpuid-0x1f" property

Zhao Liu (7):
  i386/cpu: Introduce cache model for SierraForest
  i386/cpu: Introduce cache model for GraniteRapids
  i386/cpu: Introduce cache model for SapphireRapids
  i386/cpu: Enable 0x1f leaf for SierraForest by default
  i386/cpu: Enable 0x1f leaf for GraniteRapids by default
  i386/cpu: Enable 0x1f leaf for SapphireRapids by default
  i386/cpu: Enable 0x1f leaf for YongFeng by default

 target/i386/cpu.c | 405 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 405 insertions(+)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-07-11 16:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-11 10:45 [PATCH v2 0/9] i386/cpu: Intel cache model & topo CPUID enhencement Zhao Liu
2025-07-11 10:45 ` [PATCH v2 1/9] i386/cpu: Introduce cache model for SierraForest Zhao Liu
2025-07-11 10:45 ` [PATCH v2 2/9] i386/cpu: Introduce cache model for GraniteRapids Zhao Liu
2025-07-11 10:45 ` [PATCH v2 3/9] i386/cpu: Introduce cache model for SapphireRapids Zhao Liu
2025-07-11 10:45 ` [PATCH v2 4/9] i386/cpu: Introduce cache model for YongFeng Zhao Liu
2025-07-11 10:45 ` [PATCH v2 5/9] i386/cpu: Add a "x-force-cpuid-0x1f" property Zhao Liu
2025-07-11 10:46 ` [PATCH v2 6/9] i386/cpu: Enable 0x1f leaf for SierraForest by default Zhao Liu
2025-07-11 10:46 ` [PATCH v2 7/9] i386/cpu: Enable 0x1f leaf for GraniteRapids " Zhao Liu
2025-07-11 10:46 ` [PATCH v2 8/9] i386/cpu: Enable 0x1f leaf for SapphireRapids " Zhao Liu
2025-07-11 10:46 ` [PATCH v2 9/9] i386/cpu: Enable 0x1f leaf for YongFeng " Zhao Liu
2025-07-11 16:51 ` [PATCH v2 0/9] i386/cpu: Intel cache model & topo CPUID enhencement Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).