From nobody Mon Feb 9 12:42:54 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=1564760251; cv=none; d=zoho.com; s=zohoarc; b=Zw/U/8cIQnbikR8eFOQlr0PzK5WT65G458e98oe6Hrrtu1Df2XMiwHOiZiJzm7PjmjVmZDXubmRBQ1CiGAYB726PEDoYiesrdmpxKzArv4Kmbkz015/iDzq0R/4VgET5S/S2bTevUkYSciZmpQFR7dI1VvgflCXrn2ZVE/8gF3Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564760251; 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=+YWwmRauitl/bJy0AL/bC8+MxkXODFJLmDA3iViTC3I=; b=eVNpzpnDGaeKytAhnj6Y0AG224u9LI80bh2E2beVvRIBP4zhJJuawLoPyqIvfqMptM9O8p4LaRcqxJyLtKbqmqfA0fssHT5vlRzjd2Oi+rRIfHfWCzKOXqcNn5vR8x1GxSIUPpPq11+JkhBeXZ69Jymp+oclz6KmEn/6c6z4tMc= 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 1564760251812866.7116494044343; Fri, 2 Aug 2019 08:37:31 -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 1htZbN-00036j-Vd; Fri, 02 Aug 2019 15:36:17 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1htZbM-00034i-JR for xen-devel@lists.xenproject.org; Fri, 02 Aug 2019 15:36:16 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 430044fd-b53b-11e9-8980-bc764e045a96; Fri, 02 Aug 2019 15:36:14 +0000 (UTC) X-Inumbo-ID: 430044fd-b53b-11e9-8980-bc764e045a96 Authentication-Results: esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.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=esa1.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 (esa1.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=esa1.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: rtPpRBmXn6T/tvIvnAEfe2fkjT0aukz8tD9q9wzQylqDR+mTLVis9pmV5+Z1BiGsQdyMbDKuz5 ZF9uHeQzLDUODlbpUI4IGlYMooEYhXR1uwMaBDR8p8Nkfqosqa57gDWTYSsYGVSMtLvrUCmNQU o2vcF4g8Vagp3dZm64IXDR/HL27BvudIwiv+wMbJFRNM6XmtC6B22/0xhlTl0vF5+0rHeuBvNu IRC0JCzrTG7Wyy21zAmI/LcY1oKd4Pag/zAhIMrVZ4kkDmdW8dk2m6Ks8lHe0zLzBxvCo0Z44W TAQ= X-SBRS: 2.7 X-MesageID: 3825677 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,338,1559534400"; d="scan'208";a="3825677" From: Anthony PERARD To: Date: Fri, 2 Aug 2019 16:35:32 +0100 Message-ID: <20190802153606.32061-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802153606.32061-1-anthony.perard@citrix.com> References: <20190802153606.32061-1-anthony.perard@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 01/35] libxl: Make libxl_domain_unpause async 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" libxl_domain_unpause needs to make QMP calls, which are asynchronous, change the API to reflect that. Do the same with libxl_domain_pause async, even if it will keep completing synchronously. Also fix some coding style issue in those functions. Signed-off-by: Anthony PERARD Acked-by: Ian Jackson --- tools/libxl/libxl.h | 26 +++++++++++++++-- tools/libxl/libxl_colo_restore.c | 2 +- tools/libxl/libxl_colo_save.c | 2 +- tools/libxl/libxl_dm.c | 2 +- tools/libxl/libxl_domain.c | 48 +++++++++++++++++++++----------- tools/libxl/libxl_internal.h | 1 + tools/xl/xl_migrate.c | 4 +-- tools/xl/xl_saverestore.c | 2 +- tools/xl/xl_vmcontrol.c | 6 ++-- 9 files changed, 65 insertions(+), 28 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index e40546c23a..7a31169611 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -619,7 +619,8 @@ typedef struct libxl__ctx libxl_ctx; /* API compatibility. */ #ifdef LIBXL_API_VERSION #if LIBXL_API_VERSION !=3D 0x040200 && LIBXL_API_VERSION !=3D 0x040300 && \ - LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 + LIBXL_API_VERSION !=3D 0x040400 && LIBXL_API_VERSION !=3D 0x040500 && \ + LIBXL_API_VERSION !=3D 0x041300 #error Unknown LIBXL_API_VERSION #endif #endif @@ -1595,8 +1596,27 @@ int libxl_domain_rename(libxl_ctx *ctx, uint32_t dom= id, * transactionally that the domain has the old old name; if * trans is not 0 we use caller's transaction and caller must do retries= */ =20 -int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid); -int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid); +int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid, + const libxl_asyncop_how *ao_how) + LIBXL_EXTERNAL_CALLERS_ONLY; +#if defined(LIBXL_API_VERSION) && LIBXL_API_VERSION < 0x041300 +static inline int libxl_domain_pause_0x041200( + libxl_ctx *ctx, uint32_t domid) +{ + return libxl_domain_pause(ctx, domid, NULL); +} +static inline int libxl_domain_unpause_0x041200( + libxl_ctx *ctx, uint32_t domid) +{ + return libxl_domain_unpause(ctx, domid, NULL); +} +#define libxl_domain_pause libxl_domain_pause_0x041200 +#define libxl_domain_unpause libxl_domain_unpause_0x041200 +#endif + =20 int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, const char *filename, diff --git a/tools/libxl/libxl_colo_restore.c b/tools/libxl/libxl_colo_rest= ore.c index 0c535bd95d..aaa70552b8 100644 --- a/tools/libxl/libxl_colo_restore.c +++ b/tools/libxl/libxl_colo_restore.c @@ -853,7 +853,7 @@ static void colo_unpause_svm(libxl__egc *egc, EGC_GC; =20 /* We have enabled secondary vm's logdirty, so we can unpause it now */ - rc =3D libxl_domain_unpause(CTX, domid); + rc =3D libxl__domain_unpause(gc, domid); if (rc) { LOGD(ERROR, domid, "cannot unpause secondary vm"); goto out; diff --git a/tools/libxl/libxl_colo_save.c b/tools/libxl/libxl_colo_save.c index 3247cce3a7..1d261a1639 100644 --- a/tools/libxl/libxl_colo_save.c +++ b/tools/libxl/libxl_colo_save.c @@ -480,7 +480,7 @@ static void colo_preresume_cb(libxl__egc *egc, * no disk migration. */ if (css->paused) { - rc =3D libxl_domain_unpause(CTX, dss->domid); + rc =3D libxl__domain_unpause(gc, dss->domid); if (rc) { LOGD(ERROR, dss->domid, "cannot unpause primary vm"); goto out; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 5fe25b56f5..00da59153d 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2402,7 +2402,7 @@ static void stubdom_pvqemu_cb(libxl__egc *egc, goto out; } =20 - rc =3D libxl_domain_unpause(CTX, dm_domid); + rc =3D libxl__domain_unpause(gc, dm_domid); if (rc) goto out; =20 sdss->xswait.ao =3D ao; diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index 11a29b235b..1c313005db 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -557,18 +557,18 @@ int libxl_domain_suspend_only(libxl_ctx *ctx, uint32_= t domid, return AO_CREATE_FAIL(rc); } =20 -int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid) +int libxl_domain_pause(libxl_ctx *ctx, uint32_t domid, + const libxl_asyncop_how *ao_how) { - int ret; - GC_INIT(ctx); - ret =3D xc_domain_pause(ctx->xch, domid); - if (ret<0) { + AO_CREATE(ctx, domid, ao_how); + int r; + r =3D xc_domain_pause(ctx->xch, domid); + if (r < 0) { LOGED(ERROR, domid, "Pausing domain"); - GC_FREE; - return ERROR_FAIL; + return AO_CREATE_FAIL(ERROR_FAIL); } - GC_FREE; - return 0; + libxl__ao_complete(egc, ao, 0); + return AO_INPROGRESS; } =20 int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t domid, @@ -593,10 +593,9 @@ int libxl_domain_core_dump(libxl_ctx *ctx, uint32_t do= mid, return AO_INPROGRESS; } =20 -int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid) +int libxl__domain_unpause(libxl__gc *gc, libxl_domid domid) { - GC_INIT(ctx); - int ret, rc =3D 0; + int r, rc; =20 libxl_domain_type type =3D libxl__domain_type(gc, domid); if (type =3D=3D LIBXL_DOMAIN_TYPE_INVALID) { @@ -612,16 +611,33 @@ int libxl_domain_unpause(libxl_ctx *ctx, uint32_t dom= id) goto out; } } - ret =3D xc_domain_unpause(ctx->xch, domid); - if (ret<0) { + r =3D xc_domain_unpause(CTX->xch, domid); + if (r < 0) { LOGED(ERROR, domid, "Unpausing domain"); rc =3D ERROR_FAIL; + goto out; } - out: - GC_FREE; + rc =3D 0; +out: return rc; } =20 +int libxl_domain_unpause(libxl_ctx *ctx, uint32_t domid, + const libxl_asyncop_how *ao_how) +{ + AO_CREATE(ctx, domid, ao_how); + int rc =3D 0; + + rc =3D libxl__domain_unpause(gc, domid); + if (rc) goto out; + + libxl__ao_complete(egc, ao, rc); + return AO_INPROGRESS; + + out: + return AO_CREATE_FAIL(rc); +} + int libxl__domain_pvcontrol_available(libxl__gc *gc, uint32_t domid) { libxl_ctx *ctx =3D libxl__gc_owner(gc); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index cf9287c488..7bd08032cf 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -4108,6 +4108,7 @@ _hidden void libxl__remus_teardown(libxl__egc *egc, int rc); _hidden void libxl__remus_restore_setup(libxl__egc *egc, libxl__domain_create_state *dcs); +_hidden int libxl__domain_unpause(libxl__gc *, libxl_domid domid); =20 =20 /* diff --git a/tools/xl/xl_migrate.c b/tools/xl/xl_migrate.c index 1f0e87df50..22f0429b84 100644 --- a/tools/xl/xl_migrate.c +++ b/tools/xl/xl_migrate.c @@ -394,7 +394,7 @@ static void migrate_receive(int debug, int daemonize, i= nt monitor, /* The guest is running after failover in COLO mode */ exit(rc ? -ERROR_FAIL: 0); =20 - rc =3D libxl_domain_unpause(ctx, domid); + rc =3D libxl_domain_unpause(ctx, domid, NULL); if (rc) fprintf(stderr, "migration target (%s): " "Failed to unpause domain %s (id: %u):%d\n", @@ -429,7 +429,7 @@ static void migrate_receive(int debug, int daemonize, i= nt monitor, } =20 if (!pause_after_migration) { - rc =3D libxl_domain_unpause(ctx, domid); + rc =3D libxl_domain_unpause(ctx, domid, NULL); if (rc) goto perhaps_destroy_notify_rc; } =20 diff --git a/tools/xl/xl_saverestore.c b/tools/xl/xl_saverestore.c index 9afeadeeb2..5c70e2e874 100644 --- a/tools/xl/xl_saverestore.c +++ b/tools/xl/xl_saverestore.c @@ -150,7 +150,7 @@ static int save_domain(uint32_t domid, const char *file= name, int checkpoint, } else if (leavepaused || checkpoint) { if (leavepaused) - libxl_domain_pause(ctx, domid); + libxl_domain_pause(ctx, domid, NULL); libxl_domain_resume(ctx, domid, 1, 0); } else diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c index a1d633795c..419bf780a4 100644 --- a/tools/xl/xl_vmcontrol.c +++ b/tools/xl/xl_vmcontrol.c @@ -34,12 +34,12 @@ static int fd_lock =3D -1; =20 static void pause_domain(uint32_t domid) { - libxl_domain_pause(ctx, domid); + libxl_domain_pause(ctx, domid, NULL); } =20 static void unpause_domain(uint32_t domid) { - libxl_domain_unpause(ctx, domid); + libxl_domain_unpause(ctx, domid, NULL); } =20 static void destroy_domain(uint32_t domid, int force) @@ -972,7 +972,7 @@ int create_domain(struct domain_create *dom_info) } =20 if (!paused) - libxl_domain_unpause(ctx, domid); + libxl_domain_unpause(ctx, domid, NULL); =20 ret =3D domid; /* caller gets success in parent */ if (!daemonize && !monitor) --=20 Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel