* [RFC kvm-unit-tests PATCH 1/4] x86/apic: Move ioapic tests together and add them to apic test group
2025-02-25 10:40 [RFC kvm-unit-tests PATCH 0/4] x86/apic: SVM AVIC tests and some cleanups Naveen N Rao (AMD)
@ 2025-02-25 10:40 ` Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 2/4] x86/apic: Disable PIT for x2apic test to allow SVM AVIC to be tested Naveen N Rao (AMD)
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Naveen N Rao (AMD) @ 2025-02-25 10:40 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Sean Christopherson, Vasant Hegde,
Suravee Suthikulpanit
Commit f5cfdd33cb21 ("x86/apic: Add test config to allow running apic
tests against SVM's AVIC") added most of the APIC tests to the "apic"
test group, but missed adding ioapic test. Add it.
Also move ioapic-split test next to the regular ioapic test to keep the
two together.
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
---
x86/unittests.cfg | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 6e69c50b9b0d..8d046e6d7356 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -14,12 +14,6 @@ extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split
arch = x86_64
groups = apic
-[ioapic-split]
-file = ioapic.flat
-extra_params = -cpu qemu64 -machine kernel_irqchip=split
-arch = x86_64
-groups = apic
-
[x2apic]
file = apic.flat
smp = 2
@@ -38,11 +32,18 @@ arch = x86_64
timeout = 60
groups = apic
+[ioapic-split]
+file = ioapic.flat
+extra_params = -cpu qemu64 -machine kernel_irqchip=split
+arch = x86_64
+groups = apic
+
[ioapic]
file = ioapic.flat
smp = 4
extra_params = -cpu qemu64,+x2apic
arch = x86_64
+groups = apic
[cmpxchg8b]
file = cmpxchg8b.flat
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC kvm-unit-tests PATCH 2/4] x86/apic: Disable PIT for x2apic test to allow SVM AVIC to be tested
2025-02-25 10:40 [RFC kvm-unit-tests PATCH 0/4] x86/apic: SVM AVIC tests and some cleanups Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 1/4] x86/apic: Move ioapic tests together and add them to apic test group Naveen N Rao (AMD)
@ 2025-02-25 10:40 ` Naveen N Rao (AMD)
2025-06-03 23:53 ` Sean Christopherson
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 3/4] x86/apic: Disable PIT for ioapic " Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 4/4] x86/apic: Add test for xapic-split Naveen N Rao (AMD)
3 siblings, 1 reply; 7+ messages in thread
From: Naveen N Rao (AMD) @ 2025-02-25 10:40 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Sean Christopherson, Vasant Hegde,
Suravee Suthikulpanit
SVM AVIC is inhibited if kvm-pit is enabled in the default "reinject"
mode. Commit f5cfdd33cb21 ("x86/apic: Add test config to allow running
apic tests against SVM's AVIC") disabled PIT in xapic test to allow AVIC
to be tested. However, since then, AVIC has been enabled to work in
x2apic mode, but still requires PIT to either be disabled or set to
"discard".
Update x2apic test to disable PIT so that AVIC can be exercized with
x2apic.
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
---
x86/unittests.cfg | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 8d046e6d7356..35fb88c3cb79 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -14,10 +14,11 @@ extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split
arch = x86_64
groups = apic
+# Don't create a Programmable Interval Timer (PIT, a.k.a 8254) to allow testing SVM's AVIC
[x2apic]
file = apic.flat
smp = 2
-extra_params = -cpu qemu64,+x2apic,+tsc-deadline
+extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine pit=off
arch = x86_64
timeout = 30
groups = apic
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC kvm-unit-tests PATCH 2/4] x86/apic: Disable PIT for x2apic test to allow SVM AVIC to be tested
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 2/4] x86/apic: Disable PIT for x2apic test to allow SVM AVIC to be tested Naveen N Rao (AMD)
@ 2025-06-03 23:53 ` Sean Christopherson
0 siblings, 0 replies; 7+ messages in thread
From: Sean Christopherson @ 2025-06-03 23:53 UTC (permalink / raw)
To: Naveen N Rao (AMD)
Cc: kvm, Paolo Bonzini, Vasant Hegde, Suravee Suthikulpanit
On Tue, Feb 25, 2025, Naveen N Rao (AMD) wrote:
> SVM AVIC is inhibited if kvm-pit is enabled in the default "reinject"
> mode. Commit f5cfdd33cb21 ("x86/apic: Add test config to allow running
> apic tests against SVM's AVIC") disabled PIT in xapic test to allow AVIC
> to be tested. However, since then, AVIC has been enabled to work in
> x2apic mode, but still requires PIT to either be disabled or set to
> "discard".
>
> Update x2apic test to disable PIT so that AVIC can be exercized with
> x2apic.
>
> Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
> ---
> x86/unittests.cfg | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index 8d046e6d7356..35fb88c3cb79 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -14,10 +14,11 @@ extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split
> arch = x86_64
> groups = apic
>
> +# Don't create a Programmable Interval Timer (PIT, a.k.a 8254) to allow testing SVM's AVIC
> [x2apic]
> file = apic.flat
> smp = 2
> -extra_params = -cpu qemu64,+x2apic,+tsc-deadline
> +extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine pit=off
Similar to the split IRQ chip, playing whack-a-mole to disable the PIT in every
test where (x2)AVIC might be interesting is rather silly. The realmode test
uses the PIT, but AFAICT it doesn't need re-injection, i.e. we can simply disable
re-injection mode to get the same effect, e.g.
qemu-429929 [233] ...1. 16531.028284: kvm_apicv_inhibit_changed: set reason=9, inhibits=0x200 PIT_REINJ
qemu-429929 [233] ...1. 16531.028311: kvm_apicv_inhibit_changed: cleared reason=9, inhibits=0x0
I'll send a patch.
> arch = x86_64
> timeout = 30
> groups = apic
> --
> 2.48.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC kvm-unit-tests PATCH 3/4] x86/apic: Disable PIT for ioapic test to allow SVM AVIC to be tested
2025-02-25 10:40 [RFC kvm-unit-tests PATCH 0/4] x86/apic: SVM AVIC tests and some cleanups Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 1/4] x86/apic: Move ioapic tests together and add them to apic test group Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 2/4] x86/apic: Disable PIT for x2apic test to allow SVM AVIC to be tested Naveen N Rao (AMD)
@ 2025-02-25 10:40 ` Naveen N Rao (AMD)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 4/4] x86/apic: Add test for xapic-split Naveen N Rao (AMD)
3 siblings, 0 replies; 7+ messages in thread
From: Naveen N Rao (AMD) @ 2025-02-25 10:40 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Sean Christopherson, Vasant Hegde,
Suravee Suthikulpanit
SVM AVIC is inhibited if kvm-pit is present in the default reinject
mode. Disable PIT so that AVIC is exercized with the ioapic test.
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
---
x86/unittests.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index 35fb88c3cb79..b057b59b1e30 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -42,7 +42,7 @@ groups = apic
[ioapic]
file = ioapic.flat
smp = 4
-extra_params = -cpu qemu64,+x2apic
+extra_params = -cpu qemu64,+x2apic -machine pit=off
arch = x86_64
groups = apic
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC kvm-unit-tests PATCH 4/4] x86/apic: Add test for xapic-split
2025-02-25 10:40 [RFC kvm-unit-tests PATCH 0/4] x86/apic: SVM AVIC tests and some cleanups Naveen N Rao (AMD)
` (2 preceding siblings ...)
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 3/4] x86/apic: Disable PIT for ioapic " Naveen N Rao (AMD)
@ 2025-02-25 10:40 ` Naveen N Rao (AMD)
2025-03-04 20:33 ` Sean Christopherson
3 siblings, 1 reply; 7+ messages in thread
From: Naveen N Rao (AMD) @ 2025-02-25 10:40 UTC (permalink / raw)
To: kvm; +Cc: Paolo Bonzini, Sean Christopherson, Vasant Hegde,
Suravee Suthikulpanit
The current apic-split test actually uses x2apic. Rename the same, and
add a separate test for xapic in split irqchip mode.
Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
---
x86/unittests.cfg | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index b057b59b1e30..35646e320620 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -7,7 +7,7 @@
# arch = i386|x86_64
##############################################################################
-[apic-split]
+[x2apic-split]
file = apic.flat
smp = 2
extra_params = -cpu qemu64,+x2apic,+tsc-deadline -machine kernel_irqchip=split
@@ -23,6 +23,13 @@ arch = x86_64
timeout = 30
groups = apic
+[xapic-split]
+file = apic.flat
+smp = 2
+extra_params = -cpu qemu64,-x2apic,+tsc-deadline -machine kernel_irqchip=split
+arch = x86_64
+groups = apic
+
# Hide x2APIC and don't create a Programmable Interval Timer (PIT, a.k.a 8254)
# to allow testing SVM's AVIC, which is disabled if either is exposed to the guest.
[xapic]
--
2.48.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC kvm-unit-tests PATCH 4/4] x86/apic: Add test for xapic-split
2025-02-25 10:40 ` [RFC kvm-unit-tests PATCH 4/4] x86/apic: Add test for xapic-split Naveen N Rao (AMD)
@ 2025-03-04 20:33 ` Sean Christopherson
0 siblings, 0 replies; 7+ messages in thread
From: Sean Christopherson @ 2025-03-04 20:33 UTC (permalink / raw)
To: Naveen N Rao (AMD)
Cc: kvm, Paolo Bonzini, Vasant Hegde, Suravee Suthikulpanit
On Tue, Feb 25, 2025, Naveen N Rao (AMD) wrote:
> The current apic-split test actually uses x2apic. Rename the same, and
> add a separate test for xapic in split irqchip mode.
I would actually prefer we go in the opposite direction and rip out the testcases
that explicitly specify kernel_irqchip=split, not add more. And instead either
defer to the user via ACCEL=, or make it a top-level switch.
While it would be nice for unittests.cfg to cover more scenarios by "default",
the flip side of doing so is that makes it annoying for an end user to do more,
and gives the false impression that the configurations in unittests.cfg are the
only ones that are worth testing.
E.g. svm_npt fails with kernel_irqchip=split on x2AVIC hardware due to test bugs
(patches incoming), hyperv_connections fails due to what is effectively a
QEMU bug that also got hoisted into KVM[1], and vmx_apic_passthrough_tpr_threshold_test
also fails with kernel_irqchip=split due to a KVM bug that happened to be masked
by another KVM bug with the in-kernel PIT emulation.
[1] https://lore.kernel.org/all/Z8ZBzEJ7--VWKdWd@google.com
[2] https://lore.kernel.org/all/202502271500.28201544-lkp@intel.com
^ permalink raw reply [flat|nested] 7+ messages in thread