From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwilC-0001MA-Ks for qemu-devel@nongnu.org; Tue, 09 Jul 2013 21:00:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwilB-0007V4-MC for qemu-devel@nongnu.org; Tue, 09 Jul 2013 20:59:58 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36502 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwilB-0007Uy-Cn for qemu-devel@nongnu.org; Tue, 09 Jul 2013 20:59:57 -0400 Message-ID: <51DCB207.6040701@suse.de> Date: Wed, 10 Jul 2013 02:59:51 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1373384866-36233-1-git-send-email-dingel@linux.vnet.ibm.com> <1373384866-36233-2-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1373384866-36233-2-git-send-email-dingel@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Enable async page faults List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Dominik Dingel Cc: Cornelia Huck , Christian Borntraeger , Richard Henderson , qemu-devel@nongnu.org, Alexander Graf Am 09.07.2013 17:47, schrieb Dominik Dingel: > S390 can also use async page faults, to enhance guest scheduling. > But in the case of live migration we want to disable the feature and kn= ow > if there are still notifications in flight. >=20 > Signed-off-by: Dominik Dingel > --- > target-s390x/kvm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) >=20 > diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c > index 42f758f..61df7d4 100644 > --- a/target-s390x/kvm.c > +++ b/target-s390x/kvm.c > @@ -36,6 +36,7 @@ > #include "sysemu/device_tree.h" > #include "qapi/qmp/qjson.h" > #include "monitor/monitor.h" > +#include "migration/migration.h" > =20 > /* #define DEBUG_KVM */ > =20 > @@ -92,9 +93,50 @@ const KVMCapabilityInfo kvm_arch_required_capabiliti= es[] =3D { > =20 > static int cap_sync_regs; > =20 > +static int apf_disable(QEMUFile *f, void *opaque) > +{ > + kvm_vm_ioctl(opaque, KVM_S390_APF_DISABLE); Better don't pass opaques directly as a typed argument, especially in a KVM file not widely tested; we just had such a runtime breakage. KVMState *s =3D opaque; elegantly avoids it here and improves readability= . Regards, Andreas > + return 0; > +} > + > +static void apf_enable(void *opaque) > +{ > + kvm_vm_ioctl(opaque, KVM_S390_APF_ENABLE); > +} > + > +static int apf_finish(QEMUFile *f, void *opaque, int version_id) > +{ > + apf_enable(opaque); > + return 0; > +} > + > +static uint64_t apf_status(QEMUFile *f, void *opaque, uint64_t max_siz= e) > +{ > + uint64_t rc =3D 0; > + > + if (kvm_vm_ioctl(opaque, KVM_S390_APF_STATUS) !=3D > + KVM_S390_APF_DISABLED_NON_PENDING) { > + rc =3D 0xff0000; > + } > + return rc; > +} > + > +SaveVMHandlers savevm_apf_handlers =3D { > + .save_live_setup =3D apf_disable, > + .save_live_iterate =3D NULL, > + .save_live_complete =3D NULL, > + .save_live_pending =3D apf_status, > + .load_state =3D apf_finish, > + .cancel =3D apf_enable, > +}; > + > int kvm_arch_init(KVMState *s) > { > cap_sync_regs =3D kvm_check_extension(s, KVM_CAP_SYNC_REGS); > + if (kvm_check_extension(s, KVM_CAP_ASYNC_PF)) { > + register_savevm_live(NULL, "apf", -1, 1, &savevm_apf_handlers,= s); > + kvm_vm_ioctl(s, KVM_S390_APF_ENABLE); > + } > return 0; > } > =20 >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg