From nobody Mon Feb 9 21:37:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1568913512; cv=none; d=zoho.com; s=zohoarc; b=B8Sflny2b2GZ0hMa3lGPmfwmDXHuriWY4zcn4KRhXCstlAc0gsvKSb0TH9Kl9YYPxiF3wyyjeEsIsM16ntM5k0AWjSZEWuCVwVhFWD3zIUjIyGZPCdk9vsFEjcd2WzO01luoGFuLcTskwNg3JxBT5DV1MFq/kDHGmb1+UWt625Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568913512; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9OGSSZJ4+D0TqOzQbAesB+q1w0flX0OG6YzSKYsLXn0=; b=DFD3FQS2ED9kyp5CQ53sgfB8CRA3Ho/iQzsSvBqtw3yfdtMTseM8fRmF1AwJ9HhQlh3QnN7YXjgadzB/MmTDdQNE8GMtasQXb9bydGyL0JrNaKABLlatmBQZ3QC/DudiwV45q7VWLhiXvMeCmSaiFi0exQdj6MPM+Rt/10sz7GY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1568913512060596.5797160288548; Thu, 19 Sep 2019 10:18:32 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iB03g-00017F-UM; Thu, 19 Sep 2019 17:17:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iB03f-00015f-9i for xen-devel@lists.xenproject.org; Thu, 19 Sep 2019 17:17:31 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 572994f0-db01-11e9-978d-bc764e2007e4; Thu, 19 Sep 2019 17:17:21 +0000 (UTC) X-Inumbo-ID: 572994f0-db01-11e9-978d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568913442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=49q/dBETBhu36aRlJejkevM+6DNxYO1BQnfYZjp8rME=; b=XaOIn2ctASluuVHqct0a7NYG4H/B6moCrU61oLt0ZhTyKsvV/wx939yp bvEXIaJ7iCxzO+Olv2VP9asHeP5co9WHdjX7Zn4RF0ur8z6nwKTUBO0pK gHs26h7l+hWfz28G5d9fOmP/GLUK2olYh7SbBshycf43xA0VigXQ4jwD2 w=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa2.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa2.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: G61ptleMwO4YNTmYQ6qYIgLlpS7T/2tSNsl4q9pnloDcH5KuBXxKTb4RWEqS6lQTtrFUW0N0kn cAtWAM7aA+iLOJGD8A2FZoYVxF18bZ+KNk7bfPXbpeFUCN/f3Jm/CPewlgCQIg8OmN3/O0WyiG kWlWe415qOno8Q16GUPFJbQAcg1/ebDUoVexOWW9LkMSdiBcba4hAWKyVoD95q6Nn/+l9zLzUC 8Szu3kbGKhdLUhJo9kTP6xF05vsTq3uh0Sn+zmzDZfeSOtIIOK3qwNcAG2D5ft33BpMui1l19d JJs= X-SBRS: 2.7 X-MesageID: 5800426 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,524,1559534400"; d="scan'208";a="5800426" From: Anthony PERARD To: Date: Thu, 19 Sep 2019 18:16:26 +0100 Message-ID: <20190919171656.899649-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919171656.899649-1-anthony.perard@citrix.com> References: <20190919171656.899649-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 06/35] libxl: Use ev_qmp for switch_qemu_xen_logdirty X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Anthony PERARD Acked-by: Ian Jackson --- tools/libxl/libxl_dom_save.c | 41 ++++++++++++++++++++++++++++++++---- tools/libxl/libxl_internal.h | 3 +-- tools/libxl/libxl_qmp.c | 10 --------- 3 files changed, 38 insertions(+), 16 deletions(-) diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c index 13d08d6dae14..e70aa1585976 100644 --- a/tools/libxl/libxl_dom_save.c +++ b/tools/libxl/libxl_dom_save.c @@ -44,6 +44,10 @@ static void switch_logdirty_xswatch(libxl__egc *egc, lib= xl__ev_xswatch*, static void domain_suspend_switch_qemu_xen_logdirty (libxl__egc *egc, int domid, unsigned enabl= e, libxl__logdirty_switch *lds); +static void switch_qemu_xen_logdirty_done(libxl__egc *egc, + libxl__ev_qmp *qmp, + const libxl__json_object *, + int rc); static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev, const struct timeval *requested_abs, int rc); @@ -55,6 +59,7 @@ void libxl__logdirty_init(libxl__logdirty_switch *lds) lds->cmd_path =3D 0; libxl__ev_xswatch_init(&lds->watch); libxl__ev_time_init(&lds->timeout); + libxl__ev_qmp_init(&lds->qmp); } =20 void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc, @@ -207,13 +212,40 @@ static void domain_suspend_switch_qemu_xen_logdirty { STATE_AO_GC(lds->ao); int rc; + libxl__json_object *args =3D NULL; + + /* Convenience aliases. */ + libxl__ev_qmp *const qmp =3D &lds->qmp; + + rc =3D libxl__ev_time_register_rel(ao, &lds->timeout, + switch_logdirty_timeout, 10 * 1000); + if (rc) goto out; + + qmp->ao =3D ao; + qmp->domid =3D domid; + qmp->payload_fd =3D -1; + qmp->callback =3D switch_qemu_xen_logdirty_done; + libxl__qmp_param_add_bool(gc, &args, "enable", enable); + rc =3D libxl__ev_qmp_send(gc, qmp, "xen-set-global-dirty-log", args); + if (rc) goto out; + + return; +out: + switch_qemu_xen_logdirty_done(egc, qmp, NULL, rc); +} + +static void switch_qemu_xen_logdirty_done(libxl__egc *egc, + libxl__ev_qmp *qmp, + const libxl__json_object *r, + int rc) +{ + EGC_GC; + libxl__logdirty_switch *lds =3D CONTAINER_OF(qmp, *lds, qmp); =20 - rc =3D libxl__qmp_set_global_dirty_log(gc, domid, enable); if (rc) - LOGD(ERROR, domid, + LOGD(ERROR, qmp->domid, "logdirty switch failed (rc=3D%d), abandoning suspend",rc); - - lds->callback(egc, lds, rc); + switch_logdirty_done(egc, lds, rc); } =20 static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev, @@ -234,6 +266,7 @@ static void switch_logdirty_done(libxl__egc *egc, =20 libxl__ev_xswatch_deregister(gc, &lds->watch); libxl__ev_time_deregister(gc, &lds->timeout); + libxl__ev_qmp_dispose(gc, &lds->qmp); =20 lds->callback(egc, lds, rc); } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 7486b512fd54..c4834ac9c6c5 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1958,8 +1958,6 @@ _hidden int libxl__qmp_system_wakeup(libxl__gc *gc, i= nt domid); _hidden int libxl__qmp_resume(libxl__gc *gc, int domid); /* Load current QEMU state from file. */ _hidden int libxl__qmp_restore(libxl__gc *gc, int domid, const char *filen= ame); -/* Set dirty bitmap logging status */ -_hidden int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool= enable); /* Add a virtual CPU */ _hidden int libxl__qmp_cpu_add(libxl__gc *gc, int domid, int index); /* Query the bitmap of CPUs */ @@ -3413,6 +3411,7 @@ typedef struct libxl__logdirty_switch { const char *ret_path; libxl__ev_xswatch watch; libxl__ev_time timeout; + libxl__ev_qmp qmp; } libxl__logdirty_switch; =20 _hidden void libxl__logdirty_init(libxl__logdirty_switch *lds); diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index 505e0e5469a9..f1529925ee0e 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -1108,16 +1108,6 @@ int libxl__qmp_resume(libxl__gc *gc, int domid) return qmp_run_command(gc, domid, "cont", NULL, NULL, NULL); } =20 -int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable) -{ - libxl__json_object *args =3D NULL; - - libxl__qmp_param_add_bool(gc, &args, "enable", enable); - - return qmp_run_command(gc, domid, "xen-set-global-dirty-log", args, - NULL, NULL); -} - int libxl__qmp_cpu_add(libxl__gc *gc, int domid, int idx) { libxl__json_object *args =3D NULL; --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel