Message ID | 52C716C1.6070704@gmail.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Il 03/01/2014 21:00, Dirk Brandewie ha scritto: > + case MSR_IA32_MPERF: > + case MSR_IA32_APERF: These should never be accessed. A KVM VM will always have CPUID[06H].ECX = 0, and the Intel manual says that the MSRs are only present if CPUID returns that value with bit 0 set. I think the actual bug is that intel_pstate_init does not check the feature bits in CPUID (either manually or via x86_match_cpu). Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 01/03/2014 02:06 PM, Paolo Bonzini wrote: > Il 03/01/2014 21:00, Dirk Brandewie ha scritto: >> + case MSR_IA32_MPERF: >> + case MSR_IA32_APERF: > OK I will spin the patch to only add MSR_PLATFORM_INFO. > These should never be accessed. A KVM VM will always have > CPUID[06H].ECX = 0, and the Intel manual says that the MSRs are only > present if CPUID returns that value with bit 0 set. > > I think the actual bug is that intel_pstate_init does not check the > feature bits in CPUID (either manually or via x86_match_cpu). I will add the feature check. What are the differences between the first and the nested KVM's? At load time intel_pstate checks that APERF and MPERF are incrementing and that PLATFORM_INFO has some value. Somehow these checks pass in the nested environment and we fall over when the CPU is being added by cpufreq. --Dirk -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Jan 06, 2014 at 09:18:44AM -0800, Dirk Brandewie wrote: > On 01/03/2014 02:06 PM, Paolo Bonzini wrote: > >Il 03/01/2014 21:00, Dirk Brandewie ha scritto: > >>+ case MSR_IA32_MPERF: > >>+ case MSR_IA32_APERF: > > > OK I will spin the patch to only add MSR_PLATFORM_INFO. > > >These should never be accessed. A KVM VM will always have > >CPUID[06H].ECX = 0, and the Intel manual says that the MSRs are only > >present if CPUID returns that value with bit 0 set. > > > >I think the actual bug is that intel_pstate_init does not check the > >feature bits in CPUID (either manually or via x86_match_cpu). > > I will add the feature check. > > What are the differences between the first and the nested KVM's? There shouldn't be any. There is a bug in nested emulation probably. > At load time intel_pstate checks that APERF and MPERF are incrementing > and that PLATFORM_INFO has some value. Somehow these checks pass > in the nested environment and we fall over when the CPU is being added > by cpufreq. > KVM does not emulate either of those and inject #GP if one is accessed. Linux catches those #GPs and fixs up rdmsr to return zero. It would be interesting to see ftrace for nested kvm run. -- Gleb. -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 5d004da..390ef27 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2336,6 +2336,9 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) switch (msr) { case MSR_IA32_PLATFORM_ID: + case MSR_IA32_MPERF: + case MSR_IA32_APERF: + case MSR_PLATFORM_INFO: case MSR_IA32_EBL_CR_POWERON: case MSR_IA32_DEBUGCTLMSR: