From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric B Munson Subject: Re: [PATCH V3] Guest stop notification Date: Fri, 2 Dec 2011 16:27:27 -0500 Message-ID: <20111202212726.GA5662@mgebm.net> References: <1322853560-24152-1-git-send-email-emunson@mgebm.net> <4ED9331B.9060708@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3V7upXqbjpZ4EhLz" Cc: "qemu-devel@nongnu.org" , Avi Kivity , Marcelo Tosatti , "ryanh@linux.vnet.ibm.com" , "aliguori@us.ibm.com" , "kvm@vger.kernel.org" To: Jan Kiszka Return-path: Received: from oz.csail.mit.edu ([128.30.30.239]:54354 "EHLO mail.mgebm.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584Ab1LBV13 (ORCPT ); Fri, 2 Dec 2011 16:27:29 -0500 Content-Disposition: inline In-Reply-To: <4ED9331B.9060708@web.de> Sender: kvm-owner@vger.kernel.org List-ID: --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, 02 Dec 2011, Jan Kiszka wrote: > On 2011-12-02 20:19, Eric B Munson wrote: > > Often when a guest is stopped from the qemu console, it will report spu= rious > > soft lockup warnings on resume. There are kernel patches being discuss= ed that > > will give the host the ability to tell the guest that it is being stopp= ed and > > should ignore the soft lockup warning that generates. > >=20 > > Signed-off-by: Eric B Munson > > Cc: Avi Kivity > > Cc: Marcelo Tosatti > > Cc: Jan Kiszka > > Cc: ryanh@linux.vnet.ibm.com > > Cc: aliguori@us.ibm.com > > Cc: kvm@vger.kernel.org > >=20 > > --- > > Changes from V2: > > Move ioctl into hw/kvmclock.c so as other arches can use it as it is > > implemented > >=20 > > Changes from V1: > > Remove unnecessary encapsulating function > >=20 > > hw/kvmclock.c | 24 ++++++++++++++++++++++++ > > 1 files changed, 24 insertions(+), 0 deletions(-) > >=20 > > diff --git a/hw/kvmclock.c b/hw/kvmclock.c > > index 5388bc4..756839f 100644 > > --- a/hw/kvmclock.c > > +++ b/hw/kvmclock.c > > @@ -16,6 +16,7 @@ > > #include "sysbus.h" > > #include "kvm.h" > > #include "kvmclock.h" > > +#include "cpu-all.h" > > =20 > > #include > > #include > > @@ -69,11 +70,34 @@ static void kvmclock_vm_state_change(void *opaque, = int running, > > } > > } > > =20 > > +static void kvmclock_vm_state_change_vcpu(void *opaque, int running, > > + RunState state) > > +{ > > + int ret; > > + CPUState *penv =3D first_cpu; > > + > > + if (running) { > > + while (penv) { >=20 > or: for (cpu =3D first_cpu; cpu !=3D NULL; cpu =3D cpu->next_cpu) { >=20 Functionally equivalent and I see both in the code, is there a standard? > > + ret =3D kvm_vcpu_ioctl(penv, KVM_GUEST_PAUSED, 0); > > + if (ret) { > > + if (ret !=3D ENOSYS) { > > + fprintf(stderr, > > + "kvmclock_vm_state_change_vcpu: %s\n", > > + strerror(-ret)); > > + } > > + return; > > + } > > + penv =3D (CPUState *)penv->next_cpu; >=20 > Unneeded cast. >=20 Also following an example seen elsewhere. > > + } > > + } > > +} > > + >=20 > Again: please use checkpatch.pl. >=20 Sorry, tough to get used to hitting space bar that many times... > > static int kvmclock_init(SysBusDevice *dev) > > { > > KVMClockState *s =3D FROM_SYSBUS(KVMClockState, dev); > > =20 > > qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s); > > + qemu_add_vm_change_state_handler(kvmclock_vm_state_change_vcpu, NU= LL); > > return 0; > > } > > =20 >=20 > Why not extend the existing handler? Because the new handler doesn't touch the KVMClockState object. If this is preferred, I have no objection. >=20 > I still wonder if the IOCTL interface is actually kvmclock specific. But > Marcello asked for this, and we could still change it when some arch > comes around that provides it independent of kvmclock. The flag itself is stored in the pvclock_vcpu_time_info structure, and anyt= hing else that touches that structure uses ioctls. >=20 > Jan >=20 --3V7upXqbjpZ4EhLz Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBAgAGBQJO2UK+AAoJEKhG9nGc1bpJlH0P/jIBftnTGieMlCC293ZZbfbR 1Tj3UeDOnKhd/LRV/3YyJx0NiwXtGqkHis1y2K8RmvvsWtXyPdD5+X0ZlbK6fK0/ /5xuxEvgza7w3xmufhPpfkE7ZIMnlZJYRWv0HnQMDlR2FsQ13XWLl8mTo+xXQxU0 XCl/2uSmSJzIj8xyi6Mt7l4R+7CA2JZtsmQxhUhQ4yT2zB1CUioB4DskEH6Goh98 ovnoTzYKIqd0NgefnIzRlNLWBrGl6G7At2gCf6ravqILX+K+GPHQ5w+UWXtLVBup UdI88OAHeX/1FWAAbyh9dcb8Iq3eidWGM/t7+N3hYYL3qkCDo+nT9kxYKnSO6QpG pMoFxie/P0fzcd8MBR5R5uNu38izD5ZMZEFIcZpaj1RCFGmmmi41A+lTLOIqXucI 1JnS92v7GHxrI0H2Em/z+tUBL0QoUrtEZeybDG977xoE5aClWpGQhgbyZ+BmQfFh MHZlKUrhZ9IzJ2zBr6ZPjz8ab4W80LD2GTRH1QRDfUHj9kdN86TJY45Frzfu+ZYY BKTqgArN7f7WVNuqCn4KIkaqF493vUKmrFKm3u/WS6TBKCWpJ3wIhiZkJ7vpzjha 9rJu7xeCIDpYhLHJbn4sDd1hjZxDq8vG/TVtFg3Lz5UG/RH8lduwLwJLz0uf/dHw 5sVex3yVe5fxVHMTK5Ap =X3EM -----END PGP SIGNATURE----- --3V7upXqbjpZ4EhLz--