Bug 700272
Summary: | RFE add support for "host cpu" in Libvirt | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | Andrew Cathrow <acathrow> | |
Component: | libvirt | Assignee: | Jiri Denemark <jdenemar> | |
Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> | |
Severity: | medium | Docs Contact: | ||
Priority: | high | |||
Version: | 6.2 | CC: | bsarathy, crobinso, dallan, dfediuck, dyuan, grant_williamson, gren, honzhang, jeder, mzhan, perfbz, rbalakri, rwu, walicki | |
Target Milestone: | rc | Keywords: | FutureFeature | |
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libvirt-0.9.10-1.el6 | Doc Type: | Enhancement | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 796527 (view as bug list) | Environment: | ||
Last Closed: | 2012-06-20 06:27:20 UTC | Type: | --- | |
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: | ||||
Bug Blocks: | 747667, 756082, 796527 |
Description
Andrew Cathrow
2011-04-28 00:27:28 UTC
The important part is that we allow the VM to be generically configured to use all the resources of the host CPU. eg <cpu>host</cpu> That doesn't mean we have to translate that to qemu-kvm -cpu host that could mean that libvirt dynamically builds the CPU configuration - so if the VM is started on machine that would translate to <vendor>Intel</vendor> <model>core2duo</model> but on machine B that would be translated to <model>opteron2</model> etc. The goal would be a generic guest configuration that would use the maximum available CPU resources on the host. Using that approach rather that -cpu host would allow migration without sacrificing performance. Libvirt already allows doing this in a round about way, the steps are: virsh capabilities | less <copy out the <cpu> block> virsh edit $vmname <paste under <domain> block> virt-manager provides a button for this, "copy from host cpu" virt-install provides a --cpu host option for this but it would probably be an easy addition to libvirt to have <cpu> <model>host</model> <cpu> just be a shortcut for autopopulating the XML with the host CPU info. we wouldn't carry <model>host</model> around in the XML or anything, so it would be exactly the same as the above steps. this would also make tools lives easier since we wouldn't have to do the capabilities->domainxml dance Ah I just read comment #2 and realize that the RFE is slightly different. my comment still stands though :) (In reply to comment #7) > Ah I just read comment #2 and realize that the RFE is slightly different. my > comment still stands though :) Actually, I think your comment 6 about <cpu> <model>host</model> <cpu> is exactly what's being requested. It's just syntactic sugar so applications and users don't have to do the capabilities dance, as you point out. And also so that they only do it once and the domain XML can be used on many different hosts without change and will always be optimal for that machine. This would be an important feature for IBM. An initial version of patches providing this functionality was sent upstream for review: https://www.redhat.com/archives/libvir-list/2012-January/msg00229.html This feature is now implemented upstream as of v0.9.9-59-ge7201af: commit e7201afdf7648a3c2c654218a651ae8c967aa789 Author: Jiri Denemark <jdenemar> Date: Wed Dec 21 13:47:17 2011 +0100 qemu: Add support for host CPU modes This adds support for host-model and host-passthrough CPU modes to qemu driver. The host-passthrough mode is mapped to -cpu host. Detailed documentation should be available (in about 1 hour since now) at http://www.libvirt.org/formatdomain.html#elementsCPU Reproduce this bug with libvirt-0.9.9-2.el6; Verified this bug with libvirt-0.9.10-1.el6 Steps: 1. Check host-model mode For a shutdown guest, add the following # virsh edit guest ... <cpu mode='host-model'/> ... # virsh start guest # ps -ef|grep kvm qemu 8338 1 28 04:14 ? 00:00:20 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -cpu Penryn,+osxsave,+xsave,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel62...... # virsh capabilities ... <host> ... <model>Penryn</model> ... Found the guest is using the same model as host. Here is Penryn. But there is a issue that virt-manager can not get and display this model info. For virt-manager it could be correct only if you click 'copy host model' button. Is it a bug for virt-manager, at least rfe, right? Cole, could you help to confirm? Thanks 2. Check host-passthrough model For a shutdown guest, add the following # virsh edit guest ... <cpu mode='host-passthrough'/> ... # virsh start guest # ps -ef |grep kvm qemu 10137 1 10 04:28 ? 00:00:00 /usr/libexec/qemu-kvm -S -M rhel6.2.0 -cpu host -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name rhel62 .... We can find '-cpu host' from qemu cmd. ---------------- For the 2 newly added cpu models, the verification passed. So move to VERIFIED status. But also waiting for dev's confirmation about the issue above. Maybe open a new bug to track in virt-manager. Clearing NEEDINFO since a virt-manager bug was opened. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0748.html Why isn't it adding +x2apic? Well, with <cpu mode='host-passthrough'/> libvirt is supposed to call qemu-kvm with -cpu host and it's up to qemu-kvm to decide what the guest CPU should look like. (In reply to comment #23) > Why isn't it adding +x2apic? Yaniv, IIUC x2apic is a specific flag of the cpu, which may / may not be exposed by the host processor. So this will work even with host-passthrough if all hosts have the same processor capabilities. See also: http://www.linux-kvm.org/page/Tuning_KVM (In reply to comment #25) > (In reply to comment #23) > > Why isn't it adding +x2apic? > > Yaniv, IIUC x2apic is a specific flag of the cpu, which may / may not be > exposed by the host processor. So this will work even with host-passthrough > if all hosts have the same processor capabilities. > > See also: http://www.linux-kvm.org/page/Tuning_KVM That's not true, x2apic is emulated by KVM. Even if the host doesn't have it, it's worth (for linux guests) to have it. (In reply to comment #26) > (In reply to comment #25) > > (In reply to comment #23) > > > Why isn't it adding +x2apic? > > See also: http://www.linux-kvm.org/page/Tuning_KVM > > That's not true, x2apic is emulated by KVM. Even if the host doesn't have > it, it's worth (for linux guests) to have it. In this case it cannot work together, as host-passthrough exposes flags which kvm does not support / aware of. So it cannot maintain compatibility when using flags kvm does not support. (In reply to comment #27) > (In reply to comment #26) > > (In reply to comment #25) > > > (In reply to comment #23) > > > > Why isn't it adding +x2apic? > > > > See also: http://www.linux-kvm.org/page/Tuning_KVM > > > > That's not true, x2apic is emulated by KVM. Even if the host doesn't have > > it, it's worth (for linux guests) to have it. > > In this case it cannot work together, as host-passthrough exposes flags > which kvm does not support / aware of. So it cannot maintain compatibility > when using flags kvm does not support. Of course KVM supports it. I would not have recommended it otherwise. It has nothing to do with the host, it's emulated by KVM (see http://patchwork.ozlabs.org/patch/98478/). It's probably a libvirt bug (RFE?) to add it to the host delivered flags, unconditionally (pending the kvm version?). |