From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] kvm: fix hyperv tsc page clear wrong address Date: Thu, 19 Jun 2014 13:22:33 +0200 Message-ID: <53A2C7F9.8070700@redhat.com> References: <53A2BB7B.8070507@gmail.com> <53A2BC1A.4050702@gmail.com> <53A2C6B0.3090200@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=gb18030; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: =?gb18030?Q?=22newtongao=28=B8=DF=D0=A1=C3=F7=29=22?= , gleb@kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Return-path: In-Reply-To: <53A2C6B0.3090200@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Il 19/06/2014 13:17, "newtongao(=B8=DF=D0=A1=C3=F7)" ha scritto: > This is more concisely > > From 6ddeb18347f9dda0fe37702e0d067a4129a89b54 Mon Sep 17 00:00:00 200= 1 > From: Xiaoming Gao > Date: Thu, 19 Jun 2014 19:14:57 +0800 > Subject: [PATCH] kvm: fix hyperv tsc page clear wrong address > > tsc page addr need clear the low HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHI= =46T bits > before kvm_write_guest write the zero tsc_ref structure to guest, or = it will lead > guest to get wrong clocksource. > > windows guest will get strong impact, QueryPerformanceCounter will al= ways return 0 > ,all things in windows rely on clock source, will in serious chaos. Right, this can happen if Windows passes a non-zero page to KVM. Thanks, Paolo > Signed-off-by: Xiaoming Gao > --- > arch/x86/kvm/x86.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index f32a025..f644933 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1898,7 +1898,7 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *v= cpu, u32 msr, u64 data) > if (!(data & HV_X64_MSR_TSC_REFERENCE_ENABLE)) > break; > gfn =3D data >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT; > - if (kvm_write_guest(kvm, data, > + if (kvm_write_guest(kvm, gfn << HV_X64_MSR_TSC_REFERENCE_ADDRESS_S= HIFT, > &tsc_ref, sizeof(tsc_ref))) > return 1; > mark_page_dirty(kvm, gfn); >