Bug 1014682
Summary: | Enabling <cpu mode="host-model"> does not use correct cpuid level, causes kernel panics | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Dave Allan <dallan> | |
Component: | libvirt | Assignee: | Jiri Denemark <jdenemar> | |
Status: | CLOSED CURRENTRELEASE | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.1 | CC: | acathrow, amit.shah, berrange, cfergeau, clalancette, crobinso, dallan, dwmw2, dyuan, gsun, honzhang, itamar, jdenemar, jeckersb, jforbes, jmiao, knoel, laine, libvirt-maint, pbonzini, rjones, scottt.tw, veillard, virt-maint | |
Target Milestone: | rc | |||
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-1.1.1-10.el7 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | 870071 | |||
: | 1018251 (view as bug list) | Environment: | ||
Last Closed: | 2014-06-13 10:04:36 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | 870071 | |||
Bug Blocks: | 910269 |
Description
Dave Allan
2013-10-02 14:22:30 UTC
Ironically, right now for AVX to work you do not require the AVX CPUID bit (though application will probably not use it unless the CPUID bit is required). AVX works if the XCR0 register's bit 2 is set. This requires: - the XSAVE CPUID feature, otherwise the kernel will not try to set the OSXSAVE bit in CR4 - the OSXSAVE CPUID feature, otherwise the processor will not enable the XSETBV instruction that writes to XCR0. This feature however is ignored on the command line. KVM sets it when the kernel writes 1 to the OSXSAVE bit of CR4 - the bit 2 of EAX to be set in CPUID leaf EAX=0xD/ECX=0 (in current RHEL7 QEMU this is always true; later it will be keyed on the AVX CPUID bit, bug 1005695), otherwise the processor will not enable AVX instructions. - CPUID level to be 13 or higher, otherwise the CPUID leaf is not available. Thus, "-cpu Westmere,+xsave,+avx,level=13" is required to enable AVX. Current QEMU will enable it even if you omit "+avx" but that's not future-proof. Oh cool, finally someone who knows something about this area :-) Thanks Paolo. Libvirt currently doesn't model anything but CPU model and features. And when detecting what host CPU is, we only use CPU features, which means we may easily detect the CPU as an older model plus additional features. Thus host-model can select a model+features combination that does not actually work. We need to make host CPU probing smarter (and we plan to involve QEMU in the process see bug 824989) so that the CPU it creates is always usable. Until we do that, using "host-model" is fine if it works for you but it's too fragile to be generally recommended. The same applies to a full copy of host CPU from capabilities XML. I'd suggest using either of the following: - host-passthrough CPU mode - just the CPU model from capabilities XML without the additional features; it should be possible to force-add features that QEMU is able to emulate, e.g., <feature name="x2apic" policy="force"/> but I'm not sure if that's safe for all CPU models or not. So all we can do for 7.0 is to better document how fragile host-model is and finally make it better once we have bug 824989 fixed. I'll keep this bug for the documentation changes and clone it for the real work later. Fixed upstream by v1.1.3-190-g34adf62: commit 34adf622a352cbb80a98162a0f9ac3f9de3f95cb Author: Jiri Denemark <jdenemar> Date: Thu Oct 17 16:02:38 2013 +0200 docs: Expand description of host-model CPU mode host-model is a nice idea but it's current implementation make it useless on some hosts so it should be used with care. # rpm -q libvirt libvirt-1.1.1-10.el7.x86_64 # grep -rn Beware -A 9 /usr/share/doc/libvirt-docs-1.1.1/html/formatdomain.html 1044: the capabilities of the new host. <strong>Beware</strong>, due to the 1045- way libvirt detects host CPU and due to the fact libvirt does not 1046- talk to QEMU/KVM when creating the CPU model, CPU configuration 1047- created using <code>host-model</code> may not work as expected. The 1048- guest CPU may differ from the configuration and it may also confuse 1049- guest OS by using a combination of CPU features and other parameters 1050- (such as CPUID level) that don't work. Until these issues are fixed, 1051- it's a good idea to avoid using <code>host-model</code> and use 1052- <code>custom</code> mode with just the CPU model from host 1053- capabilities XML.</dd><dt><code>host-passthrough</code></dt><dd>With this mode, the CPU visible to the guest should be exactly The explanation is existing in html, so I change the status to VERIFIED. This request was resolved in Red Hat Enterprise Linux 7.0. Contact your manager or support representative in case you have further questions about the request. *** Bug 1415831 has been marked as a duplicate of this bug. *** |