From nobody Mon Feb 9 04:59:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=1560511573; cv=none; d=zoho.com; s=zohoarc; b=iMOQ+lYnXWEdXTl3K1DusR/hjWav+ApzHrTP4kAfS2NiErPnnsH93VviUAJQ6f3yn0Eb7TxuHps77WMO/pIr+LQ8oT8s91VjksiDUDTQuEwR7y40WanEVfq9evOwzMeYNt54hb2JqrpAmF90ioJNY5V5KmjHGb4VgTDvj5WowTE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560511573; 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=ZmS0uADx6Jtqy+exz3TrN/70uqk+m36SGHUqP2UNsWQ=; b=gLHloYn+EMs0JK7QeRnMtgh2v7V8xAGGo+MHR7saxCr/hg7sH0hFsk5GMyE1gJglMv/nfJSlFkkFVvaobU/WlLWqOcotCebZ26ayZGJsuDqxH+TKN/JJg7fTjRtP5RTeXhqojXNKW8PJVBijYlP4wLYC16Uqvwo1RJMHgQ+BiCg= ARC-Authentication-Results: i=1; mx.zoho.com; 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 1560511573377486.40839504258406; Fri, 14 Jun 2019 04:26:13 -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 1hbkKJ-0007SF-8C; Fri, 14 Jun 2019 11:24:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hbkKI-0007Rt-1o for xen-devel@lists.xenproject.org; Fri, 14 Jun 2019 11:24:58 +0000 Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 086f0a68-8e97-11e9-ba81-ef5fc2f7992d; Fri, 14 Jun 2019 11:24:54 +0000 (UTC) X-Inumbo-ID: 086f0a68-8e97-11e9-ba81-ef5fc2f7992d 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: 3K2GOz8QXejbGs5VYriScINrlE4tZzII3iJj3LOX/Thwd6nS+ZBWlUvyN8B2BVc2wxFQxIulQi y0hNsTa11pGxmz7CQWbV6O3p04q08YNKPEUMvvnqxpU0R5IYBgQUmpcNPvUvuqbnhUPHDbtKa8 uDDYKF2ymV26+S8/0yy/H96xOegVHZtNwppKLVwkZ7BUoVh6S+zA4q1vkqS5ry6um7saqoSSde f2hk040X1PYnONmAwfxPZLRZNjRQ3PALxiBgF8uBIJwshKCXCdGE/djJznZ/SnwnLndD/h1SBt Hmg= X-SBRS: 2.7 X-MesageID: 1737469 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.63,373,1557201600"; d="scan'208";a="1737469" From: Anthony PERARD To: Date: Fri, 14 Jun 2019 12:24:35 +0100 Message-ID: <20190614112444.29980-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190614112444.29980-1-anthony.perard@citrix.com> References: <20190614112444.29980-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 06/15] libxl_dom_save: Reorder functions for switch_qemu_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" There are two differents set of callbacks here, one for libxl__domain_common_switch_qemu_logdirty, and one for libxl__domain_suspend_common_switch_qemu_logdirty. The first set calls the second. Pure code motion. Signed-off-by: Anthony PERARD Acked-by: Ian Jackson --- Notes: The check for PVH seems to be in the wrong function: It's in libxl__domain_suspend_common_switch_qemu_logdirty(), but it should probably be in: libxl__domain_common_switch_qemu_logdirty(). That second function is used by the remus/COLO stuff, but the first is only a callback of libxl__domain_save(). tools/libxl/libxl_dom_save.c | 168 +++++++++++++++++++---------------- 1 file changed, 89 insertions(+), 79 deletions(-) diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c index 2e9ec4dbf2..13d08d6dae 100644 --- a/tools/libxl/libxl_dom_save.c +++ b/tools/libxl/libxl_dom_save.c @@ -36,11 +36,17 @@ static void domain_save_done(libxl__egc *egc, * xenstore_process_logdirty_event */ =20 +static void domain_suspend_switch_qemu_xen_traditional_logdirty + (libxl__egc *egc, int domid, unsigned enabl= e, + libxl__logdirty_switch *lds); +static void switch_logdirty_xswatch(libxl__egc *egc, libxl__ev_xswatch*, + const char *watch_path, const char *event_path= ); +static void domain_suspend_switch_qemu_xen_logdirty + (libxl__egc *egc, int domid, unsigned enabl= e, + libxl__logdirty_switch *lds); static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev, const struct timeval *requested_abs, int rc); -static void switch_logdirty_xswatch(libxl__egc *egc, libxl__ev_xswatch*, - const char *watch_path, const char *event_path= ); static void switch_logdirty_done(libxl__egc *egc, libxl__logdirty_switch *lds, int rc); =20 @@ -51,6 +57,27 @@ void libxl__logdirty_init(libxl__logdirty_switch *lds) libxl__ev_time_init(&lds->timeout); } =20 +void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc, + int domid, unsigned enable, + libxl__logdirty_switch *lds) +{ + STATE_AO_GC(lds->ao); + + switch (libxl__device_model_version_running(gc, domid)) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + domain_suspend_switch_qemu_xen_traditional_logdirty(egc, domid, en= able, + lds); + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + domain_suspend_switch_qemu_xen_logdirty(egc, domid, enable, lds); + break; + default: + LOGD(ERROR, domid, "logdirty switch failed" + ", no valid device model version found, abandoning suspend"); + lds->callback(egc, lds, ERROR_FAIL); + } +} + static void domain_suspend_switch_qemu_xen_traditional_logdirty (libxl__egc *egc, int domid, unsigned enabl= e, libxl__logdirty_switch *lds) @@ -120,83 +147,6 @@ static void domain_suspend_switch_qemu_xen_traditional= _logdirty switch_logdirty_done(egc,lds,rc); } =20 -static void domain_suspend_switch_qemu_xen_logdirty - (libxl__egc *egc, int domid, unsigned enabl= e, - libxl__logdirty_switch *lds) -{ - STATE_AO_GC(lds->ao); - int rc; - - rc =3D libxl__qmp_set_global_dirty_log(gc, domid, enable); - if (rc) - LOGD(ERROR, domid, - "logdirty switch failed (rc=3D%d), abandoning suspend",rc); - - lds->callback(egc, lds, rc); -} - -static void domain_suspend_switch_qemu_logdirty_done - (libxl__egc *egc, libxl__logdirty_switch *lds, int= rc) -{ - libxl__domain_save_state *dss =3D CONTAINER_OF(lds, *dss, logdirty); - - if (rc) { - dss->rc =3D rc; - libxl__xc_domain_saverestore_async_callback_done(egc, - &dss->sws.shs, -1= ); - } else - libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.sh= s, 0); -} - -void libxl__domain_suspend_common_switch_qemu_logdirty - (uint32_t domid, unsigned enable, void *use= r) -{ - libxl__save_helper_state *shs =3D user; - libxl__egc *egc =3D shs->egc; - libxl__domain_save_state *dss =3D shs->caller_state; - - /* Convenience aliases. */ - libxl__logdirty_switch *const lds =3D &dss->logdirty; - - if (dss->type =3D=3D LIBXL_DOMAIN_TYPE_PVH) { - domain_suspend_switch_qemu_logdirty_done(egc, lds, 0); - return; - } - - lds->callback =3D domain_suspend_switch_qemu_logdirty_done; - libxl__domain_common_switch_qemu_logdirty(egc, domid, enable, lds); -} - -void libxl__domain_common_switch_qemu_logdirty(libxl__egc *egc, - int domid, unsigned enable, - libxl__logdirty_switch *lds) -{ - STATE_AO_GC(lds->ao); - - switch (libxl__device_model_version_running(gc, domid)) { - case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: - domain_suspend_switch_qemu_xen_traditional_logdirty(egc, domid, en= able, - lds); - break; - case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - domain_suspend_switch_qemu_xen_logdirty(egc, domid, enable, lds); - break; - default: - LOGD(ERROR, domid, "logdirty switch failed" - ", no valid device model version found, abandoning suspend"); - lds->callback(egc, lds, ERROR_FAIL); - } -} -static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev, - const struct timeval *requested_abs, - int rc) -{ - libxl__logdirty_switch *lds =3D CONTAINER_OF(ev, *lds, timeout); - STATE_AO_GC(lds->ao); - LOG(ERROR,"logdirty switch: wait for device model timed out"); - switch_logdirty_done(egc,lds,ERROR_FAIL); -} - static void switch_logdirty_xswatch(libxl__egc *egc, libxl__ev_xswatch *wa= tch, const char *watch_path, const char *event_path) { @@ -251,6 +201,31 @@ static void switch_logdirty_xswatch(libxl__egc *egc, l= ibxl__ev_xswatch *watch, } } =20 +static void domain_suspend_switch_qemu_xen_logdirty + (libxl__egc *egc, int domid, unsigned enabl= e, + libxl__logdirty_switch *lds) +{ + STATE_AO_GC(lds->ao); + int rc; + + rc =3D libxl__qmp_set_global_dirty_log(gc, domid, enable); + if (rc) + LOGD(ERROR, domid, + "logdirty switch failed (rc=3D%d), abandoning suspend",rc); + + lds->callback(egc, lds, rc); +} + +static void switch_logdirty_timeout(libxl__egc *egc, libxl__ev_time *ev, + const struct timeval *requested_abs, + int rc) +{ + libxl__logdirty_switch *lds =3D CONTAINER_OF(ev, *lds, timeout); + STATE_AO_GC(lds->ao); + LOG(ERROR,"logdirty switch: wait for device model timed out"); + switch_logdirty_done(egc,lds,ERROR_FAIL); +} + static void switch_logdirty_done(libxl__egc *egc, libxl__logdirty_switch *lds, int rc) @@ -263,6 +238,41 @@ static void switch_logdirty_done(libxl__egc *egc, lds->callback(egc, lds, rc); } =20 +static void domain_suspend_switch_qemu_logdirty_done + (libxl__egc *egc, libxl__logdirty_switch *lds, int= rc); + +void libxl__domain_suspend_common_switch_qemu_logdirty + (uint32_t domid, unsigned enable, void *use= r) +{ + libxl__save_helper_state *shs =3D user; + libxl__egc *egc =3D shs->egc; + libxl__domain_save_state *dss =3D shs->caller_state; + + /* Convenience aliases. */ + libxl__logdirty_switch *const lds =3D &dss->logdirty; + + if (dss->type =3D=3D LIBXL_DOMAIN_TYPE_PVH) { + domain_suspend_switch_qemu_logdirty_done(egc, lds, 0); + return; + } + + lds->callback =3D domain_suspend_switch_qemu_logdirty_done; + libxl__domain_common_switch_qemu_logdirty(egc, domid, enable, lds); +} + +static void domain_suspend_switch_qemu_logdirty_done + (libxl__egc *egc, libxl__logdirty_switch *lds, int= rc) +{ + libxl__domain_save_state *dss =3D CONTAINER_OF(lds, *dss, logdirty); + + if (rc) { + dss->rc =3D rc; + libxl__xc_domain_saverestore_async_callback_done(egc, + &dss->sws.shs, -1= ); + } else + libxl__xc_domain_saverestore_async_callback_done(egc, &dss->sws.sh= s, 0); +} + /*----- callbacks, called by xc_domain_save -----*/ =20 /* --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel