From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM: x86: fix pvclock guest stopped flag reporting Date: Thu, 02 Aug 2012 18:42:25 +0300 Message-ID: <501A9FE1.8090209@redhat.com> References: <20120802153343.GA12119@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm , Amit Shah , Eric B Munson To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:57643 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752281Ab2HBPm3 (ORCPT ); Thu, 2 Aug 2012 11:42:29 -0400 In-Reply-To: <20120802153343.GA12119@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 08/02/2012 06:33 PM, Marcelo Tosatti wrote: > > kvm_guest_time_update unconditionally clears hv_clock.flags field, > so the notification never reaches the guest. > > Fix it by allowing PVCLOCK_GUEST_STOPPED to passthrough. > > Signed-off-by: Marcelo Tosatti > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 3a53bcc..e8ce10f 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1217,7 +1217,9 @@ static int kvm_guest_time_update(struct kvm_vcpu *v) > vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset; > vcpu->last_kernel_ns = kernel_ns; > vcpu->last_guest_tsc = tsc_timestamp; > - vcpu->hv_clock.flags = 0; > + /* only support PVCLOCK_GUEST_STOPPED flag ATM */ > + if (vcpu->hv_clock.flags != PVCLOCK_GUEST_STOPPED) > + vcpu->hv_clock.flags = 0; > Seems a little risky. Should we store the flag in a separate bool and mix it in instead of RMWing it? -- error compiling committee.c: too many arguments to function