* [PATCH 0/1] Fix guest kernel crash when hitting AMD errata @ 2010-09-01 9:42 Jes.Sorensen 2010-09-01 9:42 ` [PATCH 1/1] " Jes.Sorensen 2010-09-02 8:24 ` [PATCH 0/1] " Avi Kivity 0 siblings, 2 replies; 3+ messages in thread From: Jes.Sorensen @ 2010-09-01 9:42 UTC (permalink / raw) To: kvm; +Cc: avi From: Jes Sorensen <Jes.Sorensen@redhat.com> This fix gets around the case where a user specifies a CPU model triggering an old Opteron errata. The patch returns the clock timing the errata expects to see and ignores writes to make sure a guest doesn't get an exception from reading or writing an MSR that is not supported, since the kernel doesn't use safe MSR access for this errata workaround. Jes Sorensen (1): Fix guest kernel crash when hitting AMD errata arch/x86/kvm/x86.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) -- 1.7.2.2 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] Fix guest kernel crash when hitting AMD errata 2010-09-01 9:42 [PATCH 0/1] Fix guest kernel crash when hitting AMD errata Jes.Sorensen @ 2010-09-01 9:42 ` Jes.Sorensen 2010-09-02 8:24 ` [PATCH 0/1] " Avi Kivity 1 sibling, 0 replies; 3+ messages in thread From: Jes.Sorensen @ 2010-09-01 9:42 UTC (permalink / raw) To: kvm; +Cc: avi From: Jes Sorensen <Jes.Sorensen@redhat.com> MSR_K7_CLK_CTL is a no longer documented MSR, which is only relevant on said old AMD CPU models. This change returns the expected value, which the Linux kernel is expecting to avoid writing back the MSR, plus it ignores all writes to the MSR. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> --- arch/x86/kvm/x86.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 4014d6c..1810a80 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1439,6 +1439,16 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) pr_unimpl(vcpu, "unimplemented perfctr wrmsr: " "0x%x data 0x%llx\n", msr, data); break; + case MSR_K7_CLK_CTL: + /* + * Ignore all writes to this no longer documented MSR. + * Writes are only relevant for old K7 processors, + * all pre-dating SVM, but a recommended workaround from + * AMD for these chips. It is possible to speicify the + * affected processor models on the command line, hence + * the need to ignore the workaround. + */ + break; case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: if (kvm_hv_msr_partition_wide(msr)) { int r; @@ -1664,6 +1674,18 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata) case MSR_IA32_MCG_STATUS: case MSR_IA32_MC0_CTL ... MSR_IA32_MC0_CTL + 4 * KVM_MAX_MCE_BANKS - 1: return get_msr_mce(vcpu, msr, pdata); + case MSR_K7_CLK_CTL: + /* + * Provide expected ramp-up count for K7. All other + * are set to zero, indicating minimum divisors for + * every field. + * + * This prevents guest kernels on AMD host with CPU + * type 6, model 8 and higher from exploding due to + * the rdmsr failing. + */ + data = 0x20000000; + break; case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: if (kvm_hv_msr_partition_wide(msr)) { int r; -- 1.7.2.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] Fix guest kernel crash when hitting AMD errata 2010-09-01 9:42 [PATCH 0/1] Fix guest kernel crash when hitting AMD errata Jes.Sorensen 2010-09-01 9:42 ` [PATCH 1/1] " Jes.Sorensen @ 2010-09-02 8:24 ` Avi Kivity 1 sibling, 0 replies; 3+ messages in thread From: Avi Kivity @ 2010-09-02 8:24 UTC (permalink / raw) To: Jes.Sorensen; +Cc: kvm On 09/01/2010 12:42 PM, Jes.Sorensen@redhat.com wrote: > From: Jes Sorensen<Jes.Sorensen@redhat.com> > > This fix gets around the case where a user specifies a CPU model > triggering an old Opteron errata. The patch returns the clock timing > the errata expects to see and ignores writes to make sure a guest > doesn't get an exception from reading or writing an MSR that is not > supported, since the kernel doesn't use safe MSR access for this > errata workaround. > Applied, thanks. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-02 8:24 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-01 9:42 [PATCH 0/1] Fix guest kernel crash when hitting AMD errata Jes.Sorensen 2010-09-01 9:42 ` [PATCH 1/1] " Jes.Sorensen 2010-09-02 8:24 ` [PATCH 0/1] " Avi Kivity
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.