WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

[Xen-devel] [PATCH] [IA64] Support preemption in multicall

To: xen-devel@xxxxxxxxxxxxxxxxxxx, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] [IA64] Support preemption in multicall
From: "KUWAMURA Shin'ya" <kuwa@xxxxxxxxxxxxxx>
Date: Wed, 24 Feb 2010 10:16:09 +0900 (JST)
Cc:
Delivery-date: Tue, 23 Feb 2010 17:33:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi,

After 19946:91407452cdb6, preemption in multicall may happen while HVM
domains are running. It cause hypervisor's panic on ia64.
This patch implements it in the same way to x86.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
# HG changeset patch
# User KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>
# Date 1266973906 -32400
# Node ID b2f738ee665ea5e47e2588b5ebbf5a58de86c35b
# Parent  4ba4323889b970368675c57417dea94076536431
[IA64] Support preemption in multicall

After 19946:91407452cdb6, preemption in multicall may happen,
so this patch implements it in the same way to x86.

Signed-off-by: KUWAMURA Shin'ya <kuwa@xxxxxxxxxxxxxx>

diff -r 4ba4323889b9 -r b2f738ee665e xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c     Mon Feb 22 18:47:22 2010 +0000
+++ b/xen/arch/ia64/xen/hypercall.c     Wed Feb 24 10:11:46 2010 +0900
@@ -404,6 +404,18 @@ ia64_hypercall(struct pt_regs *regs)
        return IA64_NO_FAULT;
 }
 
+#define next_arg(fmt, args) ({                                              \
+    unsigned long __arg;                                                    \
+    switch ( *(fmt)++ )                                                     \
+    {                                                                       \
+    case 'i': __arg = (unsigned long)va_arg(args, unsigned int);  break;    \
+    case 'l': __arg = (unsigned long)va_arg(args, unsigned long); break;    \
+    case 'h': __arg = (unsigned long)va_arg(args, void *);        break;    \
+    default:  __arg = 0; BUG();                                             \
+    }                                                                       \
+    __arg;                                                                  \
+})
+
 unsigned long hypercall_create_continuation(
        unsigned int op, const char *format, ...)
 {
@@ -415,43 +427,36 @@ unsigned long hypercall_create_continuat
     va_list args;
 
     va_start(args, format);
-    if (test_bit(_MCSF_in_multicall, &mcs->flags))
-        panic("PREEMPT happen in multicall\n");        // Not support yet
 
-    vcpu_set_gr(v, 15, op, 0);
+    if (test_bit(_MCSF_in_multicall, &mcs->flags)) {
+        dprintk(XENLOG_DEBUG, "PREEMPT happen in multicall\n");
+        __set_bit(_MCSF_call_preempted, &mcs->flags);
+        for (i = 0; *p != '\0'; i++)
+            mcs->call.args[i] = next_arg(p, args);
+    }
+    else {
+        vcpu_set_gr(v, 15, op, 0);
 
-    for (i = 0; *p != '\0'; i++) {
-        switch ( *p++ )
-        {
-        case 'i':
-            arg = (unsigned long)va_arg(args, unsigned int);
-            break;
-        case 'l':
-            arg = (unsigned long)va_arg(args, unsigned long);
-            break;
-        case 'h':
-            arg = (unsigned long)va_arg(args, void *);
-            break;
-        default:
-            arg = 0;
-            BUG();
+        for (i = 0; *p != '\0'; i++) {
+            arg = next_arg(p, args);
+            vcpu_set_gr(v, 16 + i, arg, 0);
         }
-        vcpu_set_gr(v, 16 + i, arg, 0);
-    }
     
-    if (i >= 6)
-        panic("Too many args for hypercall continuation\n");
+        if (i >= 6)
+            panic("Too many args for hypercall continuation\n");
 
-    // Clean other argument to 0
-    while (i < 6) {
-        vcpu_set_gr(v, 16 + i, 0, 0);
-        i++;
+        // Clean other argument to 0
+        while (i < 6) {
+            vcpu_set_gr(v, 16 + i, 0, 0);
+            i++;
+        }
+
+        // re-execute break;
+        vcpu_decrement_iip(v);
+    
+        v->arch.hypercall_continuation = 1;
     }
 
-    // re-execute break;
-    vcpu_decrement_iip(v);
-    
-    v->arch.hypercall_continuation = 1;
     va_end(args);
     return op;
 }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] [IA64] Support preemption in multicall, KUWAMURA Shin'ya <=