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

[Xen-changelog] [xen-unstable] linux: simplify and perform checking of multicall status



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175766230 -3600
# Node ID 602d061ff51f50d7b46bd5ca78c4b70fbe809d20
# Parent  556402cdf011d9bc234e876da6d54bfa77e0f0fb
linux: simplify and perform checking of multicall status
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c                   |    8 +--
 linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c            |    1 
 linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c             |    6 +-
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h   |    2 
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h  |    2 
 linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h               |    2 
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h |    2 
 linux-2.6-xen-sparse/include/xen/hvm.h                           |    1 
 linux-2.6-xen-sparse/include/xen/hypercall.h                     |   24 
++++++++++
 9 files changed, 36 insertions(+), 12 deletions(-)

diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c
--- a/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c    Wed Apr 04 18:50:11 
2007 +0100
+++ b/linux-2.6-xen-sparse/arch/i386/mm/hypervisor.c    Thu Apr 05 10:43:50 
2007 +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);
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c
--- a/linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c     Wed Apr 04 
18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/core/machine_kexec.c     Thu Apr 05 
10:43:50 2007 +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);
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Wed Apr 04 
18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c      Thu Apr 05 
10:43:50 2007 +0100
@@ -1511,7 +1511,7 @@ static void netif_release_rx_bufs(struct
        struct sk_buff *skb;
        unsigned long mfn;
        int xfer = 0, noxfer = 0, unused = 0;
-       int id, ref;
+       int id, ref, rc;
 
        if (np->copying_receiver) {
                WPRINTK("%s: fix me for copying receiver.\n", __FUNCTION__);
@@ -1579,7 +1579,9 @@ 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);
+                       rc = HYPERVISOR_multicall_check(
+                               np->rx_mcl, mcl - np->rx_mcl, NULL);
+                       BUG_ON(rc);
                }
        }
 
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Wed Apr 
04 18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypercall.h    Thu Apr 
05 10:43:50 2007 +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);
 }
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Wed Apr 
04 18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/hypervisor.h   Thu Apr 
05 10:43:50 2007 +0100
@@ -128,7 +128,7 @@ u64 jiffies_to_st(unsigned long jiffies)
 #define scrub_pages(_p,_n) ((void)0)
 #endif
 
-#include <asm/hypercall.h>
+#include <xen/hypercall.h>
 
 #if defined(CONFIG_X86_64)
 #define MULTI_UVMFLAGS_INDEX 2
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h
--- a/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Wed Apr 04 
18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-ia64/hypervisor.h        Thu Apr 05 
10:43:50 2007 +0100
@@ -55,7 +55,7 @@ extern int running_on_xen;
 #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>
 
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Wed Apr 
04 18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/hypercall.h  Thu Apr 
05 10:43:50 2007 +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);
 }
diff -r 556402cdf011 -r 602d061ff51f linux-2.6-xen-sparse/include/xen/hvm.h
--- a/linux-2.6-xen-sparse/include/xen/hvm.h    Wed Apr 04 18:50:11 2007 +0100
+++ b/linux-2.6-xen-sparse/include/xen/hvm.h    Thu Apr 05 10:43:50 2007 +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)
 {
diff -r 556402cdf011 -r 602d061ff51f 
linux-2.6-xen-sparse/include/xen/hypercall.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/linux-2.6-xen-sparse/include/xen/hypercall.h      Thu Apr 05 10:43:50 
2007 +0100
@@ -0,0 +1,24 @@
+#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;
+       BUG_ON(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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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