Skip to contentSkip to conversation

Allow direct hypercalls

PATCH In review [email protected] 3 participants 5 messages Apr 30, 2008 – May 1, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow direct hypercalls

# HG changeset patch
# User [email protected]
# Date 1209521783 25200
# Node ID 9a5c6e3620d83f9354e3eedbc4ef24a7a5ad752e # Parent f477f895f78752bb9fa2e6ee6c1d09b6a8cd3230 Allow direct hypercalls

For PV guests, there's no reason to force use of the indirect hypercall mechanism. Allow it. Also allow TRAP_INSTR to be used from assembly.

xen/include/public/arch-x86/xen-x86_32.h +4 -2
@@ -36,13 +36,15 @@
  * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
  */
 
-#if __XEN_INTERFACE_VERSION__ < 0x00030203
 /*
- * Legacy hypercall interface:
+ * Direct hypercall interface:
  * As above, except the entry sequence to the hypervisor is:
  *  mov $hypercall-number*32,%eax ; int $0x82
  */
+#if !defined(_ASM)
 #define TRAP_INSTR "int $0x82"
+#else
+#define TRAP_INSTR int $0x82
 #endif
 
 /*
xen/include/public/arch-x86/xen-x86_64.h +5 -3
@@ -36,16 +36,18 @@
  * Clobbered: argument registers (e.g., 2-arg hypercall clobbers %rdi,%rsi)
  */
 
-#if __XEN_INTERFACE_VERSION__ < 0x00030203
 /*
- * Legacy hypercall interface:
+ * Direct hypercall interface:
  * As above, except the entry sequence to the hypervisor is:
  *  mov $hypercall-number*32,%eax ; syscall
  * Clobbered: %rcx, %r11, argument registers (as above)
  */
+#if !defined(_ASM)
 #define TRAP_INSTR "syscall"
+#else
+#define TRAP_INSTR syscall
 #endif
-
+  
 /*
  * 64-bit segment selectors
  * These flat segments are in the Xen-private section of every GDT. Since these
#1 lore raw
Quoted 11 lines · On 30/4/08 13:56, "[email protected]" <[email protected]> wrote:

# HG changeset patch
# User [email protected]
# Date 1209521783 25200
# Node ID 9a5c6e3620d83f9354e3eedbc4ef24a7a5ad752e # Parent f477f895f78752bb9fa2e6ee6c1d09b6a8cd3230 Allow direct hypercalls

For PV guests, there's no reason to force use of the indirect hypercall mechanism. Allow it. Also allow TRAP_INSTR to be used from assembly.

Well, I suppose there is no reason. But since the instructions are not going to change you could just as well just open-code them, or define your own macro. _ASM isn't even a macro name that we use anywhere else in the public headers.

-- Keir

author
#2 lore raw
Quoted 10 lines · Keir Fraser
Quoted 10 lines

# HG changeset patch
# User [email protected]
# Date 1209521783 25200
# Node ID 9a5c6e3620d83f9354e3eedbc4ef24a7a5ad752e # Parent f477f895f78752bb9fa2e6ee6c1d09b6a8cd3230 Allow direct hypercalls

For PV guests, there's no reason to force use of the indirect hypercall mechanism. Allow it. Also allow TRAP_INSTR to be used from assembly.

Quoted 6 lines
Quoted 1 line

Well, I suppose there is no reason. But since the instructions are not going to change you could just as well just open-code them, or define your own macro. _ASM isn't even a macro name that we use anywhere else in the public headers.

We're doing our best to try and merge our tree with your upstream. I don't quite understand why you're refusing such simple, non-intrusive changes. Is it really good coding practice to needlessly duplicate stuff?

regards,
john

#3 lore raw
In reply to [email protected]
Quoted 2 lines · On Wed, 2008-04-30 at 05:56 -0700, [email protected] wrote:

For PV guests, there's no reason to force use of the indirect hypercall mechanism. Allow it.

It was originally intended to provide some flexibility to the hypervisor in how hypercalls were performed, encouraging new guests to use it seems rather counter to this -- why do you want to use them?

Ian.

author
#4 lore raw
Quoted 7 lines · Ian Campbell
Quoted 2 lines · On Wed, 2008-04-30 at 05:56 -0700, [email protected] wrote:

For PV guests, there's no reason to force use of the indirect hypercall mechanism. Allow it.

It was originally intended to provide some flexibility to the hypervisor in how hypercalls were performed, encouraging new guests to use it seems rather counter to this -- why do you want to use them?

There's no current advantage in using the hypercall page, nor is there one on the horizon AFAIK. There is a (most likely small) disadvantage.

regards,
john