[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.