Kernel KVM virtualization development
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work
@ 2026-09-29 20:24 Xiaoyao Li
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 1/2] x86: Make cet and lam tests KVM-only Xiaoyao Li
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xiaoyao Li @ 2026-09-29 20:24 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson; +Cc: kvm, xiaoyao.li

The goal of this series is to make ACCEL_PROPS work, which needs to use
separate "-accel" parameter to configure the accelerator instead of
"-machine accel=xxx".

Changes in v2:
- Add patch 1 to resolve the incompatibility between "-enable-kvm" and
 separate "-accel".

Xiaoyao Li (2):
  x86: Make cet and lam tests KVM-only
  x86/run: Use separate "-accel" option to configure the accelerator

 x86/run           | 2 +-
 x86/unittests.cfg | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.53.0


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

* [kvm-unit-tests PATCH v2 1/2] x86: Make cet and lam tests KVM-only
  2026-09-29 20:24 [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Xiaoyao Li
@ 2026-09-29 20:24 ` Xiaoyao Li
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator Xiaoyao Li
  2026-10-02 21:07 ` [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Sean Christopherson
  2 siblings, 0 replies; 6+ messages in thread
From: Xiaoyao Li @ 2026-09-29 20:24 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson; +Cc: kvm, xiaoyao.li

Passing "-enable-kvm" in qemu_params forces tests to run with kvm
accelerator.  This leads cet and lam tests to run with kvm accelerator
silently without any warning even when "ACCEL=tcg" is passed.  Change to
require "accel = kvm" for cet and lam tests so that they can be skipped:

  SKIP cet (kvm only, but ACCEL=tcg)
  SKIP lam (kvm only, but ACCEL=tcg)

when "ACCEL=tcg" is passed.

As a bouns, removing the use of "-enable-kvm" will allow pass $ACCEL and
$ACCEL_PROPS to the standalone "-accel" QEMU parameter, since QEMU
translates "-enable-kvm" to "-machine accel=kvm", which is not
compatbile with "-accel" parameter:

  qemu: The -accel and "-machine accel=" options are incompatible

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 x86/unittests.cfg | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index ae731a93dc7a..afc0f7128c03 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -535,9 +535,11 @@ groups = tsx-ctrl
 file = cet.flat
 arch = x86_64
 smp = 2
-qemu_params = -enable-kvm -m 2048 -cpu host
+accel = kvm
+qemu_params = -m 2048 -cpu host
 
 [lam]
 file = lam.flat
 arch = x86_64
-qemu_params = -enable-kvm -cpu max
+accel = kvm
+qemu_params = -cpu max
-- 
2.53.0


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

* [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator
  2026-09-29 20:24 [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Xiaoyao Li
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 1/2] x86: Make cet and lam tests KVM-only Xiaoyao Li
@ 2026-09-29 20:24 ` Xiaoyao Li
  2026-09-30  0:52   ` Sean Christopherson
  2026-10-02 21:07 ` [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Sean Christopherson
  2 siblings, 1 reply; 6+ messages in thread
From: Xiaoyao Li @ 2026-09-29 20:24 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson; +Cc: kvm, xiaoyao.li

When configuring accelerator via machine's "accel" property, it cannot
pass additional ACCEL_PROPS. For example, it hits following error when
configuring KVM with "notify-vmexit":

  # ACCEL="kvm,notify-vmexit=internal-error" ./x86-run x86/apic.c
  #   qemu-system-x86_64: Property 'pc-i440fx-11.1-machine.notify-vmexit' not found

Switch to use separate "-accel" option to configure the accelerator.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 x86/run | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/run b/x86/run
index dd38f14c871f..a68d469dd1b8 100755
--- a/x86/run
+++ b/x86/run
@@ -43,7 +43,7 @@ fi
 pit="-global kvm-pit.lost_tick_policy=discard"
 
 command="${qemu} --no-reboot -nodefaults $pit $pc_testdev -display none -serial stdio $pci_testdev"
-command+=" -machine accel=$ACCEL$ACCEL_PROPS"
+command+=" -accel $ACCEL$ACCEL_PROPS"
 if [ "${CONFIG_EFI}" != y ]; then
 	command+=" -kernel"
 fi
-- 
2.53.0


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

* Re: [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator Xiaoyao Li
@ 2026-09-30  0:52   ` Sean Christopherson
  2026-09-30 14:49     ` Xiaoyao Li
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2026-09-30  0:52 UTC (permalink / raw)
  To: Xiaoyao Li; +Cc: Paolo Bonzini, kvm

On Tue, Sep 29, 2026, Xiaoyao Li wrote:
> When configuring accelerator via machine's "accel" property, it cannot
> pass additional ACCEL_PROPS. For example, it hits following error when
> configuring KVM with "notify-vmexit":
> 
>   # ACCEL="kvm,notify-vmexit=internal-error" ./x86-run x86/apic.c
>   #   qemu-system-x86_64: Property 'pc-i440fx-11.1-machine.notify-vmexit' not found
> 
> Switch to use separate "-accel" option to configure the accelerator.

FYI, this breaks the intel_iommu test when running with ACCEL="kvm,kernel-irqchip=on"
because that's a split-only test:

  qemu_params = -M q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=off -device edu

and QEMU doesn't munge things together:

  qemu: -device intel-iommu,intremap=on,eim=off: Interrupt Remapping cannot work with kernel-irqchip=on, please use 'split|off'.

Given that I'm pretty sure I'm literally the only person the world that runs KUT
with ACCEL="kvm,kernel-irqchip=on", I'm going to apply this as-is.  I can filter
out the failures very easily, and unlike the CET/LAM issue, this doesn't cause
problems for ACCEL="kvm,kernel-irqchip=split", i.e. there's no loss in coverage.

If this impacts someone else, or someone really wants to figure out how to splice
all of this together, I'm happy to revisit things.  For now, I just want to
unblock the notify-vmexit stuff.

> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>  x86/run | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/run b/x86/run
> index dd38f14c871f..a68d469dd1b8 100755
> --- a/x86/run
> +++ b/x86/run
> @@ -43,7 +43,7 @@ fi
>  pit="-global kvm-pit.lost_tick_policy=discard"
>  
>  command="${qemu} --no-reboot -nodefaults $pit $pc_testdev -display none -serial stdio $pci_testdev"
> -command+=" -machine accel=$ACCEL$ACCEL_PROPS"
> +command+=" -accel $ACCEL$ACCEL_PROPS"
>  if [ "${CONFIG_EFI}" != y ]; then
>  	command+=" -kernel"
>  fi
> -- 
> 2.53.0
> 
> 

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

* Re: [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator
  2026-09-30  0:52   ` Sean Christopherson
@ 2026-09-30 14:49     ` Xiaoyao Li
  0 siblings, 0 replies; 6+ messages in thread
From: Xiaoyao Li @ 2026-09-30 14:49 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: Paolo Bonzini, kvm

On 9/30/2026 8:52 AM, Sean Christopherson wrote:
> On Tue, Sep 29, 2026, Xiaoyao Li wrote:
>> When configuring accelerator via machine's "accel" property, it cannot
>> pass additional ACCEL_PROPS. For example, it hits following error when
>> configuring KVM with "notify-vmexit":
>>
>>   # ACCEL="kvm,notify-vmexit=internal-error" ./x86-run x86/apic.c
>>   #   qemu-system-x86_64: Property 'pc-i440fx-11.1-machine.notify-vmexit' not found
>>
>> Switch to use separate "-accel" option to configure the accelerator.
> 
> FYI, this breaks the intel_iommu test when running with ACCEL="kvm,kernel-irqchip=on"
> because that's a split-only test:
> 
>   qemu_params = -M q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=off -device edu
> 
> and QEMU doesn't munge things together:
> 
>   qemu: -device intel-iommu,intremap=on,eim=off: Interrupt Remapping cannot work with kernel-irqchip=on, please use 'split|off'.

Because before this patch, the final QEMU command with
ACCEL="kvm,kernel-irqchip=on" is

   ... -machine accel=kvm,kernel-irqchip=on -kernel x86/intel-iommu.flat -smp 4
-M q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=off -device edu

ACCEL="kvm,kernel-irqchip=on" is made into the first "-machine
accel=kvm,kernel-irqchip=on" and qemu_params is put at the end, which has "-M
q35,kernel-irqchip=split". So the later "-M q35,kernel-irqchip=split" overrides
the earlier "kernel-irqchip=on" and it actually runs with kenrnel-irqchip=split.

But after this patch, the QEMU command becomes

   ... -accel kvm,kernel-irqchip=on -kernel x86/intel-iommu.flat -smp 4 -M
q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=off -device edu

though "-M q35,kernel-irqchip=split" is put behind "-accel
kvm,kernel-irqchip=on", QEMU applies "-accel" after "machine's kernel-irqchip".
So the final kernel-irqchip=on, which leads to the failure of Interrupt Remapping.

> Given that I'm pretty sure I'm literally the only person the world that runs KUT
> with ACCEL="kvm,kernel-irqchip=on", I'm going to apply this as-is.  I can filter
> out the failures very easily, and unlike the CET/LAM issue, this doesn't cause
> problems for ACCEL="kvm,kernel-irqchip=split", i.e. there's no loss in coverage.
> 
> If this impacts someone else, or someone really wants to figure out how to splice
> all of this together, I'm happy to revisit things.  For now, I just want to
> unblock the notify-vmexit stuff.
> 
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>>  x86/run | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/x86/run b/x86/run
>> index dd38f14c871f..a68d469dd1b8 100755
>> --- a/x86/run
>> +++ b/x86/run
>> @@ -43,7 +43,7 @@ fi
>>  pit="-global kvm-pit.lost_tick_policy=discard"
>>  
>>  command="${qemu} --no-reboot -nodefaults $pit $pc_testdev -display none -serial stdio $pci_testdev"
>> -command+=" -machine accel=$ACCEL$ACCEL_PROPS"
>> +command+=" -accel $ACCEL$ACCEL_PROPS"
>>  if [ "${CONFIG_EFI}" != y ]; then
>>  	command+=" -kernel"
>>  fi
>> -- 
>> 2.53.0
>>
>>


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

* Re: [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work
  2026-09-29 20:24 [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Xiaoyao Li
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 1/2] x86: Make cet and lam tests KVM-only Xiaoyao Li
  2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator Xiaoyao Li
@ 2026-10-02 21:07 ` Sean Christopherson
  2 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2026-10-02 21:07 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Xiaoyao Li; +Cc: kvm

On Tue, 29 Sep 2026 20:24:32 +0000, Xiaoyao Li wrote:
> The goal of this series is to make ACCEL_PROPS work, which needs to use
> separate "-accel" parameter to configure the accelerator instead of
> "-machine accel=xxx".
> 
> Changes in v2:
> - Add patch 1 to resolve the incompatibility between "-enable-kvm" and
>  separate "-accel".
> 
> [...]

Applied to kvm-x86 next, with massaged changelogs (typos, and calling out
the kernel_irqchip => kernel-irqchip quirk).  Thanks!

[1/2] x86: Make cet and lam tests KVM-only
      https://github.com/kvm-x86/kvm-unit-tests/commit/efb3e010b96a
[2/2] x86/run: Use separate "-accel" option to configure the accelerator
      https://github.com/kvm-x86/kvm-unit-tests/commit/69ab2df8fa28

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

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

end of thread, other threads:[~2026-10-02 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 20:24 [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Xiaoyao Li
2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 1/2] x86: Make cet and lam tests KVM-only Xiaoyao Li
2026-09-29 20:24 ` [kvm-unit-tests PATCH v2 2/2] x86/run: Use separate "-accel" option to configure the accelerator Xiaoyao Li
2026-09-30  0:52   ` Sean Christopherson
2026-09-30 14:49     ` Xiaoyao Li
2026-10-02 21:07 ` [kvm-unit-tests PATCH v2 0/2] x86: Make ACCEL_PROPS work Sean Christopherson

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