[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/2] tools/xl: add suspend and resume subcommands


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 2 Dec 2024 18:30:20 -0500
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vates.tech 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=arcselector10001; 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=mJBWXBIbNO36o0iRQCRlSmzN18HIFarj3mI6Kpjyx18=; b=Kt6xCJF4S8HFG93IYuq7wMXuiojVD8hVC1kXVeiJeZOnYgBUkSXSfFKYMtUN9nwT8W5jptioNgju8eqq1yEq/OTtPHM832dHmqWO/pDKsCIUCmLXito1fwahaORAqfgnt81dhP6ltp6e0V8G4AFnyiH1Zs5kJO7SCEnMxAFZxSac5dP41ytxHchX2h0vi1yKylQV/WjdnOhDeNFB3CSfjJ0Q2MKVsYuW/23gAcmBCi+fCyMTb73U8HyMJoZ6X+Mk2I0At0po4sU9HU361fiPVseQhP7Tcz7vssk2s1VpVTpvzXMWgxZxvDMme8jSEoRqFZkASbgVyXeuMFErMI3NuQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GyVR5KfG0GjzSUNWcQgwP2d9slNjJIMEb6GkNl+fV7jFWHF2DLLvKv8FO+zAwSrrNdWuaRhwa6u+fk98HHnv7ZwEd8aWw0utFaRklcZfqQp4c1VROwhyN5HRefyzHVotQjCMBCgxqcScO8J09N+77SRthP8a6MgRfIch0E5ICW/z6qkANKArWCJ+bzAud/xdzn8c0XnE/EyZD759iDlCcYKCFbuKZdSxhTr4OUtZknqucrKIdY6NXtvdxALsCT7e9QxXecvX8Edj4xCKN7rjWpFIpGJEGzHVOq5Y/Wrq5J5v1Y8xHkh15zYhFkmg9bp8P/bOHLSQN3Mc77Zz1uWeYA==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, zithro / Cyril Rébert <slack@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 02 Dec 2024 23:30:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-11-28 12:19, Anthony PERARD wrote:
On Tue, Nov 26, 2024 at 12:19:41PM -0500, Jason Andryuk wrote:
diff --git a/tools/xl/xl_vmcontrol.c b/tools/xl/xl_vmcontrol.c
index c45d497c28..3160966972 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(uint32_t domid)
+{
+    libxl_domain_suspend_only(ctx, domid, NULL);
+}
+
+static void resume_domain(uint32_t domid)
+{
+    libxl_domain_resume(ctx, domid, 1, NULL);
+}
+
  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_suspend(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "suspend", 1) {
+        /* No options */
+    }
+
+    suspend_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}
+
+int main_resume(int argc, char **argv)
+{
+    int opt;
+
+    SWITCH_FOREACH_OPT(opt, "", NULL, "resume", 1) {
+        /* No options */
+    }
+
+    resume_domain(find_domain(argv[optind]));
+
+    return EXIT_SUCCESS;
+}

These four new functions in xl_vmcontrol.c needs to be hidden behind
LIBXL_HAVE_NO_SUSPEND_RESUME, like the whole xl_migrate.c file is.
Both prototypes for main_*() are already hidden as well as the new
command in xl_cmdtables.

Or alternatively, we could probably have the command been present on
Arm, but I don't know if libxl_domain_suspend_only() is going to work.
It looks like it only depends on the hypervisor. I can't find any logic
that would treat Arm differently, besides the presence of
LIBXL_HAVE_NO_SUSPEND_RESUME.

But best bet would be to hide those four functions when
LIBXL_HAVE_NO_SUSPEND_RESUME is defined.

Thanks.  Yes, I'll hide them.

Regards,
Jason




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.