Qemu with KVM acceleration fails with kernel 5.0-rc1 and 5.0-rc2.
It works fine with 4.20.
$ qemu-system-x86_64 --enable-kvm
KVM: entry failed, hardware error 0x7
EAX=00000000 EBX=00000000 ECX=00000000 EDX=00000663
ESI=00000000 EDI=00000000 EBP=00000000 ESP=00000000
EIP=0000fff0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 0000ffff 00009300
CS =f000 ffff0000 0000ffff 00009b00
SS =0000 00000000 0000ffff 00009300
DS =0000 00000000 0000ffff 00009300
FS =0000 00000000 0000ffff 00009300
GS =0000 00000000 0000ffff 00009300
LDT=0000 00000000 0000ffff 00008200
TR =0000 00000000 0000ffff 00008b00
GDT= 00000000 0000ffff
IDT= 00000000 0000ffff
CR0=60000010 CR2=00000000 CR3=00000000 CR4=00000000
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000
DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000000
Code=00 66 89 d8 66 e8 6f 9f ff ff 66 83 c4 0c 66 5b 66 5e 66 c3 <ea> 5b
e0 00 f0 30 36 2f 32 33 2f 39 39 00 fc 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00
Tried with a home-compiled qemu
$ qemu-system-x86_64 -version
QEMU emulator version 3.1.50 (v3.1.0-724-ge53f7796fb-dirty)
and the one from Devuan ASCII
$ /usr/bin/qemu-system-x86_64 -version
QEMU emulator version 2.8.1(Debian 1:2.8+dfsg-6+deb9u5)
same result with both.
Home-compiled gcc
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/gcc/libexec/gcc/x86_64-pc-linux-gnu/8.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-8.2.0/configure --prefix=/opt/gcc
--enable-multiarch --with-tune=core2 --with-arch=core2
--enable-__cxa_atexit
--enable-languages=ada,c,c++,fortran,go,jit,lto,objc,obj-c++
--enable-targets=all --enable-default-pie --disable-nls --enable-host-shared
Thread model: posix
gcc version 8.2.0 (GCC)
Bisecting gives:
c73da3fcab43357feb68cac227194b13e998a8db is the first bad commit
commit c73da3fcab43357feb68cac227194b13e998a8db
Author: Sean Christopherson <[email protected]>
Date: Mon Dec 3 13:53:00 2018 -0800
KVM: VMX: Properly handle dynamic VM Entry/Exit controls
EFER and PERF_GLOBAL_CTRL MSRs have dedicated VM Entry/Exit controls
that KVM dynamically toggles based on whether or not the guest's value
for each MSRs differs from the host. Handle the dynamic behavior by
adding a helper that clears the dynamic bits so the bits aren't set
when initializing the VMCS field outside of the dynamic toggling flow.
This makes the handling consistent with similar behavior for other
controls, e.g. pin, exec and sec_exec. More importantly, it eliminates
two global bools that are stealthily modified by setup_vmcs_config.
Opportunistically clean up a comment and print related to errata for
IA32_PERF_GLOBAL_CTRL.
Signed-off-by: Sean Christopherson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Attached: config file, /proc/cpuinfo.
--
Hilsen Harald
On Mon, Jan 14, 2019 at 06:04:27PM +0100, Harald Arnesen wrote:
> Qemu with KVM acceleration fails with kernel 5.0-rc1 and 5.0-rc2.
> It works fine with 4.20.
...
> Bisecting gives:
>
> c73da3fcab43357feb68cac227194b13e998a8db is the first bad commit
> commit c73da3fcab43357feb68cac227194b13e998a8db
> Author: Sean Christopherson <[email protected]>
> Date: Mon Dec 3 13:53:00 2018 -0800
>
> KVM: VMX: Properly handle dynamic VM Entry/Exit controls
>
> EFER and PERF_GLOBAL_CTRL MSRs have dedicated VM Entry/Exit controls
> that KVM dynamically toggles based on whether or not the guest's value
> for each MSRs differs from the host. Handle the dynamic behavior by
> adding a helper that clears the dynamic bits so the bits aren't set
> when initializing the VMCS field outside of the dynamic toggling flow.
> This makes the handling consistent with similar behavior for other
> controls, e.g. pin, exec and sec_exec. More importantly, it eliminates
> two global bools that are stealthily modified by setup_vmcs_config.
>
> Opportunistically clean up a comment and print related to errata for
> IA32_PERF_GLOBAL_CTRL.
>
> Signed-off-by: Sean Christopherson <[email protected]>
> Signed-off-by: Paolo Bonzini <[email protected]>
Can you test the attached patch? Found a bug when re-inspecting the
guilty commit, the wrong VMCS field is being modifying when applying an
errata to disable VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL. Your CPU is
listed as one of the models affected by the errata. Compile tested only.
Sean Christopherson [14.01.2019 19:33]:
> On Mon, Jan 14, 2019 at 06:04:27PM +0100, Harald Arnesen wrote:
>> Qemu with KVM acceleration fails with kernel 5.0-rc1 and 5.0-rc2.
>> It works fine with 4.20.
> Can you test the attached patch? Found a bug when re-inspecting the
> guilty commit, the wrong VMCS field is being modifying when applying an
> errata to disable VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL. Your CPU is
> listed as one of the models affected by the errata. Compile tested only.
Yes, this patch fixes the error.
Feel free to add a "Tested-by: Harald Arnesen <[email protected]>".
--
Hilsen Harald
On Mon, Jan 14, 2019 at 08:17:10PM +0100, Harald Arnesen wrote:
> Sean Christopherson [14.01.2019 19:33]:
>
> > On Mon, Jan 14, 2019 at 06:04:27PM +0100, Harald Arnesen wrote:
> >> Qemu with KVM acceleration fails with kernel 5.0-rc1 and 5.0-rc2.
> >> It works fine with 4.20.
>
> > Can you test the attached patch? Found a bug when re-inspecting the
> > guilty commit, the wrong VMCS field is being modifying when applying an
> > errata to disable VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL. Your CPU is
> > listed as one of the models affected by the errata. Compile tested only.
>
> Yes, this patch fixes the error.
Awesome, thanks!
>
> Feel free to add a "Tested-by: Harald Arnesen <[email protected]>".
> --
> Hilsen Harald