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-devel

[Xen-devel] [PATCH] fix multicall state tracking

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] fix multicall state tracking
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Tue, 12 Dec 2006 13:30:31 +0000
Delivery-date: Tue, 12 Dec 2006 05:29:27 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
This replaces the previous fix to multicall state tracking so that now the 
multicall-
in-progress status is maintained on a per-VCPU basis (all other state remains
per physical CPU). This seems cleaner than the previous hack requiring clearing
of the flags in domain_crash_synchronous().

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-12-11/xen/arch/ia64/xen/hypercall.c
===================================================================
--- 2006-12-11.orig/xen/arch/ia64/xen/hypercall.c       2006-12-11 
15:09:57.000000000 +0100
+++ 2006-12-11/xen/arch/ia64/xen/hypercall.c    2006-12-11 15:15:20.000000000 
+0100
@@ -320,7 +320,7 @@ unsigned long hypercall_create_continuat
     va_list args;
 
     va_start(args, format);
-    if ( test_bit(_MCSF_in_multicall, &mcs->flags) ) {
+    if ( test_bit(_VCPUF_in_multicall, &v->vcpu_flags) ) {
        panic("PREEMPT happen in multicall\n"); // Not support yet
     } else {
        vcpu_set_gr(v, 2, op, 0);
Index: 2006-12-11/xen/arch/x86/domain.c
===================================================================
--- 2006-12-11.orig/xen/arch/x86/domain.c       2006-12-11 15:09:57.000000000 
+0100
+++ 2006-12-11/xen/arch/x86/domain.c    2006-12-11 15:15:20.000000000 +0100
@@ -811,7 +811,7 @@ unsigned long hypercall_create_continuat
 
     va_start(args, format);
 
-    if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
+    if ( test_bit(_VCPUF_in_multicall, &current->vcpu_flags) )
     {
         __set_bit(_MCSF_call_preempted, &mcs->flags);
 
Index: 2006-12-11/xen/common/domain.c
===================================================================
--- 2006-12-11.orig/xen/common/domain.c 2006-12-04 08:49:58.000000000 +0100
+++ 2006-12-11/xen/common/domain.c      2006-12-11 15:15:20.000000000 +0100
@@ -22,7 +22,6 @@
 #include <xen/delay.h>
 #include <xen/shutdown.h>
 #include <xen/percpu.h>
-#include <xen/multicall.h>
 #include <asm/debugger.h>
 #include <public/sched.h>
 #include <public/vcpu.h>
@@ -258,19 +257,6 @@ void __domain_crash_synchronous(void)
 {
     __domain_crash(current->domain);
 
-    /*
-     * Flush multicall state before dying if a multicall is in progress.
-     * This shouldn't be necessary, but some architectures are calling
-     * domain_crash_synchronous() when they really shouldn't (i.e., from
-     * within hypercall context).
-     */
-    if ( this_cpu(mc_state).flags != 0 )
-    {
-        dprintk(XENLOG_ERR,
-                "FIXME: synchronous domain crash during a multicall!\n");
-        this_cpu(mc_state).flags = 0;
-    }
-
     for ( ; ; )
         do_softirq();
 }
Index: 2006-12-11/xen/common/multicall.c
===================================================================
--- 2006-12-11.orig/xen/common/multicall.c      2006-10-30 12:07:22.000000000 
+0100
+++ 2006-12-11/xen/common/multicall.c   2006-12-11 15:15:20.000000000 +0100
@@ -19,10 +19,11 @@ long
 do_multicall(
     XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
 {
+    struct vcpu     *v = current;
     struct mc_state *mcs = &this_cpu(mc_state);
     unsigned int     i;
 
-    if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
+    if ( unlikely(test_and_set_bit(_VCPUF_in_multicall, &v->vcpu_flags)) )
     {
         gdprintk(XENLOG_INFO, "Multicall reentry is disallowed.\n");
         return -EINVAL;
@@ -66,14 +67,17 @@ do_multicall(
         guest_handle_add_offset(call_list, 1);
     }
 
+    clear_bit(_VCPUF_in_multicall, &v->vcpu_flags);
     mcs->flags = 0;
     return 0;
 
  fault:
+    clear_bit(_VCPUF_in_multicall, &v->vcpu_flags);
     mcs->flags = 0;
     return -EFAULT;
 
  preempted:
+    clear_bit(_VCPUF_in_multicall, &v->vcpu_flags);
     mcs->flags = 0;
     return hypercall_create_continuation(
         __HYPERVISOR_multicall, "hi", call_list, nr_calls-i);
Index: 2006-12-11/xen/include/xen/multicall.h
===================================================================
--- 2006-12-11.orig/xen/include/xen/multicall.h 2006-08-14 14:44:40.000000000 
+0200
+++ 2006-12-11/xen/include/xen/multicall.h      2006-12-11 15:15:20.000000000 
+0100
@@ -8,9 +8,7 @@
 #include <xen/percpu.h>
 #include <asm/multicall.h>
 
-#define _MCSF_in_multicall   0
-#define _MCSF_call_preempted 1
-#define MCSF_in_multicall    (1<<_MCSF_in_multicall)
+#define _MCSF_call_preempted 0
 #define MCSF_call_preempted  (1<<_MCSF_call_preempted)
 struct mc_state {
     unsigned long flags;
Index: 2006-12-11/xen/include/xen/sched.h
===================================================================
--- 2006-12-11.orig/xen/include/xen/sched.h     2006-11-16 14:06:41.000000000 
+0100
+++ 2006-12-11/xen/include/xen/sched.h  2006-12-11 15:15:20.000000000 +0100
@@ -399,6 +399,8 @@ extern struct domain *domain_list;
  /* VCPU affinity has changed: migrating to a new CPU. */
 #define _VCPUF_migrating       13
 #define VCPUF_migrating        (1UL<<_VCPUF_migrating)
+#define _VCPUF_in_multicall    14
+#define VCPUF_in_multicall     (1UL<<_VCPUF_in_multicall)
 
 /*
  * Per-domain flags (domain_flags).


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>