From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 1/1] kvmclock: fix guest stop notification Date: Sun, 30 Sep 2012 20:05:16 -0300 Message-ID: <20120930230516.GA3923@amt.cnet> References: <20120920124641.GA15092@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: qemu list , kvm list , Eric B Munson , Raghavendra K T , Andreas =?iso-8859-1?Q?F=E4rber?= , Paolo Bonzini , Laszlo Ersek To: Amit Shah Return-path: Received: from mx1.redhat.com ([209.132.183.28]:47406 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751794Ab2I3XFe (ORCPT ); Sun, 30 Sep 2012 19:05:34 -0400 Content-Disposition: inline In-Reply-To: <20120920124641.GA15092@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Sep 20, 2012 at 09:46:41AM -0300, Marcelo Tosatti wrote: > On Thu, Sep 20, 2012 at 01:55:20PM +0530, Amit Shah wrote: > > Commit f349c12c0434e29c79ecde89029320c4002f7253 added the guest sto= p > > notification, but it did it in a way that the stop notification wou= ld > > never reach the kernel. The kvm_vm_state_changed() function gets a > > value of 0 for the 'running' parameter when the VM is stopped, maki= ng > > all the code added previously dead code. > >=20 > > This patch reworks the code so that it's called when 'running' is 0= , > > which indicates the VM was stopped. > >=20 > > CC: Eric B Munson > > CC: Raghavendra K T > > CC: Andreas F=E4rber > > CC: Marcelo Tosatti > > CC: Paolo Bonzini > > CC: Laszlo Ersek > > Signed-off-by: Amit Shah > > --- > > hw/kvm/clock.c | 21 +++++++++++---------- > > 1 files changed, 11 insertions(+), 10 deletions(-) > >=20 > > diff --git a/hw/kvm/clock.c b/hw/kvm/clock.c > > index 824b978..f3427eb 100644 > > --- a/hw/kvm/clock.c > > +++ b/hw/kvm/clock.c > > @@ -71,18 +71,19 @@ static void kvmclock_vm_state_change(void *opaq= ue, int running, > > =20 > > if (running) { > > s->clock_valid =3D false; > > + return; > > + } > > =20 > > - if (!cap_clock_ctrl) { > > - return; > > - } > > - for (penv =3D first_cpu; penv !=3D NULL; penv =3D penv->ne= xt_cpu) { > > - ret =3D kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0); > > - if (ret) { > > - if (ret !=3D -EINVAL) { > > - fprintf(stderr, "%s: %s\n", __func__, strerror= (-ret)); > > - } > > - return; > > + if (!cap_clock_ctrl) { > > + return; > > + } > > + for (penv =3D first_cpu; penv !=3D NULL; penv =3D penv->next_c= pu) { > > + ret =3D kvm_vcpu_ioctl(penv, KVM_KVMCLOCK_CTRL, 0); > > + if (ret) { > > + if (ret !=3D -EINVAL) { > > + fprintf(stderr, "%s: %s\n", __func__, strerror(-re= t)); > > } > > + return; > > } > > } > > } > > --=20 > > 1.7.7.6 >=20 > ACK >=20 > Avi, please merge through uq/master. NACK, guest should be notified when the VM is starting, not when stopping.