From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwaIr-0005fp-Dm for qemu-devel@nongnu.org; Tue, 09 Jul 2013 11:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UwaIn-0005Cf-Id for qemu-devel@nongnu.org; Tue, 09 Jul 2013 11:58:09 -0400 Received: from e06smtp11.uk.ibm.com ([195.75.94.107]:34433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UwaIn-0005CO-AS for qemu-devel@nongnu.org; Tue, 09 Jul 2013 11:58:05 -0400 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 9 Jul 2013 16:42:14 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 7157B2190019 for ; Tue, 9 Jul 2013 16:51:40 +0100 (BST) Received: from d06av08.portsmouth.uk.ibm.com (d06av08.portsmouth.uk.ibm.com [9.149.37.249]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r69FlbDp48300058 for ; Tue, 9 Jul 2013 15:47:37 GMT Received: from d06av08.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av08.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r69Flmdh008914 for ; Tue, 9 Jul 2013 09:47:48 -0600 From: Dominik Dingel Date: Tue, 9 Jul 2013 17:47:46 +0200 Message-Id: <1373384866-36233-2-git-send-email-dingel@linux.vnet.ibm.com> In-Reply-To: <1373384866-36233-1-git-send-email-dingel@linux.vnet.ibm.com> References: <1373384866-36233-1-git-send-email-dingel@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] Enable async page faults List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Cornelia Huck , Christian Borntraeger , Alexander Graf , Dominik Dingel , Richard Henderson 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 know if there are still notifications in flight. Signed-off-by: Dominik Dingel --- target-s390x/kvm.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) 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" /* #define DEBUG_KVM */ @@ -92,9 +93,50 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = { static int cap_sync_regs; +static int apf_disable(QEMUFile *f, void *opaque) +{ + kvm_vm_ioctl(opaque, KVM_S390_APF_DISABLE); + 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_size) +{ + uint64_t rc = 0; + + if (kvm_vm_ioctl(opaque, KVM_S390_APF_STATUS) != + KVM_S390_APF_DISABLED_NON_PENDING) { + rc = 0xff0000; + } + return rc; +} + +SaveVMHandlers savevm_apf_handlers = { + .save_live_setup = apf_disable, + .save_live_iterate = NULL, + .save_live_complete = NULL, + .save_live_pending = apf_status, + .load_state = apf_finish, + .cancel = apf_enable, +}; + int kvm_arch_init(KVMState *s) { cap_sync_regs = 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; } -- 1.8.2.2