On Mon, Apr 01, 2024, Manali Shukla wrote: > Currently, all the VMs are created with in-kernel APIC support in KVM > selftests because KVM_CREATE_IRQCHIP ioctl is called by default from > kvm_arch_vm_post_create(). > > Carve out space in the @shape passed to the various VM creation helpers to > allow using the shape to control creation of a VM without in-kernel APIC > support or with in-kernel APIC support. > > This is a preparatory patch to create a vm without in-kernel APIC support for > the KVM_X86_DISABLE_EXITS_HLT test. Ugh, when I suggested creating a VM without an in-kernel APIC as away to easily test that HLT doesn't exit, I wasn't thinking about the side effects of creating a runnable VM without an in-kernel APIC. The other downside is that practically no one uses a userspace local APIC these days, i.e. the selftest isn't a great representation of real world setups. Given that KVM already provides vcpu->stat.halt_exits, using a stats FD for verifying exiting behavior is probably a better option. The other check that could be added would be to verify that mp_state is always RUNNABLE (which is a bug/gap in KVM as migrating a vCPU that was halted in the guest won't resume in a halted state on the target).