Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests
@ 2026-09-17 17:26 Jeremiah McReynolds
  2026-09-17 19:36 ` Sean Christopherson
  2026-09-25 22:44 ` Sean Christopherson
  0 siblings, 2 replies; 3+ messages in thread
From: Jeremiah McReynolds @ 2026-09-17 17:26 UTC (permalink / raw)
  To: kvm; +Cc: seanjc, Jeremiah McReynolds

QEMUv11 introduced a check when PMU is enabled to ensure that the
virtualized CPU is the same as the underlying host CPU[1]. The MSR test
always runs under GenuineIntel with the max CPU model, so PMU is
implicitly enabled. However, when run on AMD, this new check in QEMU
causes the test to fail with the log: "host doesn't support requested
feature: vPMU".

Explicitly disable PMU on the MSR test to avoid this failure.

[1]: https://gitlab.com/qemu-project/qemu/-/commit/4c7f05232cd1db5db114d36be2b210d24f1b9ad3

Signed-off-by: Jeremiah McReynolds <jmcrey@google.com>
---
 x86/unittests.cfg | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index ae731a93..06fe92f9 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -174,9 +174,10 @@ arch = x86_64
 # Use GenuineIntel to ensure SYSENTER MSRs are fully preserved, and to test
 # SVM emulation of Intel CPU behavior.  Use the max CPU model so that 64-bit
 # support follows the host kernel.  Running a 32-bit guest on a 64-bit host
-# will fail due to shortcomings in KVM.
+# will fail due to shortcomings in KVM.  The max CPU model turns on PMU, but
+# Intel PMU registers cannot be virtualized on AMD, so turn it off.
 file = msr.flat
-qemu_params = -cpu max,vendor=GenuineIntel
+qemu_params = -cpu max,vendor=GenuineIntel,pmu=off
 
 [msr64]
 # Same as above, but with a minimal 64-bit CPU model to validate cases where an
-- 
2.55.0.1082.g2b9226bbc0-goog


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

* Re: [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests
  2026-09-17 17:26 [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests Jeremiah McReynolds
@ 2026-09-17 19:36 ` Sean Christopherson
  2026-09-25 22:44 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2026-09-17 19:36 UTC (permalink / raw)
  To: Jeremiah McReynolds; +Cc: kvm

On Thu, Sep 17, 2026, Jeremiah McReynolds wrote:
> QEMUv11 introduced a check when PMU is enabled to ensure that the
> virtualized CPU is the same as the underlying host CPU[1]. The MSR test
> always runs under GenuineIntel with the max CPU model, so PMU is
> implicitly enabled. However, when run on AMD, this new check in QEMU
> causes the test to fail with the log: "host doesn't support requested
> feature: vPMU".
> 
> Explicitly disable PMU on the MSR test to avoid this failure.
> 
> [1]: https://gitlab.com/qemu-project/qemu/-/commit/4c7f05232cd1db5db114d36be2b210d24f1b9ad3
> 
> Signed-off-by: Jeremiah McReynolds <jmcrey@google.com>
> ---
>  x86/unittests.cfg | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index ae731a93..06fe92f9 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -174,9 +174,10 @@ arch = x86_64
>  # Use GenuineIntel to ensure SYSENTER MSRs are fully preserved, and to test
>  # SVM emulation of Intel CPU behavior.  Use the max CPU model so that 64-bit
>  # support follows the host kernel.  Running a 32-bit guest on a 64-bit host
> -# will fail due to shortcomings in KVM.
> +# will fail due to shortcomings in KVM.  The max CPU model turns on PMU, but
> +# Intel PMU registers cannot be virtualized on AMD, so turn it off.
>  file = msr.flat
> -qemu_params = -cpu max,vendor=GenuineIntel
> +qemu_params = -cpu max,vendor=GenuineIntel,pmu=off

I double checked that "pmu" has existed for a while; it goes back all the way to
QEMU v1.6.0, so we should be good on that front.

>  
>  [msr64]
>  # Same as above, but with a minimal 64-bit CPU model to validate cases where an
> -- 
> 2.55.0.1082.g2b9226bbc0-goog
> 

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

* Re: [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests
  2026-09-17 17:26 [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests Jeremiah McReynolds
  2026-09-17 19:36 ` Sean Christopherson
@ 2026-09-25 22:44 ` Sean Christopherson
  1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2026-09-25 22:44 UTC (permalink / raw)
  To: Sean Christopherson, kvm, Jeremiah McReynolds

On Thu, 17 Sep 2026 17:26:51 +0000, Jeremiah McReynolds wrote:
> QEMUv11 introduced a check when PMU is enabled to ensure that the
> virtualized CPU is the same as the underlying host CPU[1]. The MSR test
> always runs under GenuineIntel with the max CPU model, so PMU is
> implicitly enabled. However, when run on AMD, this new check in QEMU
> causes the test to fail with the log: "host doesn't support requested
> feature: vPMU".
> 
> [...]

Applied to kvm-x86 next, thanks!

[1/1] x86/msr: Disable PMU for MSR tests
      https://github.com/kvm-x86/kvm-unit-tests/commit/8a6e3be3745f

--
https://github.com/kvm-x86/kvm-unit-tests/tree/next

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

end of thread, other threads:[~2026-09-25 22:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 17:26 [kvm-unit-tests PATCH] x86/msr: Disable PMU for MSR tests Jeremiah McReynolds
2026-09-17 19:36 ` Sean Christopherson
2026-09-25 22:44 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox