[Qemu-devel] [PATCH v2 0/7] target/i386: support VMX features in "-cpu"

Paolo Bonzini posted 7 patches 4 years, 7 months ago
Test docker-clang@ubuntu passed
Test FreeBSD passed
Test checkpatch failed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1568716480-9973-1-git-send-email-pbonzini@redhat.com
Maintainers: Richard Henderson <rth@twiddle.net>, Marcelo Tosatti <mtosatti@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
include/sysemu/kvm.h |   2 +-
scripts/kvm/vmxcap   |  14 +-
target/i386/cpu.c    | 443 ++++++++++++++++++++++++++++++++++++++++-----------
target/i386/cpu.h    | 136 +++++++++++++++-
target/i386/kvm.c    | 173 +++++++++++++++++++-
5 files changed, 665 insertions(+), 103 deletions(-)
[Qemu-devel] [PATCH v2 0/7] target/i386: support VMX features in "-cpu"
Posted by Paolo Bonzini 4 years, 7 months ago
This series adds support for VMX feature flags so that the user can
enable and disable at will the flags.  A separate series will
also add VMX features to named CPU models, which will complete VMX
live migration support.  That's orthogonal and somewhat tedious.

There are a few complications, which are tackled across the series:

- KVM ioctls fail for some invalid MSR settings, namely when some
  controls are reported as available but the corresponding CPUID
  bits have been disabled.  For backwards compatibility with
  e.g. "-cpu host,-rdrand", these VMX features are silently
  dropped (patch 2)

- some VMX MSRs have features in the high 32 bits (patch 3)

- some VMX MSRs have values in the high 32 bits, but only
  actually have 32 features; this is handled in patch 6 by
  mangling the result of KVM_GET_MSRS

- KVM has a couple bugs that can be worked around relatively
  easily (patch 6 and 7)

Paolo

v1->v2: do not consult check_cpuid/enforce_cpuid in mark_unavailable_features
	introduce struct FeatureMask


Paolo Bonzini (7):
  target/i386: handle filtered_features in a new function
    mark_unavailable_features
  target/i386: introduce generic feature dependency mechanism
  target/i386: expand feature words to 64 bits
  target/i386: add VMX definitions
  vmxcap: correct the name of the variables
  target/i386: add VMX features
  target/i386: work around KVM_GET_MSRS bug for secondary execution
    controls

 include/sysemu/kvm.h |   2 +-
 scripts/kvm/vmxcap   |  14 +-
 target/i386/cpu.c    | 443 ++++++++++++++++++++++++++++++++++++++++-----------
 target/i386/cpu.h    | 136 +++++++++++++++-
 target/i386/kvm.c    | 173 +++++++++++++++++++-
 5 files changed, 665 insertions(+), 103 deletions(-)

-- 
1.8.3.1


Re: [Qemu-devel] [PATCH v2 0/7] target/i386: support VMX features in "-cpu"
Posted by no-reply@patchew.org 4 years, 7 months ago
Patchew URL: https://patchew.org/QEMU/1568716480-9973-1-git-send-email-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Subject: [Qemu-devel] [PATCH v2 0/7] target/i386: support VMX features in "-cpu"
Message-id: 1568716480-9973-1-git-send-email-pbonzini@redhat.com
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
   521db80..186c0ab  master     -> master
 - [tag update]      patchew/156871562997.196432.17776290406203122029.stgit@bahia.lan -> patchew/156871562997.196432.17776290406203122029.stgit@bahia.lan
 * [new tag]         patchew/1568716480-9973-1-git-send-email-pbonzini@redhat.com -> patchew/1568716480-9973-1-git-send-email-pbonzini@redhat.com
 * [new tag]         patchew/156872146565.1757.3033215873677512474.stgit@pasha-Precision-3630-Tower -> patchew/156872146565.1757.3033215873677512474.stgit@pasha-Precision-3630-Tower
 - [tag update]      patchew/20190917092004.999-1-mreitz@redhat.com -> patchew/20190917092004.999-1-mreitz@redhat.com
 * [new tag]         patchew/20190917110443.2029-1-kwolf@redhat.com -> patchew/20190917110443.2029-1-kwolf@redhat.com
 * [new tag]         patchew/20190917111441.27405-1-kraxel@redhat.com -> patchew/20190917111441.27405-1-kraxel@redhat.com
Switched to a new branch 'test'
728ad01 target/i386: work around KVM_GET_MSRS bug for secondary execution controls
dd50d5d target/i386: add VMX features
14eae1d vmxcap: correct the name of the variables
6914f81 target/i386: add VMX definitions
60e92af target/i386: expand feature words to 64 bits
50ba007 target/i386: introduce generic feature dependency mechanism
2cc5119 target/i386: handle filtered_features in a new function mark_unavailable_features

=== OUTPUT BEGIN ===
1/7 Checking commit 2cc511980158 (target/i386: handle filtered_features in a new function mark_unavailable_features)
ERROR: suspect code indent for conditional statements (4, 9)
#27: FILE: target/i386/cpu.c:3103:
+    for (w = 0; w < FEATURE_WORDS; w++) {
+         if (cpu->filtered_features[w]) {

ERROR: suspect code indent for conditional statements (9, 13)
#28: FILE: target/i386/cpu.c:3104:
+         if (cpu->filtered_features[w]) {
+             return true;

WARNING: line over 80 characters
#139: FILE: target/i386/cpu.c:5215:
+            mark_unavailable_features(cpu, FEAT_7_0_EBX, CPUID_7_0_EBX_INTEL_PT, prefix);

total: 2 errors, 1 warnings, 147 lines checked

Patch 1/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/7 Checking commit 50ba0079516a (target/i386: introduce generic feature dependency mechanism)
WARNING: line over 80 characters
#126: FILE: target/i386/cpu.c:5114:
+            uint32_t unavailable_features = env->features[d->to.index] & d->to.mask;

WARNING: line over 80 characters
#133: FILE: target/i386/cpu.c:5116:
+            /* Not an error unless the dependent feature was added explicitly.  */

ERROR: line over 90 characters
#135: FILE: target/i386/cpu.c:5118:
+                                      unavailable_features & env->user_features[d->to.index],

total: 1 errors, 2 warnings, 110 lines checked

Patch 2/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

3/7 Checking commit 60e92afb4b86 (target/i386: expand feature words to 64 bits)
WARNING: line over 80 characters
#153: FILE: target/i386/cpu.c:3442:
+    assert(bitnr < 32 || !(name && feature_word_info[w].type == CPUID_FEATURE_WORD));

WARNING: line over 80 characters
#209: FILE: target/i386/cpu.c:5117:
+            uint64_t unavailable_features = env->features[d->to.index] & d->to.mask;

total: 0 errors, 2 warnings, 235 lines checked

Patch 3/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/7 Checking commit 6914f81d020e (target/i386: add VMX definitions)
5/7 Checking commit 14eae1d5e8ea (vmxcap: correct the name of the variables)
6/7 Checking commit dd50d5d8984b (target/i386: add VMX features)
ERROR: line over 90 characters
#32: FILE: target/i386/cpu.c:1244:
+            "vmx-cr8-store-exit", "vmx-flexpriority", "vmx-vnmi-pending", "vmx-movdr-exit",

WARNING: line over 80 characters
#34: FILE: target/i386/cpu.c:1246:
+            "vmx-msr-bitmap", "vmx-monitor-exit", "vmx-pause-exit", "vmx-secondary-ctls",

WARNING: line over 80 characters
#45: FILE: target/i386/cpu.c:1257:
+            "vmx-apicv-x2apic", "vmx-vpid", "vmx-wbinvd-exit", "vmx-unrestricted-guest",

WARNING: line over 80 characters
#47: FILE: target/i386/cpu.c:1259:
+            "vmx-invpcid-exit", "vmx-vmfunc", "vmx-shadow-vmcs", "vmx-encls-exit",

WARNING: Block comments use a leading /* on a separate line
#84: FILE: target/i386/cpu.c:1296:
+            NULL, NULL /* vmx-exit-host-addr-space-size */, NULL, NULL,

ERROR: line over 90 characters
#103: FILE: target/i386/cpu.c:1315:
+            NULL, "vmx-entry-load-perf-global-ctrl", "vmx-entry-load-pat", "vmx-entry-load-efer",

WARNING: line over 80 characters
#145: FILE: target/i386/cpu.c:1357:
+                "vmx-invvpid-all-context", "vmx-invept-single-context-noglobals",

WARNING: line over 80 characters
#166: FILE: target/i386/cpu.c:1378:
+        /* Just to be safe - we don't support setting the MSEG version field.  */

WARNING: line over 80 characters
#216: FILE: target/i386/cpu.c:1441:
+        .from = { FEAT_VMX_PROCBASED_CTLS,  VMX_CPU_BASED_ACTIVATE_SECONDARY_CONTROLS },

WARNING: line over 80 characters
#245: FILE: target/i386/cpu.c:1470:
+        .to = { FEAT_VMX_SECONDARY_CTLS,    VMX_SECONDARY_EXEC_UNRESTRICTED_GUEST },

WARNING: Block comments use a leading /* on a separate line
#366: FILE: target/i386/kvm.c:2462:
+    /* If a feature bit is set, the control can be either set or clear.

WARNING: line over 80 characters
#421: FILE: target/i386/kvm.c:2517:
+            (f[FEAT_VMX_SECONDARY_CTLS] & VMX_SECONDARY_EXEC_ENABLE_EPT ? 0x4100ull : 0);

WARNING: line over 80 characters
#432: FILE: target/i386/kvm.c:2528:
+                                         f[FEAT_VMX_EXIT_CTLS]) | fixed_vmx_exit);

total: 2 errors, 11 warnings, 442 lines checked

Patch 6/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

7/7 Checking commit 728ad0189d83 (target/i386: work around KVM_GET_MSRS bug for secondary execution controls)
WARNING: line over 80 characters
#26: FILE: target/i386/kvm.c:482:
+        if (kvm_arch_get_supported_cpuid(s, 0xD, 1, R_ECX) & CPUID_XSAVE_XSAVES) {

WARNING: line over 80 characters
#32: FILE: target/i386/kvm.c:488:
+        if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & CPUID_7_0_EBX_INVPCID) {

WARNING: line over 80 characters
#35: FILE: target/i386/kvm.c:491:
+        if (kvm_arch_get_supported_cpuid(s, 7, 0, R_EBX) & CPUID_7_0_EBX_RDSEED) {

WARNING: line over 80 characters
#38: FILE: target/i386/kvm.c:494:
+        if (kvm_arch_get_supported_cpuid(s, 0x80000001, 0, R_EDX) & CPUID_EXT2_RDTSCP) {

total: 0 errors, 4 warnings, 23 lines checked

Patch 7/7 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/1568716480-9973-1-git-send-email-pbonzini@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com