Commit Graph

66 Commits

Author SHA1 Message Date
Jiri Denemark
78d27c6501 cputest: Fix name of the file removed by cpu-parse.sh
We want to remove the file created by

    json <<<"$data" >$fname.json

in case it was empty.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-17 11:19:29 +01:00
Jiri Denemark
98b7c37d37 cpu: Avoid adding <vendor> to custom CPUs
Guest CPU definitions with mode='custom' and missing <vendor> are
expected to run on a host CPU from any vendor as long as the required
CPU model can be used as a guest CPU on the host. But even though no CPU
vendor was explicitly requested we would sometimes force it due to a bug
in virCPUUpdate and virCPUTranslate.

The bug would effectively forbid cross vendor migrations even if they
were previously working just fine.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-15 15:49:16 +01:00
Jiri Denemark
509a4a40f9 cputest: Don't test cpuGuestData
The API is no longer used anywhere else since it was replaced by a much
saner work flow utilizing new APIs that work on virCPUDefPtr directly:
virCPUCompare, virCPUUpdate, and virCPUTranslate.

Not testing the new work flow caused some bugs to be hidden. This patch
reveals them, but doesn't attempt to fix them. To make sure all test
still pass after this patch, all affected test results are modified to
pretend the tests succeeded. All of the bugs will be fixed in the
following commits and the artificial modifications will be reverted.

The following is the list of bugs in the new CPU model work flow:

- a guest CPU with mode='custom' and missing <vendor/> gets the vendor
  copied from host's CPU (the vendor should only be copied to host-model
  CPUs):
    DO_TEST_UPDATE("x86", "host", "min", VIR_CPU_COMPARE_IDENTICAL)
    DO_TEST_UPDATE("x86", "host", "pentium3", VIR_CPU_COMPARE_IDENTICAL)
    DO_TEST_GUESTCPU("x86", "host-better", "pentium3", NULL, 0)

- when a guest CPU with mode='custom' needs to be translated into
  another model because the original model is not supported by a
  hypervisor, the result will have its vendor set to the vendor of the
  original CPU model as specified in cpu_map.xml even if the original
  guest CPU XML didn't contain <vendor/>:
    DO_TEST_GUESTCPU("x86", "host", "guest", model486, 0)
    DO_TEST_GUESTCPU("x86", "host", "guest", models, 0)
    DO_TEST_GUESTCPU("x86", "host-Haswell-noTSX", "Haswell-noTSX",
                     haswell, 0)

- legacy POWERx_v* model names are not recognized:
    DO_TEST_GUESTCPU("ppc64", "host", "guest-legacy", ppc_models, 0)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-15 15:49:16 +01:00
Jiri Denemark
6384277611 cputest: Don't use superfluous preferred model
In some cases preferred model doesn't really do anything since the
result remains the same even if it is removed.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-15 15:49:16 +01:00
Jiri Denemark
f60c5e4eb6 cputest: Don't use unsupported preferred model
Using a preferred CPU model which is not in the list of CPU models
supported by a hypervisor does not make sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-15 15:49:16 +01:00
Jiri Denemark
43a9427046 cputest: Don't use preferred model for minimum match CPUs
Guest CPUs with match='minimum' should always be updated to match host
CPU model. Trying to get different results by supplying preferred models
does not make sense.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-11-15 15:49:16 +01:00
Jiri Denemark
3b6be3c0c5 cpu: Rework cpuUpdate
The reworked API is now called virCPUUpdate and it should change the
provided CPU definition into a one which can be consumed by the QEMU
command line builder:

    - host-passthrough remains unchanged
    - host-model is turned into custom CPU with a model and features
      copied from host
    - custom CPU with minimum match is converted similarly to host-model
    - optional features are updated according to host's CPU

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-09-22 15:40:09 +02:00
Qiaowei Ren
f294b83ee6 cpu_map.xml: add cmt/mbm feature to x86
Some Intel processor families (e.g. the Intel Xeon processor E5 v3
family) introduced some PQos (Platform Qos) features, including CMT
(Cache Monitoring technology) and MBM (Memory Bandwidth Monitoring),
to monitor or control shared resource. This patch add them into x86
part of cpu_map.xml to be used for applications based on libvirt to
get cpu capabilities. For example, Nova in OpenStack schedules guests
based on the CPU features that the host has.

Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
2016-06-25 00:23:58 +02:00
Jiri Denemark
5a9221b9af cpu_x86: Use signature in CPU detection code
Our current detection code uses just the number of CPU features which
need to be added/removed from the CPU model to fully describe the CPUID
data. The smallest number wins. But this may sometimes generate wrong
results as one can see from the fixed test cases. This patch modifies
the algorithm to prefer the CPU model with matching signature even if
this model results in a longer list of additional features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-17 11:46:31 +02:00
Jiri Denemark
2f3ccdf01b cpu: Add Skylake-Client x86 CPU model
The CPU model was implemented in QEMU by commit f6f949e929.

The change to i7-5600U is wrong since it's a 5th generation CPU, i.e.,
Broadwell rather than Skylake, but that's just the result of our CPU
detection code (which is fixed by the following commit).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-17 11:40:58 +02:00
Jiri Denemark
ee12b78189 cputest: Rename nehalem-force to penryn-force
The actual CPU model in the data files is Penryn which makes the file
name look rather strange. Well, one of them contains Nehalem, but that's
a bug which will be fixed soon.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 12:15:23 +02:00
Jiri Denemark
877c46d8a7 cpu: Add ARAT x86 CPU feature
Implemented in QEMU by commit 28b8e4d0bf93ba176b4b7be819d537383c5a9060.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
6dd5910da7 cpu: Add x86 feature flags for CPUID leaf 0xd, sub leaf 1
This was implemented in QEMU by commit 0bb0b2d2fe7f645dda.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
4c39a448e8 cpu: Sort CPU map features on eax_in
As a side effect this changes the order of CPU features in XMLs
generated by libvirt, but that's not a big deal since the order there is
insignificant.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 10:16:44 +02:00
Jiri Denemark
c57c2bb53a tests: Add CPU detection test for Intel Xeon X5460
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
3b5dac0d87 tests: Add CPU detection test for Intel Xeon W3520
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
37ae56687e tests: Add CPU detection test for Intel Xeon E7-4820
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
355163fb92 tests: Add CPU detection test for Intel Xeon E5-2650
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
5a58fcccaa tests: Add CPU detection test for Intel Xeon E5-2630
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
c2db8a66d5 tests: Add CPU detection test for Intel Xeon E3-1245
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
d139a2f7fc tests: Add CPU detection test for Intel Xeon 5110
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
40b54ebe14 tests: Add CPU detection test for AMD Phenom II X4 B95
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
f3ebce1466 tests: Add CPU detection test for Intel Pentium P6100
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
40ce319620 tests: Add CPU detection test for AMD Opteron 6282 SE
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
7608508c72 tests: Add CPU detection test for AMD Opteron 6234
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
29461bc019 tests: Add CPU detection test for AMD Opteron 2350
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
57fab4ff9e tests: Add CPU detection test for AMD Opteron 1352
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
653940797b tests: Add CPU detection test for AMD FX 8150
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
71c425f600 tests: Add CPU detection test for Intel Core2 Quad Q9500
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
791a641c55 tests: Add CPU detection test for Intel Core2 Duo E6850
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
4a5be5839c tests: Add CPU detection test for Intel Core i7-5600U
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
5de8c05852 tests: Add CPU detection test for Intel Core i7-4600U
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
e6f8b1b6ac tests: Add CPU detection test for Intel Core i7-3770
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
120eaad889 tests: Add CPU detection test for Intel Core i7-3740QM
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
e2525417a9 tests: Add CPU detection test for Intel Core i7-3520M
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
31e3508ca1 tests: Add CPU detection test for Intel Core i7-2600
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
bee9c53002 tests: Add CPU detection test for Intel Core i5-6600
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
1354cf151e tests: Add CPU detection test for Intel Core i5-4670T
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
daf1a69345 tests: Add CPU detection test for Intel Core i5-2540M
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
2f458fc196 tests: Add CPU detection test for Intel Core i5-2500
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
7100d14f86 tests: Add CPU detection test for Intel Atom N450
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
8f8638c2bf tests: Add CPU detection test for Intel Atom D510
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
c3380e713e tests: Add CPU detection test for AMD A10-5800K
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
3704b9003f tests: Add CPU detection tests
So far we only test CPUID -> CPU def conversion on artificial CPUID data
computed from another CPU def. This patch adds the infrastructure to
test this conversion on real data gathered from a host CPU and two
helper scripts for adding new test data:

- cpu-gather.sh runs cpuid tool and qemu-system-x86_64 to get CPUID data
  from the host CPU; this is what users can be asked to run if they run
  into an issue with host CPU detection in libvirt

- cpu-parse.sh takes the data generated by cpu-gather.sh and creates
  data files for CPU detection tests

The CPUID data queried from QEMU will eventually switch to the format
used by query-host-cpu QMP command once QEMU implements it. Until then
we just spawn QEMU with -cpu host and query the guest CPU in QOM. They
should both provide the same CPUID results, but query-host-cpu does not
require any guest CPU to be created by QEMU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
fc4ee3e674 cpu_x86: Propagate vendor to guest's virCPUData
When computing CPU data for a given guest CPU we should set CPUID vendor
bits appropriately so that we don't lose the vendor when transforming
CPU data back to XML description.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-06-09 09:47:56 +02:00
Jiri Denemark
3a7cd180a5 cpu_x86: Use array of features in CPU map
There's no reason for keeping the features in a linked list. Especially
when we know upfront the total number of features we are loading.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2016-05-20 09:18:56 +02:00
Andrea Bolognani
7dc52241b3 tests: Add some compatibility-related cases to the CPU tests 2015-08-21 15:42:38 -07:00
Andrea Bolognani
818e68c5b4 tests: Add a bunch of cpu test case for ppc64
The test cases cover the cpuCompare(), cpuBaseline() and
cpuNodeData() implementation.
2015-08-11 15:25:28 +02:00
Andrea Bolognani
049df97504 tests: Re-enable ppc64 cpu tests
Now that all the changes have been implemented we can run the
test cases once again, after updating them to reflect the new
behaviour.
2015-08-11 15:25:28 +02:00
Andrea Bolognani
96b2c7459c cpu: CPU model names have to match on ppc64
Limitations of the POWER architecture mean that you can't run
eg. a POWER7 guest on a POWER8 host when using KVM. This applies
to all guests, not just those using VIR_CPU_MATCH_STRICT in the
CPU definition; in fact, exact and strict CPU matching are
basically the same on ppc64.

This means, of course, that hosts using different CPUs have to be
considered incompatible as well.

Change ppc64Compute(), called by cpuGuestData(), to reflect this
fact and update test cases accordingly.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
2015-08-11 11:04:57 +02:00