Commit Graph

108 Commits

Author SHA1 Message Date
Jiri Denemark
4ca81baa23 cputest: Add data for Intel(R) Core(TM) i7-7700 CPU
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-11-07 23:40:47 +01:00
Jiri Denemark
d85ae683e5 cputest: Add data for Intel(R) Xeon(R) CPU E5-2650 v4
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-11-07 23:40:47 +01:00
Jiri Denemark
6f10044d4f cputest: Do not drop v[0-9] from CPU names
Version is a significant part of some Xeon CPUs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-11-07 23:40:47 +01:00
Jiri Denemark
c7d27105cb cputest: Add query-cpu-definitions reply for Xeon-E7-8890
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-17 22:37:04 +02:00
Jiri Denemark
637d2ce91a cputest: Update Xeon-E7-8890 data
Without the fix in the previous patch the JSON data from QEMU would be
interpreted as Haswell-noTSX because x86DataFilterTSX would filter rtm
and hle features as a result of

    family == 6 && model == 63 && stepping < 4

test even though this CPU has stepping == 4.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-17 22:37:04 +02:00
Jiri Denemark
91d69cb03e cputest: Make a crippled version of Core-i7-2600
xsaveopt is artificially removed from the host to test disabled feature
which is only included in QEMU's version of the CPU model.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
911643ce45 cputest: Update Core-i7-2600 data
arat is now enabled even if the hardware does not support it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
66b9f3ec9c cputest: Add query-cpu-definitions reply for Xeon-E3-1245
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
29a16fb618 cputest: Update Xeon-E3-1245 data
xsaves is supported by current QEMU/KVM on this CPU.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
8e72c612fe cputest: Add query-cpu-definitions reply for Xeon-E7-4830
This CPU was incorrectly detected as SandyBridge before because the
number of additional <feature> elements was the same for both
SandyBridge and Westmere CPU models, but SandyBridge is newer (the CPU
signature does not help here because it doesn't match any signature
defined in cpu_map.xml). But since QEMU's version of SandyBridge CPU
model contains xsaveopt which needs to be disabled, Westmere becomes the
best CPU model when translating CPUID data to virCPUDef. Unfortunately,
this doesn't help with translating the data we got from QEMU and the CPU
model is still computed as SandyBridge in this case.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
3479f297b3 cputest: Add CPUID data for Intel(R) Xeon(R) CPU E7-4830
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:21 +02:00
Jiri Denemark
11eddf3de0 cputest: Add query-cpu-definitions reply for Core-i5-2540M
The unavailable features do not make any difference in this case,
because this is a SandyBridge CPU which has an empty list of unavailable
features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:20 +02:00
Jiri Denemark
7bca16937a cputest: Test CPU usability blockers
Gather query-cpu-definitions results and use them for testing CPU model
usability blockers in CPUID to virCPUDef translation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:20 +02:00
Jiri Denemark
9d62af7283 cputest: Avoid calling json_reformat in cpu-parse.sh
Various version of json_reformat use different number of spaces for
indenting. Let's use a simple python reformatter to gain full control
over the formatting for consistent results.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
2017-10-16 09:23:20 +02:00
Jiri Denemark
4fd179f518 cpu_conf: Drop updateCPU from virCPUDefFormat
In the past we updated host-model CPUs with host CPU data by adding a
model and features, but keeping the host-model mode. And since the CPU
model is not normally formatted for host-model CPU defs, we had to pass
the updateCPU flag to the formatting code to be able to properly output
updated host-model CPUs. Libvirt doesn't do this anymore, host-model
CPUs are turned into custom mode CPUs once updated with host CPU data
and thus there's no reason for keeping the hacks inside CPU XML
formatters.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-09-21 15:23:39 +02:00
Andrea Bolognani
f34fdd5ab6 python: Don't hardcode interpreter path
This is particularly useful on operating systems that don't ship
Python as part of the base system (eg. FreeBSD) while still working
just as well as it did before on Linux.

While at it, make it explicit that our scripts are only going to
work with Python 2, and remove the usage of unbuffered I/O, which
as far as I can tell has no effect on the output files.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2017-09-19 16:04:53 +02:00
Jiri Denemark
848b72421f cpu: Add new Skylake-Server CPU model
Available since QEMU 2.10.0 (specifically commit
v2.9.0-2233-g53f9a6f45f).

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-18 15:10:46 +02:00
Jiri Denemark
78d177df67 cpu: Add clwb/pcommit CPU features
The features were added to QEMU by commit v2.4.0-1690-gf7fda28094 as
Skylake Server features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-18 15:10:46 +02:00
Jiri Denemark
1c65bd1402 tests: Add CPUID data for Intel(R) Xeon(R) Gold 6148 CPU
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-18 15:10:46 +02:00
Brijesh Singh
a0b628432a cpu: Add new EPYC CPU model
Add a new CPU model called 'EPYC' to model processors from AMD EPYC
family (which includes EPYC 76xx,75xx,74xx, 73xx and 72xx).

The following features bits have been added/removed compare to Opteron_G5

Added: monitor, movbe, rdrand, mmxext, ffxsr, rdtscp, cr8legacy, osvw,
       fsgsbase, bmi1, avx2, smep, bmi2, rdseed, adx, smap, clfshopt, sha
       xsaveopt, xsavec, xgetbv1, arat

Removed: xop, fma4, tbm

The patch is depend on EPYC CPU model supported introduced in qemu [1]

[1] https://patchwork.kernel.org/patch/9902205/

Cc: Tom Lendacky <Thomas.Lendacky@amd.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-07 13:53:32 +02:00
Jiri Denemark
5c83b3603c tests: Add CPUID data for AMD EPYC 7601 32-Core Processor
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-07 13:53:32 +02:00
Jiri Denemark
92bd87a239 tests: Add CPUID data for AMD Ryzen 7 1800X Eight-Core Processor
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-07 13:53:32 +02:00
Jiri Denemark
83e081b8ab cpu_x86: Properly disable unknown CPU features
CPU features unknown to a hypervisor will not be present in dataDisabled
even though the features won't naturally be enabled because.
Thus any features we asked for which are not in dataEnabled should be
considered disabled.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-07-13 09:53:15 +02:00
Jiri Denemark
88705d4c9d cputest: Disable "cmt" feature unknown to QEMU
All CPU features which QEMU does not know about but libvirt knows them
(currently "cmt" is the only one) are implicitly disabled by QEMU and
should be present in x86_64-cpuid-*-disabled.xml.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
cc033b100c cputest: Disable TSX on broken models
Commit v3.1.0-26-gd60012b4e started filtering hle and rtm features from
broken Intel Haswell CPUs. QEMU implemented similar functionality and
thus it doesn't report rtm and hle features as enabled for Core i5-4670T
CPU anymore.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
9b6c01845b cputest: Generate data for virCPUUpdateLive
Generated with

    (cd tests/cputestdata; ./cpu-cpuid.py diff x86_64-cpuid-*.json)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
2aeef0f6be cputest: Add "diff" command to cpu-cpuid.py
The new command can be used to generate test data for virCPUUpdateLive.

When "cpu-cpuid.py diff x86-cpuid-Something.json" is run, it reads raw
CPUID data stored in x86-cpuid-Something.xml and CPUID data from QEMU
stored in x86-cpuid-Something.json to produce two more CPUID files:
x86-cpuid-Something-enabled.xml and x86-cpuid-Something-disabled.xml.

- x86-cpuid-Something-enabled.xml will contain CPUID bits present in
    x86-cpuid-Something.json (i.e., enabled by QEMU for the "host" CPU)

- x86-cpuid-Something-disabled.xml will contain all CPUID bits from
    x86-cpuid-Something.xml which are not present in
    x86-cpuid-Something.json (i.e., CPUID bits which the host CPU
    supports, but QEMU does not enable them for the "host" CPU)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
74f0b0c552 cputest: Add cpuidLeaf helper to cpu-cpuid.py
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
e7bf3c06b8 cputest: Add cpuidIsSet helper to cpu-cpuid.py
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
72c44a15c9 cputest: Rename cpu-convert.py script as cpu-cpuid.py
The new script is going to be more general and the original
functionality can be requested by "cpu-cpuid.py convert".

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
ac49ce42ef cputest: Move instantiation of JSONDecoder in cpu-convert.py
Let's make the object local to the parseFeatureWords function which uses
it.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
d8b3dd16cb cpu: Move feature expansion out of cpuBaseline
cpuBaseline is responsible for computing a baseline CPU while feature
expansion is done by virCPUExpandFeatures. The cpuBaselineXML wrapper
(used by hypervisor drivers to implement virConnectBaselineCPU API)
calls cpuBaseline followed by virCPUExpandFeatures if requested by
VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES flag.

The features in the three changed test files had to be sorted using
"sort -k 3" because virCPUExpandFeatures returns a sorted list of
features.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-27 16:29:27 +02:00
Jiri Denemark
065564c840 cputest: New test for Intel Core i7-4510U
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-13 23:49:57 +01:00
Jiri Denemark
5cbc247e0d Do not format <arch> in guest CPU XML
This element is only allowed for host CPUs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-13 23:49:57 +01:00
Jiri Denemark
3f174b6cba cputest: Add CPUID data for Haswell with TSX
All existing Haswell CPUID data were gathered from CPUs with broken TSX.
Let's add new data for Haswell with correct TSX implementation.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
d60012b4e7 cpu_x86: Disable TSX on broken models
All Intel Haswell processors (except Xeon E7 v3 with stepping >= 4) have
TSX disabled by microcode update. As not all CPUs are guaranteed to be
patched with microcode updates we need to explicitly disable TSX on
affected CPUs to avoid its accidental usage.

https://bugzilla.redhat.com/show_bug.cgi?id=1406791

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
8907204cd8 cputest: Drop .new suffix from CPU test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
5e4fc2ef99 cputest: Drop obsolete CPU test data files
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
a19696b592 cputest: Test virQEMUCapsInitCPUModel
The original test didn't use family/model numbers to make better
decisions about the CPU model and thus mis-detected the model in the two
cases which are modified in this commit. The detected CPU models now
match those obtained from raw CPUID data.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
d46a1aa4d8 cputest: Convert all json data files to query-cpu-model-expansion
Converted by running the following command, renaming the files as
*.new, and committing only the *.new files.

    (cd tests/cputestdata; ./cpu-convert.py *.json)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
d065934cd0 cputest: Switch host CPU data scripts to model expansion
Instantiating "host" CPU and querying it using qom-get has been the only
way of probing host CPU via QEMU until 2.9.0 implemented
query-cpu-model-expansion for x86_64. Even though libvirt never really
used the old way its result can be easily converted into the one
produced by query-cpu-model-expansion. Thus we can reuse the original
test data and possible get new data from hosts where QEMU does not
support the new QMP command.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-03-03 19:57:57 +01:00
Jiri Denemark
3944aba1df cputest: Rename x86 data files
While "x86" is a CPU sub driver name, it is not a recognized name of any
architecture known to libvirt. Let's use "x86_64" prefix which can be
used with virArch APIs.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
2017-02-24 14:10:57 +01:00
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