Bug 1464832 - host-model CPU with check='full' does not work well when the host-model cpu contains more fea-tures in the qemu
host-model CPU with check='full' does not work well when the host-model cpu c...
Status: ASSIGNED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Jiri Denemark
Luyao Huang
: Reopened
Depends On:
Blocks: libvirtCPUconfig
  Show dependency treegraph
 
Reported: 2017-06-25 22:04 EDT by Luyao Huang
Modified: 2017-08-22 05:06 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-07-27 12:36:15 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Luyao Huang 2017-06-25 22:04:57 EDT
Description of problem:
host-model CPU with check='full' does not work well when the host-model cpu contains more features in th qemu

Version-Release number of selected component (if applicable):
libvirt-3.2.0-14.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. check domcapabilities:

virsh # domcapabilities 
...
  <cpu>
    <mode name='host-passthrough' supported='yes'/>
    <mode name='host-model' supported='yes'>
      <model fallback='forbid'>SandyBridge</model>
      <vendor>Intel</vendor>
      <feature policy='require' name='vme'/>
      <feature policy='require' name='ss'/>
      <feature policy='require' name='pcid'/>
      <feature policy='require' name='hypervisor'/>
      <feature policy='require' name='arat'/>
      <feature policy='require' name='tsc_adjust'/>
      <feature policy='require' name='pdpe1gb'/>
      <feature policy='require' name='invtsc'/>
      <feature policy='disable' name='xsave'/>
      <feature policy='disable' name='avx'/>
    </mode>
    <mode name='custom' supported='yes'>
      <model usable='yes'>qemu64</model>
      <model usable='yes'>qemu32</model>
      <model usable='no'>phenom</model>
      <model usable='yes'>pentium3</model>
      <model usable='yes'>pentium2</model>
      <model usable='yes'>pentium</model>
      <model usable='no'>n270</model>
      <model usable='yes'>kvm64</model>
      <model usable='yes'>kvm32</model>
      <model usable='no'>cpu64-rhel6</model>
      <model usable='yes'>coreduo</model>
      <model usable='yes'>core2duo</model>
      <model usable='no'>athlon</model>
      <model usable='yes'>Westmere</model>
      <model usable='no'>Skylake-Client</model>
      <model usable='no'>SandyBridge</model>
      <model usable='yes'>Penryn</model>
      <model usable='no'>Opteron_G5</model>
      <model usable='no'>Opteron_G4</model>
      <model usable='no'>Opteron_G3</model>
      <model usable='yes'>Opteron_G2</model>
      <model usable='yes'>Opteron_G1</model>
      <model usable='yes'>Nehalem</model>
      <model usable='no'>IvyBridge</model>
      <model usable='no'>Haswell</model>
      <model usable='no'>Haswell-noTSX</model>
      <model usable='yes'>Conroe</model>
      <model usable='no'>Broadwell</model>
      <model usable='no'>Broadwell-noTSX</model>
      <model usable='yes'>486</model>
    </mode>
  </cpu>
...

S1: start a guest with host-model + check full:

1. guest xml

  <cpu mode='host-model' check='full'>
    <model fallback='allow'/>

2. start guest, libvirt will report that xsaveopt is missing:

virsh # start r7
error: Failed to start domain r7
error: operation failed: guest CPU doesn't match specification: missing features: xsaveopt

3. modify xml to disable xsaveopt:

  <cpu mode='host-model' check='full'>
    <model fallback='allow'/>
    <feature policy='disable' name='xsaveopt'/>

4. start guest:

virsh # start r7
Domain r7 started

5. recheck the guest live xml:

  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>SandyBridge</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='pcid'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='arat'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='disable' name='xsave'/>
    <feature policy='disable' name='avx'/>
    <feature policy='disable' name='xsaveopt'/>

6. login guest and check cpu:

IN GUEST:

# lscpu
...
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes hypervisor lahf_lm tsc_adjust arat

7. check the qemu log, there is no warning.

S2: start a guest with host-model + check is partial

1. modify guest xml to:

  <cpu mode='host-model' check='partial'>
    <model fallback='allow'/>

2. start guest:

# virsh start r7
Domain r7 started


3. check the guest xml and that xsaveopt will be displayed as disabled:

  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>SandyBridge</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='pcid'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='arat'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='disable' name='xsave'/>
    <feature policy='disable' name='avx'/>
    <feature policy='disable' name='xsaveopt'/>

4. check the guest log: 

warning: host doesn't support requested feature: CPUID.0DH:EAX.xsaveopt [bit 0]
warning: host doesn't support requested feature: CPUID.0DH:EAX.xsaveopt [bit 0]
warning: host doesn't support requested feature: CPUID.0DH:EAX.xsaveopt [bit 0]
warning: host doesn't support requested feature: CPUID.0DH:EAX.xsaveopt [bit 0]
warning: host doesn't support requested feature: CPUID.0DH:EAX.xsaveopt [bit 0]


S3: host-model + check is none:

the same result with check is partial


Actual results:

Libvirt didn't disable the xsaveopt when use host-model

But qemu already report host didn't have xsaveopt:

 {"name":"SandyBridge","typename":"SandyBridge-x86_64-cpu","unavailable-features":["xsaveopt"],"static":false,"migration-safe":true}

Expected results:
S1: Guest start without disable xsaveopt in guest xml
S2: Do not for add the xsaveopt cpu property in the qemu command line
S3: Do not for add the xsaveopt cpu property in the qemu command line

Additional info:

output from http://libvirt.org/git/?p=libvirt.git;a=blob_plain;f=tests/cputestdata/cpu-gather.sh:

model name	: Intel(R) Xeon(R) CPU E7- 4830  @ 2.13GHz
CPU:
   0x00000000 0x00: eax=0x0000000b ebx=0x756e6547 ecx=0x6c65746e edx=0x49656e69
   0x00000001 0x00: eax=0x000206f2 ebx=0x05400800 ecx=0x02bee3ff edx=0xbfebfbff
   0x00000002 0x00: eax=0x55035a01 ebx=0x00f0b2ec ecx=0x00000000 edx=0x09ca212c
   0x00000003 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000004 0x00: eax=0x7c004121 ebx=0x01c0003f ecx=0x0000003f edx=0x00000000
   0x00000004 0x01: eax=0x7c004122 ebx=0x00c0003f ecx=0x0000007f edx=0x00000000
   0x00000004 0x02: eax=0x7c004143 ebx=0x01c0003f ecx=0x000001ff edx=0x00000000
   0x00000004 0x03: eax=0x7c0fc163 ebx=0x05c0003f ecx=0x00003fff edx=0x00000006
   0x00000005 0x00: eax=0x00000040 ebx=0x00000040 ecx=0x00000003 edx=0x00001120
   0x00000006 0x00: eax=0x00000007 ebx=0x00000001 ecx=0x00000009 edx=0x00000000
   0x00000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000008 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x00000009 0x00: eax=0x00000001 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x0000000a 0x00: eax=0x07300403 ebx=0x00000004 ecx=0x00000000 edx=0x00000603
   0x0000000b 0x00: eax=0x00000001 ebx=0x00000002 ecx=0x00000100 edx=0x00000005
   0x0000000b 0x01: eax=0x00000006 ebx=0x00000010 ecx=0x00000201 edx=0x00000005
   0x80000000 0x00: eax=0x80000008 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000001 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000001 edx=0x2c100800
   0x80000002 0x00: eax=0x20202020 ebx=0x49202020 ecx=0x6c65746e edx=0x20295228
   0x80000003 0x00: eax=0x6e6f6558 ebx=0x20295228 ecx=0x20555043 edx=0x202d3745
   0x80000004 0x00: eax=0x30333834 ebx=0x20402020 ecx=0x33312e32 edx=0x007a4847
   0x80000005 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80000006 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x01006040 edx=0x00000000
   0x80000007 0x00: eax=0x00000000 ebx=0x00000000 ecx=0x00000000 edx=0x00000100
   0x80000008 0x00: eax=0x0000302c ebx=0x00000000 ecx=0x00000000 edx=0x00000000
   0x80860000 0x00: eax=0x00000001 ebx=0x00000002 ecx=0x00000100 edx=0x00000005
   0xc0000000 0x00: eax=0x00000001 ebx=0x00000002 ecx=0x00000100 edx=0x00000005

{"QMP": {"version": {"qemu": {"micro": 0, "minor": 9, "major": 2}, "package": "(qemu-kvm-rhev-2.9.0-12.el7)"}, "capabilities": []}}
{"return": {}}
{"return": {"model": {"name": "base", "props": {"phys-bits": 0, "core-id": -1, "xlevel": 2147483656, "cmov": true, "ia64": false, "aes": true, "mmx": true, "arat": true, "rdpid": false, "pause-filter": false, "xsavec": false, "osxsave": false, "tsc-frequency": 0, "xd": true, "hv-vendor-id": "", "kvm-asyncpf": true, "kvm_asyncpf": true, "perfctr_core": false, "perfctr-core": false, "mpx": false, "avx512cd": false, "decodeassists": false, "pbe": false, "sse4_1": true, "sse4.1": true, "sse4-1": true, "family": 6, "vmware-cpuid-freq": true, "avx512f": false, "xcrypt": false, "msr": true, "mce": true, "mca": true, "thread-id": -1, "min-level": 11, "xgetbv1": false, "cid": false, "hv-relaxed": false, "fxsr": true, "ds": false, "hv-crash": false, "xsaveopt": false, "xtpr": false, "avx512-vpopcntdq": false, "phe": false, "avx512vl": false, "extapic": false, "3dnowprefetch": false, "cr8legacy": false, "cpuid-0xb": true, "xcrypt-en": false, "kvm_pv_eoi": true, "apic-id": 4294967295, "pn": false, "dca": false, "vendor": "GenuineIntel", "pku": false, "smx": false, "cmp-legacy": false, "cmp_legacy": false, "avx512-4fmaps": false, "vmcb-clean": false, "vmcb_clean": false, "3dnowext": false, "hle": false, "npt": false, "memory": "/machine/unattached/system[0]", "clwb": false, "lbrv": false, "adx": false, "ss": true, "pni": true, "svm_lock": false, "svm-lock": false, "smep": false, "pfthreshold": false, "smap": false, "x2apic": true, "avx512vbmi": false, "i64": true, "flushbyasid": false, "f16c": false, "ace2-en": false, "pat": true, "pae": true, "sse": true, "phe-en": false, "kvm-nopiodelay": true, "kvm_nopiodelay": true, "tm": false, "kvmclock-stable-bit": true, "hypervisor": true, "socket-id": -1, "pcommit": false, "syscall": true, "level": 11, "avx512dq": false, "svm": false, "full-cpuid-auto-level": true, "invtsc": false, "sse3": true, "sse2": true, "est": false, "avx512ifma": false, "tm2": false, "kvm-pv-eoi": true, "cx8": true, "kvm-mmu": false, "kvm_mmu": false, "sse4_2": true, "sse4.2": true, "sse4-2": true, "pge": true, "fill-mtrr-mask": true, "pdcm": false, "nodeid_msr": false, "model": 47, "movbe": false, "nrip-save": false, "nrip_save": false, "sse4a": false, "ssse3": true, "kvm_pv_unhalt": true, "invpcid": false, "pdpe1gb": true, "tsc-deadline": true, "fma": false, "cx16": true, "de": true, "enforce": false, "stepping": 2, "xsave": false, "clflush": true, "skinit": false, "tce": false, "tsc": true, "fpu": true, "ds-cpl": false, "ds_cpl": false, "ibs": false, "host-phys-bits": true, "fma4": false, "la57": false, "osvw": false, "check": true, "hv-spinlocks": -1, "pmm": false, "apic": true, "pmu": false, "min-xlevel2": 0, "tsc-adjust": true, "tsc_adjust": true, "kvm-steal-time": true, "kvm_steal_time": true, "kvmclock": true, "l3-cache": true, "lwp": false, "xop": false, "avx": false, "ospke": false, "ace2": false, "acpi": false, "avx512bw": false, "hv-vapic": false, "fsgsbase": false, "ht": false, "nx": true, "pclmulqdq": true, "mmxext": false, "popcnt": true, "xsaves": false, "lm": true, "umip": false, "avx2": false, "pse": true, "sep": true, "pclmuldq": true, "nodeid-msr": false, "kvm": true, "misalignsse": false, "min-xlevel": 2147483656, "bmi2": false, "bmi1": false, "kvm-pv-unhalt": true, "realized": false, "tsc-scale": false, "tsc_scale": false, "topoext": false, "xlevel2": 0, "clflushopt": false, "kvm-no-smi-migration": false, "monitor": false, "avx512er": false, "pmm-en": false, "pcid": true, "3dnow": false, "erms": false, "lahf-lm": true, "lahf_lm": true, "xstore": false, "fxsr-opt": false, "fxsr_opt": false, "rtm": false, "lmce": true, "hv-time": false, "perfctr-nb": false, "perfctr_nb": false, "ffxsr": false, "rdrand": false, "rdseed": false, "avx512-4vnniw": false, "vme": true, "vmx": false, "dtes64": false, "mtrr": true, "rdtscp": true, "pse36": true, "tbm": false, "wdt": false, "pause_filter": false, "model-id": "       Intel(R) Xeon(R) CPU E7- 4830  @ 2.13GHz", "sha-ni": false, "abm": false, "avx512pf": false, "xstore-en": false}}}, "id": "model-expansion"}
{"return": {}}
{"timestamp": {"seconds": 1498440739, "microseconds": 661253}, "event": "SHUTDOWN", "data": {"guest": false}}

Note You need to log in before you can comment on or make changes to this bug.