Re: PATCH: setup_vmcs_config: disable TSC scaling on unlike processors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 December 2016 at 10:43, Radim Krčmář <rkrcmar@xxxxxxxxxx> wrote:
> 2016-12-09 10:12-0500, Don Bowman:
>> OK, based on previous feedback, this patch version simply ignores any
>> inconsistency if a knowing and trusting user wishes.
>>
>> In my case, two identical processors in stepping and version and all
>> others have 1 flag missing (retail vs tray version of chip), but the
>> next person might have another flag.
>>
>> Comments?
 ...

> Please add a note in the spirit of: "KVM is going to fail unless you
> explicitly disable features that are not present on all CPUs."
>
> If this becomes a normal feature, we'd remove the toggle, check that all
> enabled features are supported, and pass if KVM will work with selected
> features ... the check seems like a waste of code for this rarity of
> machines.
>

OK, how about this?
As a side note, i'm still not clear on why this happens. cpuid cannot
tell the difference between these processors (same model hex-id,
stepping, extended family, extended model). The only difference is one
was an OEM 'tray' and one was the retail (to upgrade the single-socket
machine to dual socket).

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 5382b82..84733b3 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -103,6 +103,14 @@ module_param_named(enable_shadow_vmcs,
enable_shadow_vmcs, bool, S_IRUGO);
 static bool __read_mostly nested = 0;
 module_param(nested, bool, S_IRUGO);

+/*
+ * Override the 'all cpu have identical flag' check.
+ * Note: KVM is going to fail unless you explicitly disable
+ * features that are not present on all CPUs
+*/
+static bool __read_mostly ignore_inconsistency = false;
+module_param(ignore_inconsistency, bool, S_IRUGO);
+
 static u64 __read_mostly host_xss;

 static bool __read_mostly enable_pml = 1;
@@ -9202,9 +9210,11 @@ static void __init vmx_check_processor_compat(void *rtn)
        if (setup_vmcs_config(&vmcs_conf) < 0)
                *(int *)rtn = -EIO;
        if (memcmp(&vmcs_config, &vmcs_conf, sizeof(struct vmcs_config)) != 0) {
-               printk(KERN_ERR "kvm: CPU %d feature inconsistency!\n",
-                               smp_processor_id());
-               *(int *)rtn = -EIO;
+               printk(KERN_ERR "kvm: CPU %d feature inconsistency%s!\n",
+                               smp_processor_id(),
+                               ignore_inconsistency ? " -- ignored" : "");
+               if (!ignore_inconsistency)
+                       *(int *)rtn = -EIO;
        }
 }
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux