Skip to contentSkip to conversation

tmem stub for 3.4

PATCH In review Dan Magenheimer 2 participants 3 messages Mar 19, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tmem stub for 3.4

After lengthy discussion with Keir and Ian, we agreed that it is too close to 3.4 freeze to put in the transcendent memory (tmem) patch. Instead, it will be added as soon as xen-unstable unfreezes following 3.4.

This patch reserves the hypercall number for tmem and adds a stub to allow tmem-modified guests to fail gracefully on the 3.4 release.

(Patch also attached in case my mailer messes up the formatting.)

xen/arch/x86/x86_32/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_32/entry.S
@@ -703,6 +703,7 @@ ENTRY(hypercall_table)
         .long do_sysctl             /* 35 */
         .long do_domctl
         .long do_kexec_op
+        .long do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
@@ -750,6 +751,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec_op          */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/compat/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/compat/entry.S
@@ -408,6 +408,7 @@ ENTRY(compat_hypercall_table)
         .quad do_sysctl                 /* 35 */
         .quad do_domctl
         .quad compat_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
         .endr
@@ -455,6 +456,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 1 /* do_sysctl                */  /* 35 */
         .byte 1 /* do_domctl                */
         .byte 2 /* compat_kexec_op          */
+        .byte 1 /* do_tmem_op               */
         .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/entry.S
@@ -692,6 +692,7 @@ ENTRY(hypercall_table)
         .quad do_sysctl             /* 35 */
         .quad do_domctl
         .quad do_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
@@ -739,6 +740,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec             */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/common/memory.c +13 -0
diff -r 2039e8271051 xen/common/memory.c
@@ -560,6 +560,19 @@ long do_memory_op(unsigned long cmd, XEN
     return rc;
 }
 
+/* temporary placeholder for tmem hypercall */
+int do_tmem_op(void *tmem_op)
+{
+    static int warned = 0;
+
+    if ( !warned )
+    {
+        printk("tmem: not implemented\n");
+        warned = 1;
+    }
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C
xen/arch/x86/x86_32/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_32/entry.S
@@ -703,6 +703,7 @@ ENTRY(hypercall_table)
         .long do_sysctl             /* 35 */
         .long do_domctl
         .long do_kexec_op
+        .long do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
@@ -750,6 +751,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec_op          */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/compat/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/compat/entry.S
@@ -408,6 +408,7 @@ ENTRY(compat_hypercall_table)
         .quad do_sysctl                 /* 35 */
         .quad do_domctl
         .quad compat_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
         .endr
@@ -455,6 +456,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 1 /* do_sysctl                */  /* 35 */
         .byte 1 /* do_domctl                */
         .byte 2 /* compat_kexec_op          */
+        .byte 1 /* do_tmem_op               */
         .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/entry.S
@@ -692,6 +692,7 @@ ENTRY(hypercall_table)
         .quad do_sysctl             /* 35 */
         .quad do_domctl
         .quad do_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
@@ -739,6 +740,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec             */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/common/memory.c +13 -0
diff -r 2039e8271051 xen/common/memory.c
@@ -560,6 +560,19 @@ long do_memory_op(unsigned long cmd, XEN
     return rc;
 }
 
+/* temporary placeholder for tmem hypercall */
+int do_tmem_op(void *tmem_op)
+{
+    static int warned = 0;
+
+    if ( !warned )
+    {
+        printk("tmem: not implemented\n");
+        warned = 1;
+    }
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C

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

#1 lore raw

Why would failing with -ENODEV be more graceful than failing with -ENOSYS? In my opinion it just makes eventual compatibility handling slightly more convoluted on the kernel side, as it then will require checking for two different return codes to distinguish non-fatal from possibly fatal failure.

Jan

Quoted 1 line
Quoted 1 line
Quoted 1 line

Dan Magenheimer <[email protected]> 19.03.09 15:42 >>>

After lengthy discussion with Keir and Ian, we agreed that it is too close to 3.4 freeze to put in the transcendent memory (tmem) patch. Instead, it will be added as soon as xen-unstable unfreezes following 3.4.

This patch reserves the hypercall number for tmem and adds a stub to allow tmem-modified guests to fail gracefully on the 3.4 release.

(Patch also attached in case my mailer messes up the formatting.)

xen/arch/x86/x86_32/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_32/entry.S
@@ -703,6 +703,7 @@ ENTRY(hypercall_table)
         .long do_sysctl             /* 35 */
         .long do_domctl
         .long do_kexec_op
+        .long do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
@@ -750,6 +751,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec_op          */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/compat/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/compat/entry.S
@@ -408,6 +408,7 @@ ENTRY(compat_hypercall_table)
         .quad do_sysctl                 /* 35 */
         .quad do_domctl
         .quad compat_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
         .endr
@@ -455,6 +456,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 1 /* do_sysctl                */  /* 35 */
         .byte 1 /* do_domctl                */
         .byte 2 /* compat_kexec_op          */
+        .byte 1 /* do_tmem_op               */
         .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .endr
xen/arch/x86/x86_64/entry.S +2 -0
diff -r 2039e8271051 xen/arch/x86/x86_64/entry.S
@@ -692,6 +692,7 @@ ENTRY(hypercall_table)
         .quad do_sysctl             /* 35 */
         .quad do_domctl
         .quad do_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
@@ -739,6 +740,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec             */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr
xen/common/memory.c +13 -0
diff -r 2039e8271051 xen/common/memory.c
@@ -560,6 +560,19 @@ long do_memory_op(unsigned long cmd, XEN
     return rc;
 }
 
+/* temporary placeholder for tmem hypercall */
+int do_tmem_op(void *tmem_op)
+{
+    static int warned = 0;
+
+    if ( !warned )
+    {
+        printk("tmem: not implemented\n");
+        warned = 1;
+    }
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C
#2 lore raw

The full tmem patch returns -ENODEV if tmem is present and disabled. I suppose it makes no difference whether the stub returns -ENODEV or -ENOSYS, but I'd still like to see the patch taken to ensure the slot is clearly reserved and to printk the warning.

Dan

Quoted 117 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, March 19, 2009 9:01 AM
To: Dan Magenheimer
Cc: Keir Fraser; Xen-Devel (E-mail)
Subject: Re: [Xen-devel] [PATCH] tmem stub for 3.4

Why would failing with -ENODEV be more graceful than failing with -ENOSYS?
In my opinion it just makes eventual compatibility handling slightly more
convoluted on the kernel side, as it then will require checking for two
different return codes to distinguish non-fatal from possibly fatal failure.

Jan

Quoted 1 line
Quoted 1 line
Quoted 1 line

Dan Magenheimer <[email protected]> 19.03.09 15:42 >>>

After lengthy discussion with Keir and Ian, we agreed that it is too close to 3.4 freeze to put in the transcendent memory (tmem) patch. Instead, it will be added as soon as xen-unstable unfreezes following 3.4.

This patch reserves the hypercall number for tmem and adds a stub to allow tmem-modified guests to fail gracefully on the 3.4 release.

(Patch also attached in case my mailer messes up the formatting.)

diff -r 2039e8271051 xen/arch/x86/x86_32/entry.S

xen/arch/x86/x86_32/entry.S +2 -0
@@ -703,6 +703,7 @@ ENTRY(hypercall_table)
         .long do_sysctl             /* 35 */
         .long do_domctl
         .long do_kexec_op
+        .long do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
@@ -750,6 +751,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec_op          */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr

diff -r 2039e8271051 xen/arch/x86/x86_64/compat/entry.S
--- a/xen/arch/x86/x86_64/compat/entry.S Wed Mar 18
17:30:13 2009 +0000
+++ b/xen/arch/x86/x86_64/compat/entry.S Thu Mar 19
08:31:35 2009 -0600

xen/arch/x86/x86_32/entry.S +2 -0
@@ -408,6 +408,7 @@ ENTRY(compat_hypercall_table)
         .quad do_sysctl                 /* 35 */
         .quad do_domctl
         .quad compat_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-compat_hypercall_table)/8)
         .quad compat_ni_hypercall
         .endr
@@ -455,6 +456,7 @@ ENTRY(compat_hypercall_args_table)
         .byte 1 /* do_sysctl                */  /* 35 */
         .byte 1 /* do_domctl                */
         .byte 2 /* compat_kexec_op          */
+        .byte 1 /* do_tmem_op               */
         .rept __HYPERVISOR_arch_0-(.-compat_hypercall_args_table)
         .byte 0 /* compat_ni_hypercall      */
         .endr

diff -r 2039e8271051 xen/arch/x86/x86_64/entry.S

xen/arch/x86/x86_64/entry.S +2 -0
@@ -692,6 +692,7 @@ ENTRY(hypercall_table)
         .quad do_sysctl             /* 35 */
         .quad do_domctl
         .quad do_kexec_op
+        .quad do_tmem_op
         .rept __HYPERVISOR_arch_0-((.-hypercall_table)/8)
         .quad do_ni_hypercall
         .endr
@@ -739,6 +740,7 @@ ENTRY(hypercall_args_table)
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec             */
+        .byte 1 /* do_tmem_op           */
         .rept __HYPERVISOR_arch_0-(.-hypercall_args_table)
         .byte 0 /* do_ni_hypercall      */
         .endr

diff -r 2039e8271051 xen/common/memory.c

xen/common/memory.c +13 -0
@@ -560,6 +560,19 @@ long do_memory_op(unsigned long cmd, XEN
     return rc;
 }
 
+/* temporary placeholder for tmem hypercall */
+int do_tmem_op(void *tmem_op)
+{
+    static int warned = 0;
+
+    if ( !warned )
+    {
+        printk("tmem: not implemented\n");
+        warned = 1;
+    }
+    return -ENODEV;
+}
+
 /*
  * Local variables:
  * mode: C