Bug 1171484 - virsh cpu-baseline includes "invtsc" cpu feature
Summary: virsh cpu-baseline includes "invtsc" cpu feature
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: Unspecified
OS: Linux
low
medium
Target Milestone: rc
: 7.2
Assignee: Ján Tomko
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-07 16:40 UTC by tbsky
Modified: 2015-11-19 05:57 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.14-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:57:19 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description tbsky 2014-12-07 16:40:51 UTC
Description of problem:

virsh cpu-baseline won't give a correct model for vm migration


Version-Release number of selected component (if applicable):

libvirt-0.10.2-46

How reproducible:

100%


Steps to Reproduce:
1. find a machine which support invtsc cpu feature
2. virsh capabilities > /tmp/cpu.xml ; virsh cpu-baseline /tmp/cpu.xml | grep invtsc


Actual results:

the result cpu-baseline will have "<feature policy='require' name='invtsc'/>"
and that will cause vm migration fail.

Expected results:

virsh cpu-baseline should remove "invtsc" to make a cpu model which can be migrate.


Additional info:

the bug is related to Bug 1138222. but the fix for that bug seems not enough.

Comment 2 Ján Tomko 2015-01-19 14:26:51 UTC
virConnectBaselineCPU is documented as:
Computes the most feature-rich CPU which is compatible with all given host CPUs.
http://libvirt.org/html/libvirt-libvirt-host.html#virConnectBaselineCPU

If "invtsc" is specified on the input, it should be in the output too - it is compatible with all the hosts CPUs, it just isn't migratable.

We could add a --migratable flag to cpu-baseline that would filter them out, but that is not RHEL-6 material, moving to RHEL-7.

Comment 3 Ján Tomko 2015-02-05 14:48:53 UTC
Proposed upstream patches implementing the flag:
https://www.redhat.com/archives/libvir-list/2015-February/msg00158.html

Comment 4 Ján Tomko 2015-03-02 07:51:45 UTC
Now pushed upstream:
commit c7b9f206667af82381e932095dc5bde9386a366d
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2015-03-02 07:59:12 +0100

    Add --migratable support to virsh cpu-baseline
    
    Wire up VIR_CONNECT_BASELINE_CPU_MIGRATABLE to this
    command line option.

commit 000b21da838151fdff4b18429bae934571c8edb1
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2015-03-02 07:59:12 +0100

    Trivially implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE for non-x86 cpus
    
    Assume no features block migration.

commit 496156807b62bd0b8a27b1fbfd6449db10595cec
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2015-03-02 07:59:12 +0100

    Implement VIR_CONNECT_BASELINE_CPU_MIGRATABLE in the x86 cpu driver
    
    Filter out non-migratable features if
    VIR_CONNECT_BASELINE_CPU_MIGRATABLE was specified.

commit 02c8b66d6a0cab527a6158c2ebad663897cb0d84
Author:     Ján Tomko <jtomko@redhat.com>
CommitDate: 2015-03-02 07:59:12 +0100

    Add VIR_CONNECT_BASELINE_CPU_MIGRATABLE flag
    
    This flag for virConnectBaselineCPU will allow filtering out
    CPU features that block migration from the result.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1171484

git describe: v1.2.13-9-gc7b9f20

Comment 6 Luyao Huang 2015-07-21 09:18:09 UTC
Verify this bug with libvirt-1.2.17-2.el7.x86_64:

1. use a machine support invtsc

# cpuid -1|grep TscInvariant
      TscInvariant                   = true

2. get capabilities:

# virsh capabilities > capabilities.xml


# cat capabilities.xml|grep invtsc
      <feature name='invtsc'/>

3. 

# virsh cpu-baseline capabilities.xml
<cpu mode='custom' match='exact'>
  <model fallback='forbid'>Opteron_G5</model>
  <vendor>AMD</vendor>
  <feature policy='require' name='invtsc'/>   <----- here
  <feature policy='require' name='bmi1'/>
  <feature policy='require' name='perfctr_nb'/>
  <feature policy='require' name='perfctr_core'/>
  <feature policy='require' name='topoext'/>
  <feature policy='require' name='nodeid_msr'/>
  <feature policy='require' name='tce'/>
  <feature policy='require' name='lwp'/>
  <feature policy='require' name='wdt'/>
  <feature policy='require' name='skinit'/>
  <feature policy='require' name='ibs'/>
  <feature policy='require' name='osvw'/>
  <feature policy='require' name='cr8legacy'/>
  <feature policy='require' name='extapic'/>
  <feature policy='require' name='cmp_legacy'/>
  <feature policy='require' name='fxsr_opt'/>
  <feature policy='require' name='mmxext'/>
  <feature policy='require' name='osxsave'/>
  <feature policy='require' name='monitor'/>
  <feature policy='require' name='ht'/>
  <feature policy='require' name='vme'/>
</cpu>

4. test with --migratable

# virsh cpu-baseline capabilities.xml --migratable 
<cpu mode='custom' match='exact'>
  <model fallback='forbid'>Opteron_G5</model>
  <vendor>AMD</vendor>
  <feature policy='require' name='bmi1'/>
  <feature policy='require' name='perfctr_nb'/>
  <feature policy='require' name='perfctr_core'/>
  <feature policy='require' name='topoext'/>
  <feature policy='require' name='nodeid_msr'/>
  <feature policy='require' name='tce'/>
  <feature policy='require' name='lwp'/>
  <feature policy='require' name='wdt'/>
  <feature policy='require' name='skinit'/>
  <feature policy='require' name='ibs'/>
  <feature policy='require' name='osvw'/>
  <feature policy='require' name='cr8legacy'/>
  <feature policy='require' name='extapic'/>
  <feature policy='require' name='cmp_legacy'/>
  <feature policy='require' name='fxsr_opt'/>
  <feature policy='require' name='mmxext'/>
  <feature policy='require' name='osxsave'/>
  <feature policy='require' name='monitor'/>
  <feature policy='require' name='ht'/>
  <feature policy='require' name='vme'/>
</cpu>

5. check the man page:

       cpu-baseline FILE [--features] [--migratable]
           Compute baseline CPU which will be supported by all host CPUs given in <file>.  The list of host CPUs is built by extracting all <cpu> elements from the <file>. Thus, the <file> can contain
           either a set of <cpu> elements separated by new lines or even a set of complete <capabilities> elements printed by capabilities command.  If --features is specified then the resulting XML
           description will explicitly include all features that make up the CPU, without this option features that are part of the CPU model will not be listed in the XML description.   If --migratable is
           specified, features that block migration will not be included in the resulting CPU.

6. check the cpu-baseline output:

# virsh cpu-baseline --help
  NAME
    cpu-baseline - compute baseline CPU

  SYNOPSIS
    cpu-baseline <file> [--features] [--migratable]

  DESCRIPTION
    Compute baseline CPU for a set of given CPUs.

  OPTIONS
    [--file] <string>  file containing XML CPU descriptions
    --features       Show features that are part of the CPU model type
    --migratable     Do not include features that block migration

Comment 8 errata-xmlrpc 2015-11-19 05:57:19 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.

https://rhn.redhat.com/errata/RHBA-2015-2202.html


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