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] linux: simplify and perform checking of multicall st

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux: simplify and perform checking of multicall status
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 26 Mar 2007 15:54:43 +0100
Delivery-date: Mon, 26 Mar 2007 07:53:13 -0700
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
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-03-19/arch/i386/mm/hypervisor.c
===================================================================
--- head-2007-03-19.orig/arch/i386/mm/hypervisor.c      2007-03-23 
16:21:22.000000000 +0100
+++ head-2007-03-19/arch/i386/mm/hypervisor.c   2007-03-23 16:30:29.000000000 
+0100
@@ -303,7 +303,7 @@ int xen_create_contiguous_region(
                set_phys_to_machine((__pa(vstart)>>PAGE_SHIFT)+i,
                        INVALID_P2M_ENTRY);
        }
-       if (HYPERVISOR_multicall(cr_mcl, i))
+       if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
                BUG();
 
        /* 2. Get a new contiguous memory extent. */
@@ -342,7 +342,7 @@ int xen_create_contiguous_region(
        cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order
                                                   ? UVMF_TLB_FLUSH|UVMF_ALL
                                                   : UVMF_INVLPG|UVMF_ALL;
-       if (HYPERVISOR_multicall(cr_mcl, i))
+       if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
                BUG();
 
        if (success)
@@ -400,7 +400,7 @@ void xen_destroy_contiguous_region(unsig
                        INVALID_P2M_ENTRY);
                out_frames[i] = (__pa(vstart) >> PAGE_SHIFT) + i;
        }
-       if (HYPERVISOR_multicall(cr_mcl, i))
+       if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
                BUG();
 
        /* 3. Do the exchange for non-contiguous MFNs. */
@@ -432,7 +432,7 @@ void xen_destroy_contiguous_region(unsig
        cr_mcl[i - 1].args[MULTI_UVMFLAGS_INDEX] = order
                                                   ? UVMF_TLB_FLUSH|UVMF_ALL
                                                   : UVMF_INVLPG|UVMF_ALL;
-       if (HYPERVISOR_multicall(cr_mcl, i))
+       if (HYPERVISOR_multicall_check(cr_mcl, i, NULL))
                BUG();
 
        balloon_unlock(flags);
Index: head-2007-03-19/drivers/xen/core/machine_kexec.c
===================================================================
--- head-2007-03-19.orig/drivers/xen/core/machine_kexec.c       2007-03-23 
16:21:22.000000000 +0100
+++ head-2007-03-19/drivers/xen/core/machine_kexec.c    2007-03-21 
11:54:05.000000000 +0100
@@ -7,7 +7,6 @@
 #include <xen/interface/kexec.h>
 #include <linux/mm.h>
 #include <linux/bootmem.h>
-#include <asm/hypercall.h>
 
 extern void machine_kexec_setup_load_arg(xen_kexec_image_t *xki, 
                                         struct kimage *image);
Index: head-2007-03-19/drivers/xen/netback/netback.c
===================================================================
--- head-2007-03-19.orig/drivers/xen/netback/netback.c  2007-03-23 
16:21:22.000000000 +0100
+++ head-2007-03-19/drivers/xen/netback/netback.c       2007-03-23 
11:54:05.000000000 +0100
@@ -615,8 +615,9 @@ static void net_rx_action(unsigned long 
        BUG_ON(npo.mcl_prod > NET_RX_RING_SIZE+3);
        BUG_ON(npo.meta_prod > NET_RX_RING_SIZE);
 
-       ret = HYPERVISOR_multicall(npo.mcl, npo.mcl_prod);
-       BUG_ON(ret != 0);
+       ret = HYPERVISOR_multicall_check(npo.mcl, npo.mcl_prod, NULL);
+       BUG_ON(ret < 0);
+       WARN_ON(ret > 0);
 
        while ((skb = __skb_dequeue(&rxq)) != NULL) {
                nr_frags = *(int *)skb->cb;
Index: head-2007-03-19/drivers/xen/netfront/netfront.c
===================================================================
--- head-2007-03-19.orig/drivers/xen/netfront/netfront.c        2007-03-23 
16:21:22.000000000 +0100
+++ head-2007-03-19/drivers/xen/netfront/netfront.c     2007-03-23 
16:03:40.000000000 +0100
@@ -1579,7 +1579,8 @@ static void netif_release_rx_bufs(struct
                        mcl->args[2] = 0;
                        mcl->args[3] = DOMID_SELF;
                        mcl++;
-                       HYPERVISOR_multicall(np->rx_mcl, mcl - np->rx_mcl);
+                       if (HYPERVISOR_multicall_check(np->rx_mcl, mcl - 
np->rx_mcl, NULL))
+                               BUG();
                }
        }
 
Index: head-2007-03-19/include/asm-i386/mach-xen/asm/hypercall.h
===================================================================
--- head-2007-03-19.orig/include/asm-i386/mach-xen/asm/hypercall.h      
2007-03-23 16:21:22.000000000 +0100
+++ head-2007-03-19/include/asm-i386/mach-xen/asm/hypercall.h   2007-03-21 
11:54:05.000000000 +0100
@@ -238,7 +238,7 @@ HYPERVISOR_memory_op(
 
 static inline int
 HYPERVISOR_multicall(
-       void *call_list, int nr_calls)
+       multicall_entry_t *call_list, int nr_calls)
 {
        return _hypercall2(int, multicall, call_list, nr_calls);
 }
Index: head-2007-03-19/include/asm-i386/mach-xen/asm/hypervisor.h
===================================================================
--- head-2007-03-19.orig/include/asm-i386/mach-xen/asm/hypervisor.h     
2007-03-23 16:21:22.000000000 +0100
+++ head-2007-03-19/include/asm-i386/mach-xen/asm/hypervisor.h  2007-03-21 
11:54:05.000000000 +0100
@@ -122,7 +122,7 @@ void xen_destroy_contiguous_region(
 /* Turn jiffies into Xen system time. */
 u64 jiffies_to_st(unsigned long jiffies);
 
-#include <asm/hypercall.h>
+#include <xen/hypercall.h>
 
 #if defined(CONFIG_X86_64)
 #define MULTI_UVMFLAGS_INDEX 2
Index: head-2007-03-19/include/asm-ia64/hypervisor.h
===================================================================
--- head-2007-03-19.orig/include/asm-ia64/hypervisor.h
+++ head-2007-03-19/include/asm-ia64/hypervisor.h
@@ -55,7 +55,7 @@ void xen_destroy_contiguous_region(
 #include <xen/interface/event_channel.h>
 #include <xen/interface/physdev.h>
 #include <xen/interface/sched.h>
-#include <asm/hypercall.h>
+#include <xen/hypercall.h>
 #include <asm/ptrace.h>
 #include <asm/page.h>
 
Index: head-2007-03-19/include/asm-x86_64/mach-xen/asm/hypercall.h
===================================================================
--- head-2007-03-19.orig/include/asm-x86_64/mach-xen/asm/hypercall.h    
2007-03-23 16:21:22.000000000 +0100
+++ head-2007-03-19/include/asm-x86_64/mach-xen/asm/hypercall.h 2007-03-21 
11:54:05.000000000 +0100
@@ -241,7 +241,7 @@ HYPERVISOR_memory_op(
 
 static inline int
 HYPERVISOR_multicall(
-       void *call_list, int nr_calls)
+       multicall_entry_t *call_list, int nr_calls)
 {
        return _hypercall2(int, multicall, call_list, nr_calls);
 }
Index: head-2007-03-19/include/xen/hvm.h
===================================================================
--- head-2007-03-19.orig/include/xen/hvm.h      2007-03-23 16:21:22.000000000 
+0100
+++ head-2007-03-19/include/xen/hvm.h   2007-03-21 11:54:05.000000000 +0100
@@ -3,7 +3,6 @@
 #define XEN_HVM_H__
 
 #include <xen/interface/hvm/params.h>
-#include <asm/hypercall.h>
 
 static inline unsigned long hvm_get_parameter(int idx)
 {
Index: head-2007-03-19/include/xen/hypercall.h
===================================================================
--- /dev/null   1970-01-01 00:00:00.000000000 +0000
+++ head-2007-03-19/include/xen/hypercall.h     2007-03-23 16:25:06.000000000 
+0100
@@ -0,0 +1,23 @@
+#ifndef __XEN_HYPERCALL_H__
+#define __XEN_HYPERCALL_H__
+
+#include <asm/hypercall.h>
+
+static inline int
+HYPERVISOR_multicall_check(
+       multicall_entry_t *call_list, int nr_calls,
+       const unsigned long *rc_list)
+{
+       int rc = HYPERVISOR_multicall(call_list, nr_calls);
+
+       if (unlikely(rc == 0))
+               return rc;
+
+       for ( ; nr_calls > 0; --nr_calls, ++call_list)
+               if (unlikely(call_list->result != (rc_list ? *rc_list++ : 0)))
+                       return nr_calls;
+
+       return 0;
+}
+
+#endif /* __XEN_HYPERCALL_H__ */



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux: simplify and perform checking of multicall status, Jan Beulich <=