All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Anthony PERARD" <anthony.perard@vates.tech>
To: "Jason Andryuk" <jason.andryuk@amd.com>
Cc: xen-devel@lists.xenproject.org,
	"zithro / Cyril Rébert" <slack@rabbit.lu>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
Subject: Re: [PATCH v2 2/2] tools/xl: add suspend and resume subcommands
Date: Thu, 28 Nov 2024 17:19:38 +0000	[thread overview]
Message-ID: <Z0imKGddLpvxAZEN@l14> (raw)
In-Reply-To: <20241126171941.170897-3-jason.andryuk@amd.com>

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,

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


  reply	other threads:[~2024-11-28 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-26 17:19 [PATCH v2 0/2] xl suspend/resume commands Jason Andryuk
2024-11-26 17:19 ` [PATCH v2 1/2] xl: Keep monitoring suspended domain Jason Andryuk
2024-11-28 16:45   ` Anthony PERARD
2024-12-02  8:53     ` Jan Beulich
2024-12-02 23:30       ` Jason Andryuk
2024-11-26 17:19 ` [PATCH v2 2/2] tools/xl: add suspend and resume subcommands Jason Andryuk
2024-11-28 17:19   ` Anthony PERARD [this message]
2024-12-02 23:30     ` Jason Andryuk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z0imKGddLpvxAZEN@l14 \
    --to=anthony.perard@vates.tech \
    --cc=andrew.cooper3@citrix.com \
    --cc=jason.andryuk@amd.com \
    --cc=marmarek@invisiblethingslab.com \
    --cc=slack@rabbit.lu \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.