aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/xen/multicalls.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@xensource.com>2007-07-17 21:37:06 -0400
committerJeremy Fitzhardinge <jeremy@goop.org>2007-07-18 11:47:44 -0400
commitf120f13ea0dbb0b0d6675683d5f6faea71277e65 (patch)
tree6b525ab73bedfa78e43dee303ac991099377e9c5 /arch/i386/xen/multicalls.c
parentf87e4cac4f4e940b328d3deb5b53e642e3881f43 (diff)
xen: Add support for preemption
Add Xen support for preemption. This is mostly a cleanup of existing preempt_enable/disable calls, or just comments to explain the current usage. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Diffstat (limited to 'arch/i386/xen/multicalls.c')
-rw-r--r--arch/i386/xen/multicalls.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/arch/i386/xen/multicalls.c b/arch/i386/xen/multicalls.c
index 869f9833f08f..d4015a9ed46c 100644
--- a/arch/i386/xen/multicalls.c
+++ b/arch/i386/xen/multicalls.c
@@ -20,6 +20,7 @@
20 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 20 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
21 */ 21 */
22#include <linux/percpu.h> 22#include <linux/percpu.h>
23#include <linux/hardirq.h>
23 24
24#include <asm/xen/hypercall.h> 25#include <asm/xen/hypercall.h>
25 26
@@ -39,10 +40,12 @@ DEFINE_PER_CPU(unsigned long, xen_mc_irq_flags);
39 40
40void xen_mc_flush(void) 41void xen_mc_flush(void)
41{ 42{
42 struct mc_buffer *b = &get_cpu_var(mc_buffer); 43 struct mc_buffer *b = &__get_cpu_var(mc_buffer);
43 int ret = 0; 44 int ret = 0;
44 unsigned long flags; 45 unsigned long flags;
45 46
47 BUG_ON(preemptible());
48
46 /* Disable interrupts in case someone comes in and queues 49 /* Disable interrupts in case someone comes in and queues
47 something in the middle */ 50 something in the middle */
48 local_irq_save(flags); 51 local_irq_save(flags);
@@ -60,7 +63,6 @@ void xen_mc_flush(void)
60 } else 63 } else
61 BUG_ON(b->argidx != 0); 64 BUG_ON(b->argidx != 0);
62 65
63 put_cpu_var(mc_buffer);
64 local_irq_restore(flags); 66 local_irq_restore(flags);
65 67
66 BUG_ON(ret); 68 BUG_ON(ret);
@@ -68,10 +70,11 @@ void xen_mc_flush(void)
68 70
69struct multicall_space __xen_mc_entry(size_t args) 71struct multicall_space __xen_mc_entry(size_t args)
70{ 72{
71 struct mc_buffer *b = &get_cpu_var(mc_buffer); 73 struct mc_buffer *b = &__get_cpu_var(mc_buffer);
72 struct multicall_space ret; 74 struct multicall_space ret;
73 unsigned argspace = (args + sizeof(u64) - 1) / sizeof(u64); 75 unsigned argspace = (args + sizeof(u64) - 1) / sizeof(u64);
74 76
77 BUG_ON(preemptible());
75 BUG_ON(argspace > MC_ARGS); 78 BUG_ON(argspace > MC_ARGS);
76 79
77 if (b->mcidx == MC_BATCH || 80 if (b->mcidx == MC_BATCH ||
@@ -83,7 +86,5 @@ struct multicall_space __xen_mc_entry(size_t args)
83 ret.args = &b->args[b->argidx]; 86 ret.args = &b->args[b->argidx];
84 b->argidx += argspace; 87 b->argidx += argspace;
85 88
86 put_cpu_var(mc_buffer);
87
88 return ret; 89 return ret;
89} 90}