From nobody Sat Apr 20 05:36:07 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1578330284; cv=none; d=zohomail.com; s=zohoarc; b=j6GOHIp2mp52nuVgitPtIlICVsftbM3F2nfMfjPuzF2TTc7xxh3BZmnA0ZfwgyYJBMTtGM/3oR7bbhTCPh4ps4lw8YOChlaMByQ0JwAt8vTHshBuV+Ekd2kAKZVI/5019YDrhmGUepMy0P2ik4XhVBs5G+DRHH47soVfx0vMzu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578330284; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=6V7Ueencsq3A+ZWu4X8e7zCvnLunHou9Om6yhy7Z18A=; b=n1eYVXMbM4SEcLz7rFiaKDK5kguq48cDUJ5ovjgCI+QGC5QzpEj4ogat5wrnHHPntMqup51GLp0TNWU+c8a7xR/gPeghlR3xquJ8VPWyYlca4pk22CcMi2OCeD1zcADj0ONgcfoJc+OOXql45hTvI3I466yEiYBrnTKFnfnjubw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578330284328622.3735938912522; Mon, 6 Jan 2020 09:04:44 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ioVnK-0004gv-Dz; Mon, 06 Jan 2020 17:03:58 +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 1ioVnI-0004gq-MI for xen-devel@lists.xenproject.org; Mon, 06 Jan 2020 17:03:56 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 85a45bda-30a6-11ea-ab37-12813bfff9fa; Mon, 06 Jan 2020 17:03:55 +0000 (UTC) X-Inumbo-ID: 85a45bda-30a6-11ea-ab37-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578330236; h=from:to:cc:subject:date:message-id:mime-version; bh=T0TvO4PiyCyyWHTsS8KfWe2W+1u04UiKwZdmhF+XwMk=; b=TNU1R0N4tv189GN3GqfdBgT/aZeeKGjM7rTOPBOyUPn5ucMLoAfHTSd8 T2zU3VlmUPU4Mm/sDzc9QoFyBuS8kokbsv7Rm92Kd9s9sB4OiOpbwuTPh wcTCO5oHrZ8RqnWYPyepj5lzEBjcpomM+qL38wgtuCsdR8x1xh9L2Ii+m w=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.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 (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@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 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: a/Xu7BCyw9E0864JQE2DDcssl5rufYgudbqWUTo9pauoi/+YIGGyXYS1CFv6gEW7gQUYBH4buy at6fCzfGxaGnQWDonqrnGyMr2//T3XX2VemdoE9dDGqTDIONAkxNrdSNzHP1ajj5JD6Xk1H1Yn 6WBRXu6CsrmjW/JX7xb+vIqXZ+q4f8i6bE7Y3RhIFpp0SS2jSRPwtTUj1q7oIyzY2CMRTiu5kZ E/AMsd8qjlbZ95KzhJ0287UdACiBCpn8hmkaRvt9g2QRDGJAdsCO9kBR3erjM9fImzgrGxvmuQ 0CA= X-SBRS: 2.7 X-MesageID: 10494209 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,403,1571716800"; d="scan'208";a="10494209" From: Andrew Cooper To: Xen-devel Date: Mon, 6 Jan 2020 17:03:52 +0000 Message-ID: <20200106170352.28582-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] tools/save: Drop unused parameters from xc_domain_save() 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 , Andrew Cooper , Wei Liu , Ian Jackson 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) XCFLAGS_CHECKPOINT_COMPRESS has been unused since c/s b15bc4345 (2015), XCFLAGS_HVM since c/s 9e8672f1c (2013), and XCFLAGS_STDVGA since c/s 087d43326 (2007). Drop the constants, and code which sets them. The separate hvm parameter (appeared in c/s d11bec8a1, 2007 and ultimately redundant with XCFLAGS_HVM), is used for sanity checking and debug printing, then discarded and replaced with Xen's idea of whether the domain is PV or HVM. Rearrange the logic in xc_domain_save() to ask Xen sightly earlier, and use= a consistent idea of 'hvm' throughout. Removing this parameter removes the final user of libxl's dss->hvm, so drop that field as well. Update the doxygen comment to be accurate. Signed-off-by: Andrew Cooper Acked-by: Ian Jackson Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Anthony PERARD --- tools/libxc/include/xenguest.h | 15 +++++++-------- tools/libxc/xc_nomigrate.c | 2 +- tools/libxc/xc_sr_save.c | 31 ++++++++++++++++--------------- tools/libxl/libxl_dom_save.c | 21 +-------------------- tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_save_callout.c | 2 +- tools/libxl/libxl_save_helper.c | 3 +-- 7 files changed, 27 insertions(+), 48 deletions(-) diff --git a/tools/libxc/include/xenguest.h b/tools/libxc/include/xenguest.h index fdb03e32da..1c358a0577 100644 --- a/tools/libxc/include/xenguest.h +++ b/tools/libxc/include/xenguest.h @@ -26,9 +26,6 @@ =20 #define XCFLAGS_LIVE (1 << 0) #define XCFLAGS_DEBUG (1 << 1) -#define XCFLAGS_HVM (1 << 2) -#define XCFLAGS_STDVGA (1 << 3) -#define XCFLAGS_CHECKPOINT_COMPRESS (1 << 4) =20 #define X86_64_B_SIZE 64=20 #define X86_32_B_SIZE 32 @@ -124,16 +121,18 @@ typedef enum { /** * This function will save a running domain. * - * @parm xch a handle to an open hypervisor interface - * @parm fd the file descriptor to save a domain to - * @parm dom the id of the domain + * @param xch a handle to an open hypervisor interface + * @param io_fd the file descriptor to save a domain to + * @param dom the id of the domain + * @param flags XCFLAGS_xxx * @param stream_type XC_MIG_STREAM_NONE if the far end of the stream * doesn't use checkpointing + * @param recv_fd Only used for XC_MIG_STREAM_COLO. Contains backchannel = from + * the destination side. * @return 0 on success, -1 on failure */ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, - uint32_t flags /* XCFLAGS_xxx */, - struct save_callbacks* callbacks, int hvm, + uint32_t flags, struct save_callbacks *callbacks, xc_migration_stream_t stream_type, int recv_fd); =20 /* callbacks provided by xc_domain_restore */ diff --git a/tools/libxc/xc_nomigrate.c b/tools/libxc/xc_nomigrate.c index c4dca88eb0..5a1d7e46f9 100644 --- a/tools/libxc/xc_nomigrate.c +++ b/tools/libxc/xc_nomigrate.c @@ -21,7 +21,7 @@ #include =20 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t fl= ags, - struct save_callbacks* callbacks, int hvm, + struct save_callbacks *callbacks, xc_migration_stream_t stream_type, int recv_fd) { errno =3D ENOSYS; diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c index 5a40e588e0..6f61f85ee0 100644 --- a/tools/libxc/xc_sr_save.c +++ b/tools/libxc/xc_sr_save.c @@ -967,7 +967,7 @@ static int save(struct xc_sr_context *ctx, uint16_t gue= st_type) =20 int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t flags, struct save_callbacks* callbacks, - int hvm, xc_migration_stream_t stream_type, int recv_fd) + xc_migration_stream_t stream_type, int recv_fd) { struct xc_sr_context ctx =3D { @@ -982,32 +982,33 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint= 32_t dom, ctx.save.checkpointed =3D stream_type; ctx.save.recv_fd =3D recv_fd; =20 + if ( xc_domain_getinfo(xch, dom, 1, &ctx.dominfo) !=3D 1 ) + { + PERROR("Failed to get domain info"); + return -1; + } + + if ( ctx.dominfo.domid !=3D dom ) + { + ERROR("Domain %u does not exist", dom); + return -1; + } + /* If altering migration_stream update this assert too. */ assert(stream_type =3D=3D XC_MIG_STREAM_NONE || stream_type =3D=3D XC_MIG_STREAM_REMUS || stream_type =3D=3D XC_MIG_STREAM_COLO); =20 /* Sanity checks for callbacks. */ - if ( hvm ) + if ( ctx.dominfo.hvm ) assert(callbacks->switch_qemu_logdirty); if ( ctx.save.checkpointed ) assert(callbacks->checkpoint && callbacks->postcopy); if ( ctx.save.checkpointed =3D=3D XC_MIG_STREAM_COLO ) assert(callbacks->wait_checkpoint); =20 - DPRINTF("fd %d, dom %u, flags %u, hvm %d", io_fd, dom, flags, hvm); - - if ( xc_domain_getinfo(xch, dom, 1, &ctx.dominfo) !=3D 1 ) - { - PERROR("Failed to get domain info"); - return -1; - } - - if ( ctx.dominfo.domid !=3D dom ) - { - ERROR("Domain %u does not exist", dom); - return -1; - } + DPRINTF("fd %d, dom %u, flags %u, hvm %d", + io_fd, dom, flags, ctx.dominfo.hvm); =20 ctx.domid =3D dom; =20 diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c index 65610e6055..32e3cb5a13 100644 --- a/tools/libxl/libxl_dom_save.c +++ b/tools/libxl/libxl_dom_save.c @@ -408,22 +408,8 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain= _save_state *dss) rc =3D libxl__domain_suspend_init(egc, dsps, type); if (rc) goto out; =20 - switch (type) { - case LIBXL_DOMAIN_TYPE_PVH: - case LIBXL_DOMAIN_TYPE_HVM: { - dss->hvm =3D 1; - break; - } - case LIBXL_DOMAIN_TYPE_PV: - dss->hvm =3D 0; - break; - default: - abort(); - } - dss->xcflags =3D (live ? XCFLAGS_LIVE : 0) - | (debug ? XCFLAGS_DEBUG : 0) - | (dss->hvm ? XCFLAGS_HVM : 0); + | (debug ? XCFLAGS_DEBUG : 0); =20 /* Disallow saving a guest with vNUMA configured because migration * stream does not preserve node information. @@ -440,11 +426,6 @@ void libxl__domain_save(libxl__egc *egc, libxl__domain= _save_state *dss) goto out; } =20 - if (dss->checkpointed_stream =3D=3D LIBXL_CHECKPOINTED_STREAM_REMUS) { - if (libxl_defbool_val(r_info->compression)) - dss->xcflags |=3D XCFLAGS_CHECKPOINT_COMPRESS; - } - if (dss->checkpointed_stream =3D=3D LIBXL_CHECKPOINTED_STREAM_NONE) callbacks->suspend =3D libxl__domain_suspend_callback; =20 diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index a99f3627e4..ba8c9b41ab 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -3591,7 +3591,6 @@ struct libxl__domain_save_state { const libxl_domain_remus_info *remus; /* private */ int rc; - int hvm; int xcflags; libxl__domain_suspend_state dsps; union { diff --git a/tools/libxl/libxl_save_callout.c b/tools/libxl/libxl_save_call= out.c index caa1396813..0b11495f9b 100644 --- a/tools/libxl/libxl_save_callout.c +++ b/tools/libxl/libxl_save_callout.c @@ -87,7 +87,7 @@ void libxl__xc_domain_save(libxl__egc *egc, libxl__domain= _save_state *dss, libxl__srm_callout_enumcallbacks_save(&shs->callbacks.save.a); =20 const unsigned long argnums[] =3D { - dss->domid, dss->xcflags, dss->hvm, cbflags, + dss->domid, dss->xcflags, cbflags, dss->checkpointed_stream, }; =20 diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helpe= r.c index cdad40be4f..0f52930c45 100644 --- a/tools/libxl/libxl_save_helper.c +++ b/tools/libxl/libxl_save_helper.c @@ -252,7 +252,6 @@ int main(int argc, char **argv) recv_fd =3D atoi(NEXTARG); uint32_t dom =3D strtoul(NEXTARG,0,10); uint32_t flags =3D strtoul(NEXTARG,0,10); - int hvm =3D atoi(NEXTARG); unsigned cbflags =3D strtoul(NEXTARG,0,10); xc_migration_stream_t stream_type =3D strtoul(NEXTARG,0,10); assert(!*++argv); @@ -263,7 +262,7 @@ int main(int argc, char **argv) setup_signals(save_signal_handler); =20 r =3D xc_domain_save(xch, io_fd, dom, flags, &helper_save_callback= s, - hvm, stream_type, recv_fd); + stream_type, recv_fd); complete(r); =20 } else if (!strcmp(mode,"--restore-domain")) { --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel