Bug 804224

Summary: libvirt incorrectly identifies supported CPU types
Product: [Fedora] Fedora Reporter: Andrew Cathrow <acathrow>
Component: libvirtAssignee: Jiri Denemark <jdenemar>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: abaron, berrange, clalancette, crobinso, dallan, dougsland, itamar, jdenemar, jforbes, jyang, laine, libvirt-maint, rbalakri, veillard, vincent.passaro, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-07 14:39:02 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:
Attachments:
Description Flags
virsh capabilities output
none
libvirt xml snippet + kvm cpu commandline
none
libvirt xml snippit with no fallback and resulting error none

Description Andrew Cathrow 2012-03-16 22:03:12 UTC
Tested in rawhide/f17alpha but seems present in f16

qemu-kvm-1.0-6.fc17.x86_64
libvirt-0.9.10-2.fc17.x86_64

virsh capabilities shows Westmere 
<capabilities>

  <host>
    <uuid>819a0871-d050-cb11-968b-c921c1cdc254</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Westmere</model>
      <vendor>Intel</vendor>

qemu-kvm -cpu shows valid cpu types
qemu-kvm -cpu ? 
x86       Opteron_G3
x86       Opteron_G2
x86       Opteron_G1
x86          Nehalem
x86           Penryn
x86           Conroe
x86           [n270]
x86         [athlon]
x86       [pentium3]
x86       [pentium2]
x86        [pentium]
x86            [486]
x86        [coreduo]
x86          [kvm32]
x86         [qemu32]
x86          [kvm64]
x86       [core2duo]
x86         [phenom]
x86         [qemu64]

Creating a VM with cpu type westmere with following xml (snippit)
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Westmere</model>
    <vendor>Intel</vendor>

Produces the following qemu-kvm command line 
-cpu core2duo,+lahf_lm,+rdtscp,+aes,+popcnt,+x2apic,+sse4.2,+sse4.1,+xtpr,+cx16,+tm2,+est,+vmx,+ds_cpl,+pbe,+tm,+ht,+ss,+acpi,+ds

Changing xml to forbid fallback produces following message

error: unsupported configuration: CPU model Westmere is not supported by hypervisor

Comment 1 Andrew Cathrow 2012-03-16 22:04:21 UTC
Created attachment 570719 [details]
virsh capabilities output

Comment 2 Andrew Cathrow 2012-03-16 22:07:34 UTC
Created attachment 570720 [details]
libvirt xml snippet + kvm cpu commandline

Comment 3 Andrew Cathrow 2012-03-16 22:10:43 UTC
Created attachment 570725 [details]
libvirt xml snippit with no fallback and resulting error

Comment 4 Martin Kletzander 2012-03-19 14:52:39 UTC
*** Bug 708927 has been marked as a duplicate of this bug. ***

Comment 5 Martin Kletzander 2012-03-19 16:46:55 UTC
Hello,

may I ask what exactly is supposed to be the bug? I see that QEMU doesn't support Westmere, so libvirt uses '-cpu core2duo,<flags>...' to specify the CPU with correct features etc.
The host model you can see in virsh capabilities is reflecting just the host CPU capability and has nothing to do with any hypervisor.

Could you run that machine with "Nehalem" specified as cpu and check what will be specified in qemu's command line?
Thanks

Comment 6 Andrew Cathrow 2012-03-19 16:57:18 UTC
Sorry, I think I mixed xmls.

On a host that qemu-kvm -cpu ? says supports Nehalem and that shows Nehalem in virsh capabilities, setting libvirt xml to Nahlem drops down to 

-cpu kvm64,+lahf_lm,+popcnt,+sse4.2,+sse4.1,+ssse3

Comment 7 Jiri Denemark 2012-03-20 07:52:06 UTC
This is a result of our usage of -nodefconfig qemu option, which makes qemu ignore /etc/qemu/target-x86_64.conf where all the modern CPU models are defined. Try running qemu-kvm -cpu ? -nodefconfig, you will only see models in []. Cooperation with qemu upstream (which has already been started, btw) is needed to fix this issue.

Comment 8 Andrew Cathrow 2012-04-22 14:16:19 UTC
*** Bug 723739 has been marked as a duplicate of this bug. ***

Comment 9 Ayal Baron 2012-05-01 21:16:49 UTC
any update on this?

Comment 10 Martin Kletzander 2012-05-02 08:23:53 UTC
Hello, we are still waiting for qemu to implement one feature that will make libvirt able to run it without -nodefconfig option.
Eduardo posted the patches upstream, but these are not in the code, yet.
We have also patches for the implementation in libvirt sent by Jiri, however these must wait for qemu to implement their functionality.

Comment 11 Jiri Denemark 2012-05-15 19:43:44 UTC
QEMU patches were pushed yesterday and are part of qemu-1.1-rc2. Corresponding libvirt change went in today as

commit 63b4243624b8fdabebaf5e6ec912095b2b5fdf5c
Author: Jiri Denemark <jdenemar>
Date:   Thu Apr 26 12:11:49 2012 +0200

    qemu: Add support for -no-user-config

    Thanks to this new option we are now able to use modern CPU models (such
    as Westmere) defined in external configuration file.

Comment 12 Cole Robinson 2012-06-07 14:39:02 UTC
Since this requires a qemu 1.1 command line arg, this isn't a very good backport candidate. qemu 1.1 and a new libvirt release will be in rawhide within a month, so just closing as UPSTREAM