[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tools/xl: add suspend-to-ram and resume subcommands
- To: zithro / Cyril Rébert <slack@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Wed, 24 Apr 2024 10:03:05 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rabbit.lu smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=avRbYMz1cA3ScoHCNHSNugO3g1pNhOD3+1TQutSLqX8=; b=eZeBpNbAnd4nO5B7oPXWNM7NBy29iLO2YwXEPvSE5KKmv2HY9YXctVGVEQhgpxZS/HyCSv9fEP9yjgUXkCFh/rd4fYFcfPiJXie8IwJAUNMSn4mgUSu/D4kLWojTXtHNifhw/QN+vuGqUPOHh0pEfn4ArNjnxC45BvV0tpu/DJgdCB7epFy3ry+JaDT0z3TBgO/CE1iYKLQzgB4iAwwPtyYdksDCGNBngEDUrAAM454FCBcAINwYaf5zi+o0j8Nxsdn7OTA71L07e1dRmDjW+fCSORfsJ4f4m+kKDntvG83FaO9tBlSyILgnhosMCup7+EwtW2VxYP9HRvs8Kum67w==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gUR0sBRoOeZP4A8g2uoY56VmUV62ovjeTvemHBhGe491DC/gy4vY9sfUfDiUmOHkjiP2tkO4D6lOgPO9fSyG3VRSs4hHqEU444ETeb3374vBw4Kq7+ZYSmMpWCFownaZryBW2FcHOukJAyxUByAPXEm1GtSxXXKGn2d7KES6xYE5likoBOp/SaWIVdBGor4Cyj6wuUxmUoInmwKEZ3D6IQsHpu1qUgQ/jnVJqvzcGddcsSOSkro0YOP7XauDv5Z6TZRJrzXfl0ICAT4vtlanhYiL1hy+ZW77nnnAsz088NFDlxal1J9DRQ7QPi3xYzsFCPaqCi9H5XoBfEM/k8h+KA==
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
- Delivery-date: Wed, 24 Apr 2024 14:03:43 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2024-02-29 02:00, zithro / Cyril Rébert wrote:
The xl command doesn't provide suspend/resume, so add them :
xl suspend-to-ram <Domain>
xl resume <Domain>
This patch follows a discussion on XenDevel: when you want the
virtualized equivalent of "sleep"-ing a host, it's better to
suspend/resume than to pause/unpause a domain.
Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Suggested-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
You should include you S-o-B here to certify your patch under the
Developer's Certificate of Origin. You can read what that means in
CONTRIBUTING. tl;dr: You are stating you can make the open source
contribution.
I tested this with a PVH and HVM guest. suspend-to-ram and resume seem
to function properly. The VCPUs stop, but the domain & qemu remain.
Resume works - the VCPUs start running again.
However, the domain destruction seems to hang on poweroff. The VM
transitions to powered off - state shutdown - but the domain and QEMU
instance are not cleaned up.
If I power off without a suspend-to-ram, everything is cleaned up properly.
Have you seen this? It's not your code, but I guess something with
libxl or qemu.
---
- Tested on v4.17, x86
- the function "libxl_domain_resume" is called like libvirt does, so
using a "co-operative resume", but I don't know what it means (:
- there may be a problem with the words resume <-> restore, like
for "LIBXL_HAVE_NO_SUSPEND_RESUME"
- for the docs, I only slightly adapted a copy/paste from xl pause ...
---
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index 98f6bd2e76..ba45f89c5a 100644
--- a/tools/xl/xl_vmcontrol.c
+++ b/tools/xl/xl_vmcontrol.c
@@ -42,6 +42,16 @@ static void unpause_domain(uint32_t domid)
libxl_domain_unpause(ctx, domid, NULL);
}
+static void suspend_domain_toram(uint32_t domid)
+{
+ libxl_domain_suspend_only(ctx, domid, NULL);
+}
+
+static void resume_domain(uint32_t domid)
+{
+ libxl_domain_resume(ctx, domid, 1, NULL);
+}
+
I would just inline these functions below.
static void destroy_domain(uint32_t domid, int force)
{
int rc;
@@ -82,6 +92,32 @@ int main_unpause(int argc, char **argv)
return EXIT_SUCCESS;
}
+int main_suspendtoram(int argc, char **argv)
Maybe main_suspend_to_ram to be closer to the command line suspend-to-ram.
Thanks,
Jason
|