Skip to contentSkip to conversation

target/i386: kvm: print info when the kernel doesn't support ioctl(KVM_CAP_GET_MSR_FEATURES)

PATCH In review Li Qiang 3 participants 3 messages Jan 3, 2020 – Jan 7, 2020

lore
Share & tools
lore

Li Qiang

author
#0 lore raw

PATCH 1/1 target/i386: kvm: print info when the kernel doesn't support ioctl(KVM_CAP_GET_MSR_FEATURES)

The ioctl(KVM_CAP_GET_MSR_FEATURES) is quite new. In old platform that doesn't support this ioctl will sometimes make the user confusion. For example, when we do nested virtualiztion using host-passthrough model the VM will has quite different cpu feature with the host.

---
 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
target/i386/kvm.c +2 -0
index 0b511906e3..9688f7a167 100644
@@ -1916,6 +1916,8 @@ static int kvm_get_supported_feature_msrs(KVMState *s)
     }
 
     if (!kvm_check_extension(s, KVM_CAP_GET_MSR_FEATURES)) {
+        info_report("ioctl(KVM_CAP_GET_MSR_FEATURES) is "
+                    "not supported by this kernel.");
         return 0;
     }
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Li Qiang

The ioctl(KVM_CAP_GET_MSR_FEATURES) is quite new. In old platform that

Can you refer to the kernel version? "is quite new (introduced in vX.Y)"

Quoted 2 lines

doesn't support this ioctl will sometimes make the user confusion. For example, when we do nested virtualiztion using host-passthrough model

"virtualization"

Quoted 1 line

the VM will has quite different cpu feature with the host.

I'm not native English speaking but I'd use:
"... will have quite different features than the host"

Quoted 11 lines
---
  target/i386/kvm.c | 2 ++
  1 file changed, 2 insertions(+)
target/i386/kvm.c +0 -0
index 0b511906e3..9688f7a167 100644

target/i386/kvm.c static int kvm_get_supported_feature_msrs(KVMState *s) · line 1920

Quoted 5 lines
target/i386/kvm.c +2 -0
@@ -1916,6 +1916,8 @@ static int kvm_get_supported_feature_msrs(KVMState *s)
      }
 
      if (!kvm_check_extension(s, KVM_CAP_GET_MSR_FEATURES)) {
+        info_report("ioctl(KVM_CAP_GET_MSR_FEATURES) is "
+                    "not supported by this kernel.");

Please remove the trailing '.'

Quoted 4 lines
target/i386/kvm.c +0 -0
          return 0;
      }
 
#2 lore raw
In reply to Li Qiang
Quoted 15 lines · Li Qiang

The ioctl(KVM_CAP_GET_MSR_FEATURES) is quite new. In old platform that doesn't support this ioctl will sometimes make the user confusion. For example, when we do nested virtualiztion using host-passthrough model the VM will has quite different cpu feature with the host.

---
 target/i386/kvm.c | 2 ++
 1 file changed, 2 insertions(+)
target/i386/kvm.c +0 -0
index 0b511906e3..9688f7a167 100644

target/i386/kvm.c static int kvm_get_supported_feature_msrs(KVMState *s) · line 1922

Quoted 7 lines
target/i386/kvm.c +2 -0
@@ -1916,6 +1916,8 @@ static int kvm_get_supported_feature_msrs(KVMState *s)
     }
 
     if (!kvm_check_extension(s, KVM_CAP_GET_MSR_FEATURES)) {
+        info_report("ioctl(KVM_CAP_GET_MSR_FEATURES) is "
+                    "not supported by this kernel.");
         return 0;
     }

Does this matter with host-passthrough? As long as "-cpu host,+vmx" works with an old kernel, there's no reason to warn---and even then the warning should:

1) be restricted to the nested case;

2) be emitted even if MSR features are supported but VMX MSRs are not.

Paolo