Skip to contentSkip to conversation

clarify SHUTDOWN_suspend additional argument

PATCH Superseded Stefano Stabellini 4 participants 7 messages May 7, 2014 – May 8, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clarify SHUTDOWN_suspend additional argument

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

xen/include/public/sched.h +3 -2
index a30b11d..c170556 100644
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.
  *
  * In addition, which reason is SHUTDOWN_suspend this hypercall
  * returns 1 if suspend was cancelled or the domain was merely
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

But:

xen/include/public/sched.h line 82

Quoted 13 lines
xen/include/public/sched.h +3 -2
index a30b11d..c170556 100644
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Is this strictly true or is the argument ignored for those guests? (Requiring it to be zero doesn't conflict with that hence the ack)

Quoted 3 lines
xen/include/public/sched.h +0 -0
  *
  * In addition, which reason is SHUTDOWN_suspend this hypercall
  * returns 1 if suspend was cancelled or the domain was merely
#2 lore raw
Quoted 9 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

But:

Quoted 15 lines

xen/include/public/sched.h line 82

Quoted 13 lines
xen/include/public/sched.h +3 -2
index a30b11d..c170556 100644
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Is this strictly true or is the argument ignored for those guests? (Requiring it to be zero doesn't conflict with that hence the ack)

Having recently played with code here, I believe it is as follows.

* Xen does absolutely nothing with the value whatsoever.
* PV Migration *must* check the value (and indeed converts it to a pfn for transit)
* HVM guests (including arm for these purposes) don't have easy access to the register, and just transmit the Xen architectural state blob as-is.

Therefore, the only requirement I can see is that PV guests must point it at the start_info_t mfn.

~Andrew

Quoted 10 lines

xen/include/public/sched.h line 85

Quoted 4 lines
xen/include/public/sched.h +0 -0
  *
  * In addition, which reason is SHUTDOWN_suspend this hypercall
  * returns 1 if suspend was cancelled or the domain was merely

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 28 lines · Andrew Cooper
Quoted 9 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

But:

Quoted 15 lines

xen/include/public/sched.h line 82

Quoted 13 lines
xen/include/public/sched.h +3 -2
index a30b11d..c170556 100644
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Is this strictly true or is the argument ignored for those guests? (Requiring it to be zero doesn't conflict with that hence the ack)

Having recently played with code here, I believe it is as follows.

Quoted 8 lines

* Xen does absolutely nothing with the value whatsoever.
* PV Migration *must* check the value (and indeed converts it to a pfn for transit)
* HVM guests (including arm for these purposes) don't have easy access to the register, and just transmit the Xen architectural state blob as-is.

Therefore, the only requirement I can see is that PV guests must point it at the start_info_t mfn.

This matched my understanding too, thanks for confirming.

There's no harm in mandating it be zero I suppose, except perhaps we've just made some OSes undetectably buggy, which would only be a problem if in the future someone decided "oh, this must be 0, so we can now extend the interface safely".

Ian.

#4 lore raw
Quoted 36 lines · Ian Campbell
Quoted 27 lines · Andrew Cooper
Quoted 9 lines · Ian Campbell
Quoted 5 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

But:

Quoted 15 lines

xen/include/public/sched.h line 82

Quoted 13 lines
xen/include/public/sched.h +3 -2
index a30b11d..c170556 100644
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Is this strictly true or is the argument ignored for those guests? (Requiring it to be zero doesn't conflict with that hence the ack)

Having recently played with code here, I believe it is as follows.

Quoted 8 lines

* Xen does absolutely nothing with the value whatsoever.
* PV Migration *must* check the value (and indeed converts it to a pfn for transit)
* HVM guests (including arm for these purposes) don't have easy access to the register, and just transmit the Xen architectural state blob as-is.

Therefore, the only requirement I can see is that PV guests must point it at the start_info_t mfn.

Quoted 9 lines

This matched my understanding too, thanks for confirming.

There's no harm in mandating it be zero I suppose, except perhaps we've just made some OSes undetectably buggy, which would only be a problem if in the future someone decided "oh, this must be 0, so we can now extend the interface safely".

Ian.

Yes - retroactively mandating it to be 0 will 'break' current HVM guests, which will have whatever value was in %rdx. For a very long time this hypercall was mis-documented as a 2-argument hypercall, making it more likely that something non-0 was in there.

The best that can be safely stated in the comment is that the 3rd parameter is free for VM use for x86 HVM and ARM guests. (Unless I suppose ARM want to restrict this before migration is supported?)

~Andrew

#5 lore raw
In reply to Stefano Stabellini
Quoted 11 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

xen/include/public/sched.h +0 -0
index a30b11d..c170556 100644

xen/include/public/sched.h line 82

Quoted 8 lines
xen/include/public/sched.h +3 -2
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Perhaps word this to reflect what the toolstack actually does?

* x86 PV guest must also set RDX (EDX for 32-bit guests) to the MFN
* of the guest's start info page. RDX/EDX is the third hypercall
* argument.

David

#6 lore raw
Quoted 23 lines · David Vrabel
Quoted 11 lines · Stefano Stabellini

SCHEDOP_shutdown has a third argument that is unused on HVM and ARM guests. Those guests pass 0 instead. Clarify the behaviour in the hypercall description.

xen/include/public/sched.h +0 -0
index a30b11d..c170556 100644

xen/include/public/sched.h line 82

Quoted 8 lines
xen/include/public/sched.h +3 -2
@@ -77,8 +77,9 @@
  * @arg == pointer to sched_shutdown_t structure.
  *
  * If the sched_shutdown_t reason is SHUTDOWN_suspend then this
- * hypercall takes an additional extra argument which should be the
- * MFN of the guest's start_info_t.
+ * hypercall takes an additional extra argument which should be:
+ *  - the MFN of the guest's start_info_t for x86 PV guests;
+ *  - 0 for x86 HVM guests and arm and arm64 guests.

Perhaps word this to reflect what the toolstack actually does?

Quoted 3 lines

* x86 PV guest must also set RDX (EDX for 32-bit guests) to the MFN
* of the guest's start info page. RDX/EDX is the third hypercall
* argument.

That is better. It also the advantage on keeping the sched_op hypercall always to 2 arguments on ARM, making the Linux side implementation cleaner.
I'll respin both this patch and the corresponding Linux side.