Bug 761005

Summary: libvirt [RFE] Add support for new sandy bridge cpu
Product: Red Hat Enterprise Linux 6 Reporter: Andrew Cathrow <acathrow>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, dallan, ehabkost, jdenemar, mzhan, rbalakri, rwu, toracat, veillard
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-0.9.10-6.el6 Doc Type: Enhancement
Doc Text:
In Red Hat Enterprise Linux 6.3, libvirt has been updated to add support for the latest Intel processors and new features these processors include.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 06:38:04 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: 760953    
Bug Blocks: 760952, 761015, 773650, 773651, 773677, 773696    

Description Andrew Cathrow 2011-12-07 14:58:53 UTC
qemu-kvm is adding support for the new sandy bridge cpu, including features such as TSC Deadline timer, XSAVE/XRSTOR, etc

libvirt would need to add a new CPU type

Comment 2 Peter Krempa 2011-12-09 12:24:56 UTC
Upstream commit:

commit b2cb24f48ba568659e47da26078974ab78161df9
Author: Peter Krempa <pkrempa>
Date:   Thu Dec 8 15:11:52 2011 +0100

    cpu: Add cpu flags supported by newest qemu
    
    Add support for newly supported Intel cpu features. Newly supported
    flags are: pclmuldq, dtes64, smx, fma, pdcm, movbe, xsave, osxsave and
    avx. This adds support for Intel's Sandy Bridge platform.


adds support for feature flags added newly to qemu. QEmu does not yet expose a Sandy Bridge model, so libvirt does not add it yet either.

Comment 4 Min Zhan 2012-01-11 03:40:47 UTC
Test with libvirt-0.9.9-1.el6.x86_64 using intel-e31225-8-1:

# virsh capabilities
<capabilities>

  <host>
    <uuid>322008c7-3452-0943-3c7a-09732431099f</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>Westmere</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='4' threads='1'/>
      <feature name='rdtscp'/>
      <feature name='avx'/>
      <feature name='osxsave'/>
      <feature name='xsave'/>
      <feature name='x2apic'/>
      <feature name='pdcm'/>
      <feature name='xtpr'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='smx'/>
      <feature name='vmx'/>
      <feature name='ds_cpl'/>
      <feature name='dtes64'/>
      <feature name='pclmuldq'/>
      <feature name='pbe'/>
      <feature name='tm'/>
      <feature name='ht'/>
      <feature name='ss'/>
      <feature name='acpi'/>
      <feature name='ds'/>
      <feature name='vme'/>
    </cpu>
....

We can see these new flags: pclmuldq, dtes64, smx, pdcm, xsave, osxsave, avx.

Since QEMU does not yet expose a Sandy Bridge model, so will verify this bug again after bug 760953[Assigned] verified.

Comment 5 Min Zhan 2012-01-11 06:17:47 UTC
(In reply to comment #4)

# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.213.el6.x86_64
# rpm -q kernel
kernel-2.6.32-220.el6.x86_64

Comment 6 Peter Krempa 2012-01-16 16:34:38 UTC
I'm setting this bug to ASSIGNED as we should also add the model to the XML. We need to do some research on the minimum set of flags to be supported by the Sandy bridge cpu.

Comment 7 Peter Krempa 2012-02-06 12:58:10 UTC
The upstream support for Sandy Bridge should be ready soon (patches are submitted). The fix in libvirt will be trivial after qemu will support the new model.

Comment 8 Dave Allan 2012-02-06 16:01:29 UTC
(In reply to comment #7)
> The upstream support for Sandy Bridge should be ready soon (patches are
> submitted). The fix in libvirt will be trivial after qemu will support the new
> model.

Upstream qemu or libvirt or both?

Comment 10 Dave Allan 2012-02-16 14:41:18 UTC
I removed the Failed QA flag as this BZ has not yet been implemented in qemu and should not have been tested.

Comment 15 Min Zhan 2012-03-19 09:33:54 UTC
Tested with libvirt-0.9.10-6.el6 in the same machine of Comment 4:

Pkgs:
libvirt-0.9.10-6.el6
qemu-kvm-0.12.1.2-2.248.el6
# uname -r
2.6.32-244.el6.x86_64

# virsh capabilities
<capabilities>

  <host>
    <uuid>322008c7-3452-0943-3c7a-09732431099f</uuid>
    <cpu>
      <arch>x86_64</arch>
      <model>SandyBridge</model>
      <vendor>Intel</vendor>
      <topology sockets='1' cores='4' threads='1'/>
      <feature name='osxsave'/>
      <feature name='tsc-deadline'/>
      <feature name='pdcm'/>
      <feature name='xtpr'/>
      <feature name='tm2'/>
      <feature name='est'/>
      <feature name='smx'/>
      <feature name='vmx'/>
      <feature name='ds_cpl'/>
      <feature name='dtes64'/>
      <feature name='pbe'/>
      <feature name='tm'/>
      <feature name='ht'/>
      <feature name='ss'/>
      <feature name='acpi'/>
      <feature name='ds'/>
      <feature name='vme'/>
    </cpu>

The model is SandyBridge, but the flags are missing some, like avx, xsave, pclmuldq. Is it expected?

Comment 16 Peter Krempa 2012-03-19 14:08:53 UTC
Those features that are shown by the capabilities command are extra features that are supported by the host CPU (and inquired by the CPUID instruction) and not defined in the SandyBridge model definition.

The SandyBride model in qemu that is present in rhel6.3 is defined as:

[cpudef]
   name = "SandyBridge"
   level = "0xd"
   vendor = "GenuineIntel"
   family = "6"
   model = "42"
   stepping = "1"
   feature_edx = " sse2 sse fxsr mmx clflush pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de fpu"
   feature_ecx = "avx xsave aes popcnt x2apic sse4.2 sse4.1 cx16 ssse3 pclmulqdq sse3"
   extfeature_edx = "i64 rdtscp nx syscall "
   extfeature_ecx = "lahf_lm"
   xlevel = "0x8000000A"
   model_id = "Intel Xeon E312xx (Sandy Bridge)"

(note that libvirt uses other names for some flags).

Comment 17 Eduardo Habkost 2012-03-19 17:46:13 UTC
The SandyBridge CPU model on qemu-kvm will be updated due to bug 767944 (TSC-deadline feature), so libvirt will have to be updated as well.

Is it better to reopen this bug so the model can be fixed after qemu-kvm changes, or open a new bug for libvirt?

Comment 18 Peter Krempa 2012-03-19 18:03:38 UTC
After discussing with Dave, please open a new bug. We will need to revert a RHEL-specific patch that disabled the tsc-deadline feature in SandyBridge that was backported completly from upstream.

Comment 19 Min Zhan 2012-03-20 06:09:24 UTC
Check SandyBridge definition in /usr/share/libvirt/cpu_map.xml, it has the flags such as pclmuldq, avx, xsave:

<model name='SandyBridge'>
      <vendor name='Intel'/>
      <feature name='aes'/>
      <feature name='apic'/>
      <feature name='avx'/>
      <feature name='clflush'/>
      <feature name='cmov'/>
      <feature name='cx16'/>
      <feature name='cx8'/>
      <feature name='de'/>
      <feature name='fpu'/>
      <feature name='fxsr'/>
      <feature name='lahf_lm'/>
      <feature name='lm'/>
      <feature name='mca'/>
      <feature name='mce'/>
      <feature name='mmx'/>
      <feature name='msr'/>
      <feature name='mtrr'/>
      <feature name='nx'/>
      <feature name='pae'/>
      <feature name='pat'/>
      <feature name='pclmuldq'/>
      <feature name='pge'/>
      <feature name='pni'/>
      <feature name='popcnt'/>
      <feature name='pse'/>
      <feature name='pse36'/>
      <feature name='rdtscp'/>
      <feature name='sep'/>
      <feature name='sse'/>
      <feature name='sse2'/>
      <feature name='sse4.1'/>
      <feature name='sse4.2'/>
      <feature name='ssse3'/>
      <feature name='syscall'/>
      <feature name='tsc'/>
      <feature name='x2apic'/>
      <feature name='xsave'/>
    </model>

Together with comment 15 and comment 16, move this bug to verified.

Comment 20 Peter Krempa 2012-05-02 12:41:06 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Libvirt now supports features provided by the most recent Intel processors.

Comment 21 Martin Prpič 2012-05-09 09:39:39 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-Libvirt now supports features provided by the most recent Intel processors.+In Red Hat Enterprise Linux 6.3, libvirt has been updated to add support for the latest Intel processors and new features these processors include.

Comment 23 errata-xmlrpc 2012-06-20 06:38:04 UTC
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