image works in native but not in vm when cpu mode='host-passthrough' is set

Greetings. I have an image I've created with a bunch of chost flags which works on my machine when it comes to native boot. if I take that same image into a vm managed via libvirt, I get kernel panic. I'd assume that something is missing from my vm config, question is what and what I can do about it? here is the flags part of lscpu in native and vm: https://dpaste.com/3TR8QJ5G8 and the vm's xml: https://dpaste.com/984JX4LUQ if I build the image with the default flags (march=x86-64), the vm boots well. my new chost is -O2 -pipe -march=skylake -mabm -mno-adx -mno-avx -mno-avx2 -mno-bmi -mno-bmi2 -mno-f16c -mno-fma -mno-xsave -mno-xsavec -mno-xsaveopt -mno-xsaves -mno-sgx the cpu is Intel(R) Pentium(R) CPU G4560 @ 3.50GHz thoughts? Thanks, Dagg.

On Tue, Nov 17, 2020 at 11:32:29AM +0100, daggs wrote:
Greetings.
I have an image I've created with a bunch of chost flags which works on my machine when it comes to native boot. if I take that same image into a vm managed via libvirt, I get kernel panic. I'd assume that something is missing from my vm config, question is what and what I can do about it? here is the flags part of lscpu in native and vm: https://dpaste.com/3TR8QJ5G8 and the vm's xml: https://dpaste.com/984JX4LUQ if I build the image with the default flags (march=x86-64), the vm boots well. my new chost is -O2 -pipe -march=skylake -mabm -mno-adx -mno-avx -mno-avx2 -mno-bmi -mno-bmi2 -mno-f16c -mno-fma -mno-xsave -mno-xsavec -mno-xsaveopt -mno-xsaves -mno-sgx the cpu is Intel(R) Pentium(R) CPU G4560 @ 3.50GHz
Not sure, but there might be some flags that are not passed through even with host-passthrough. Virtualisation ones are definitely one of those that need to be enabled on top of host-passthrough. The easiest thing to check that I can think of would be booting some live distro and checking the flags in /proc/cpuinfo and how are they different from your host.
thoughts?
Thanks,
Dagg.

Greetings Martin,
Sent: Thursday, November 19, 2020 at 11:23 PM From: "Martin Kletzander" <mkletzan@redhat.com> To: "daggs" <daggs@gmx.com> Cc: "libvirt-usersredhat.com" <libvirt-users@redhat.com> Subject: Re: image works in native but not in vm when cpu mode='host-passthrough' is set
On Tue, Nov 17, 2020 at 11:32:29AM +0100, daggs wrote: ... Not sure, but there might be some flags that are not passed through even with host-passthrough. Virtualisation ones are definitely one of those that need to be enabled on top of host-passthrough. The easiest thing to check that I can think of would be booting some live distro and checking the flags in /proc/cpuinfo and how are they different from your host.
I don't need livecd, I can diff both native and vm, see https://dpaste.com/ARETBEPCL from what I can see, the vm is missing these flags: dts acpi tm pbe art pebs bts nonstop_tsc aperfmperf dtes64 monitor ds_cpl est tm2 sdbg xtpr pdcm epb intel_pt dtherm pln pts hwp hwp_notify hwp_act_window hwp_epp and have these flags: tsc_known_freq hypervisor umip arch_capabilities beside the acpi flag which I found strange to be messing, I can't think of any other flag which might be needed. Dagg.

On Fri, Nov 20, 2020 at 08:06:08AM +0100, daggs wrote:
Greetings Martin,
Sent: Thursday, November 19, 2020 at 11:23 PM From: "Martin Kletzander" <mkletzan@redhat.com> To: "daggs" <daggs@gmx.com> Cc: "libvirt-usersredhat.com" <libvirt-users@redhat.com> Subject: Re: image works in native but not in vm when cpu mode='host-passthrough' is set
On Tue, Nov 17, 2020 at 11:32:29AM +0100, daggs wrote: ... Not sure, but there might be some flags that are not passed through even with host-passthrough. Virtualisation ones are definitely one of those that need to be enabled on top of host-passthrough. The easiest thing to check that I can think of would be booting some live distro and checking the flags in /proc/cpuinfo and how are they different from your host.
I don't need livecd, I can diff both native and vm, see https://dpaste.com/ARETBEPCL from what I can see, the vm is missing these flags: dts acpi tm pbe art pebs bts nonstop_tsc aperfmperf dtes64 monitor ds_cpl est tm2 sdbg xtpr pdcm epb intel_pt dtherm pln pts hwp hwp_notify hwp_act_window hwp_epp and have these flags: tsc_known_freq hypervisor umip arch_capabilities
beside the acpi flag which I found strange to be messing, I can't think of any other flag which might be needed.
I'm sorry to say that, but nobody else here provides expertise, maybe extracting the qemu command-lines from the logs and asking on qemu-users might be the best next step. Sorry I cannot help you more as I do not see anything immediately obvious here. Martin
Dagg.

Greetings Martin,
Sent: Monday, November 23, 2020 at 4:08 PM From: "Martin Kletzander" <mkletzan@redhat.com> To: "daggs" <daggs@gmx.com> Cc: "libvirt-usersredhat.com" <libvirt-users@redhat.com> Subject: Re: image works in native but not in vm when cpu mode='host-passthrough' is set
I'm sorry to say that, but nobody else here provides expertise, maybe extracting the qemu command-lines from the logs and asking on qemu-users might be the best next step. Sorry I cannot help you more as I do not see anything immediately obvious here.
Martin
seems like it, thanks for the help, I'll try over the qemu-users ml. Dagg.

On Tue, Nov 24, 2020 at 08:21:52 +0100, daggs wrote:
Greetings Martin,
Sent: Monday, November 23, 2020 at 4:08 PM From: "Martin Kletzander" <mkletzan@redhat.com> To: "daggs" <daggs@gmx.com> Cc: "libvirt-usersredhat.com" <libvirt-users@redhat.com> Subject: Re: image works in native but not in vm when cpu mode='host-passthrough' is set
I'm sorry to say that, but nobody else here provides expertise, maybe extracting the qemu command-lines from the logs and asking on qemu-users might be the best next step. Sorry I cannot help you more as I do not see anything immediately obvious here.
Martin
seems like it, thanks for the help, I'll try over the qemu-users ml.
Yes, that's the best option. In general, host-passthrough just does not enable all features supported by the host CPU. Some features require special handling in KVM and/or QEMU before they can be made visible to a guest. If the code is missing, the corresponding features would just be filtered out. And some features can only be enabled as long as you don't ever want to migrate the VM to another host. Such features are only enabled if you explicitly ask for them to be enabled. And of course, even if a feature is enabled and the corresponding handling in QEMU/KVM exists, there might be bugs in there. So talking to QEMU developers is a good idea as they are often involved in the KVM part too. BTW, the following XML can be used to enable the non-migratable features on host-passthrough CPU: <cpu mode='host-passthrough' migratable='off'/> Not sure if it's going to help in your case, though. Jirka
participants (3)
-
daggs
-
Jiri Denemark
-
Martin Kletzander