xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libxc: Document xc_domain_resume
@ 2016-03-30 15:10 Konrad Rzeszutek Wilk
  2016-03-30 16:01 ` Wei Liu
  2016-03-30 16:17 ` Dario Faggioli
  0 siblings, 2 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-30 15:10 UTC (permalink / raw)
  To: xen-devel, wei.liu2
  Cc: Konrad Rzeszutek Wilk, ian.jackson, wency, jbeulich, hongyang.yang

Document the save and suspend mechanism.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
v2: Wei update on wording.
---
 tools/libxc/include/xenctrl.h | 52 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 150d727..096ff5c 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -565,6 +565,58 @@ int xc_domain_destroy(xc_interface *xch,
  * This function resumes a suspended domain. The domain should have
  * been previously suspended.
  *
+ * Note that there are 'xc_domain_suspend' as suspending a domain
+ * is quite the endeavour. As such this long comment will describe the
+ * suspend and resume path.
+ *
+ * For the purpose of this explanation there are three guests:
+ * PV (using hypercalls for privilgied operations), HVM
+ * (fully hardware virtualized guests using emulated devices for everything),
+ * and PVHVM (hardware virtualized guest with PV drivers).
+ *
+ * HVM guest are the simplest - they suspend via S3 and resume from
+ * S3. Upon resume they have to re-negotiate with the emulated devices.
+ *
+ * PV and PVHVM communicate via via hypercalls for suspend (and resume).
+ * For suspend the toolstack initiaties the process by writting an value in
+ * XenBus "control/shutdown" with the string "suspend".
+ *
+ * The PV guest stashes anything it deems neccessary in 'struct start_info'
+ * in case of failure (PVHVM may ignore this) and calls the
+ * SCHEDOP_shutdown::SHUTDOWN_suspend  hypercall (for PV as argument it
+ * passes the MFN to 'struct start_info').
+ *
+ * And then the guest is suspended.
+ *
+ * At this point the guest may be resumed on the same host under the same
+ * domain (checkpointing or suspending failed), or on a different host.
+ *
+ * The checkpointing or notifying an guest that the suspend failed is by
+ * having the SCHEDOP_shutdown::SHUTDOWN_suspend hypercall return a non-zero
+ * value.
+ *
+ * The PV and PVHVM resume path are similar. For PV it would be similar to bootup
+ * - figure out where the 'struct start_info' is (or if the suspend was
+ * cancelled aka checkpointed - reuse the saved values).
+ *
+ * From here on they differ depending whether the guest is PV or PVHVM
+ * in specifics but follow overall the same path:
+ *  - PV: Bringing up the vCPUS,
+ *  - PVHVM: Setup vector callback,
+ *  - Bring up vCPU runstates,
+ *  - Remap the grant tables if checkpointing or setup from scratch,
+ *
+ *
+ * If the resume was not checkpointing (or if suspend was succesful) we would
+ * setup the PV timers and the different PV events. Lastly the PV drivers
+ * re-negotiate with the backend.
+ *
+ * This function would return before the guest started resuming. That is
+ * the guest would be in non-running state and its vCPU context would be
+ * in the the SCHEDOP_shutdown::SHUTDOWN_suspend hypercall return path
+ * (for PV and PVHVM). For HVM it would be in would be in QEMU emulated
+ * BIOS handling S3 suspend.
+ *
  * @parm xch a handle to an open hypervisor interface
  * @parm domid the domain id to resume
  * @parm fast use cooperative resume (guest must support this)
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc: Document xc_domain_resume
  2016-03-30 15:10 [PATCH] libxc: Document xc_domain_resume Konrad Rzeszutek Wilk
@ 2016-03-30 16:01 ` Wei Liu
  2016-03-30 16:12   ` Konrad Rzeszutek Wilk
  2016-03-30 16:17 ` Dario Faggioli
  1 sibling, 1 reply; 4+ messages in thread
From: Wei Liu @ 2016-03-30 16:01 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: wei.liu2, wency, ian.jackson, jbeulich, xen-devel, hongyang.yang

On Wed, Mar 30, 2016 at 11:10:23AM -0400, Konrad Rzeszutek Wilk wrote:
> Document the save and suspend mechanism.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> v2: Wei update on wording.

I think you haven't addressed Andrew's comments. Maybe you missed it. I
will take over this patch and address them if you don't mind.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc: Document xc_domain_resume
  2016-03-30 16:01 ` Wei Liu
@ 2016-03-30 16:12   ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-03-30 16:12 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, ian.jackson, wency, jbeulich, hongyang.yang

On Wed, Mar 30, 2016 at 05:01:34PM +0100, Wei Liu wrote:
> On Wed, Mar 30, 2016 at 11:10:23AM -0400, Konrad Rzeszutek Wilk wrote:
> > Document the save and suspend mechanism.
> > 
> > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > ---
> > v2: Wei update on wording.
> 
> I think you haven't addressed Andrew's comments. Maybe you missed it. I

I must have missed it!

> will take over this patch and address them if you don't mind.

Go for it!
> 
> Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libxc: Document xc_domain_resume
  2016-03-30 15:10 [PATCH] libxc: Document xc_domain_resume Konrad Rzeszutek Wilk
  2016-03-30 16:01 ` Wei Liu
@ 2016-03-30 16:17 ` Dario Faggioli
  1 sibling, 0 replies; 4+ messages in thread
From: Dario Faggioli @ 2016-03-30 16:17 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, xen-devel, wei.liu2
  Cc: ian.jackson, jbeulich, wency, hongyang.yang


[-- Attachment #1.1: Type: text/plain, Size: 1863 bytes --]

On Wed, 2016-03-30 at 11:10 -0400, Konrad Rzeszutek Wilk wrote:
> 
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -565,6 +565,58 @@ int xc_domain_destroy(xc_interface *xch,
> 
> + * HVM guest are the simplest - they suspend via S3 and resume from
> + * S3. Upon resume they have to re-negotiate with the emulated
> devices.
> + *
> + * PV and PVHVM communicate via via hypercalls for suspend (and 
                               ^repeated "via"

> resume).
> + * For suspend the toolstack initiaties the process by writting an
> value in
> + * XenBus "control/shutdown" with the string "suspend".
> + *
> + * The PV guest stashes anything it deems neccessary in 'struct
> start_info'
> + * in case of failure (PVHVM may ignore this) and calls the
> + * SCHEDOP_shutdown::SHUTDOWN_suspend  hypercall (for PV as argument
> it
> + * passes the MFN to 'struct start_info').
> + *
> + * And then the guest is suspended.
> + *
> + * At this point the guest may be resumed on the same host under the
> same
> + * domain (checkpointing or suspending failed), or on a different
> host.
>
I think there's also the case of "same host, different domain", as it
happens in local migrations, but maybe it's not that important to
mention it here.

> + * If the resume was not checkpointing (or if suspend was succesful)
> we would
> + * setup the PV timers and the different PV events. Lastly the PV
> drivers
> + * re-negotiate with the backend.
                            ^backends ?

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-30 16:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 15:10 [PATCH] libxc: Document xc_domain_resume Konrad Rzeszutek Wilk
2016-03-30 16:01 ` Wei Liu
2016-03-30 16:12   ` Konrad Rzeszutek Wilk
2016-03-30 16:17 ` Dario Faggioli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).