Re: kvm-unit-tests failures

Eduardo Habkost
2014-08-05T14:46:18Z

On Tue, Aug 05, 2014 at 12:26:26PM +0200, Paolo Bonzini wrote:
> Il 04/08/2014 19:02, Chris J Arges ha scritto:
> > All tests below are done with the kvm tip (fresh as of today) merged
> > with 3.16-rc4.
>
> Sorry, I had missed the list of failures.
>
> > * Failures:
> > - pmu
> > As suggested in comment 2 on this bug:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1079796
> > Adding the -cpu host allows this test to PASS.
>
> Correct, I thought unittests.cfg already did that.
>
> > - tsc_adjust
> > Here again adding "-cpu host" allows this to pass.
>
> Looks like QEMU doesn't know the tsc_adjust flag at all. CCing Eduardo.

QEMU doesn't know the flag name yet (although we have migration support for the
MSR since 2012).

Note that with the new "migratable=yes" default on QEMU 2.1, an unknown feature
won't be enabled even when using "-cpu host", and will require "-cpu
host,migratable=no".

I see a bug on the unit test code: it is calling cpuid(7) without checking if
(cpuid(0).a >= 7) first, so it is checking meaningless CPUID bits when
cpuid_level < 7. This causes the following problem:

[kvm-unit-tests/master=]$ ./x86-run x86/tsc_adjust.flat -smp 2 -cpu qemu64,level=7
qemu-kvm -enable-kvm -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 -display none -serial stdio -device pci-testdev -kernel x86/tsc_adjust.flat -smp 2 -cpu qemu64,level=7
enabling apic
enabling apic
success: IA32_TSC_ADJUST feature not enabled
Return value from qemu: 1
[kvm-unit-tests/master=]$ ./x86-run x86/tsc_adjust.flat -smp 2 -cpu qemu64,level=4
qemu-kvm -enable-kvm -device pc-testdev -device isa-debug-exit,iobase=0xf4,iosize=0x4 -display none -serial stdio -device pci-testdev -kernel x86/tsc_adjust.flat -smp 2 -cpu qemu64,level=4
enabling apic
enabling apic
failure: IA32_TSC_ADJUST msr read / write incorrect
failure: TSC did not adjust for IA32_TSC_ADJUST value
failure: IA32_TSC_ADJUST msr incorrectly adjusted on tsc write
Return value from qemu: 3

--
Eduardo