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>
diff --git a/arch/i386/xen/multicalls.c b/arch/i386/xen/multicalls.c
index 869f983..d4015a9e 100644
--- a/arch/i386/xen/multicalls.c
+++ b/arch/i386/xen/multicalls.c
@@ -20,6 +20,7 @@
* Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
*/
#include <linux/percpu.h>
+#include <linux/hardirq.h>
#include <asm/xen/hypercall.h>
@@ -39,10 +40,12 @@
void xen_mc_flush(void)
{
- struct mc_buffer *b = &get_cpu_var(mc_buffer);
+ struct mc_buffer *b = &__get_cpu_var(mc_buffer);
int ret = 0;
unsigned long flags;
+ BUG_ON(preemptible());
+
/* Disable interrupts in case someone comes in and queues
something in the middle */
local_irq_save(flags);
@@ -60,7 +63,6 @@
} else
BUG_ON(b->argidx != 0);
- put_cpu_var(mc_buffer);
local_irq_restore(flags);
BUG_ON(ret);
@@ -68,10 +70,11 @@
struct multicall_space __xen_mc_entry(size_t args)
{
- struct mc_buffer *b = &get_cpu_var(mc_buffer);
+ struct mc_buffer *b = &__get_cpu_var(mc_buffer);
struct multicall_space ret;
unsigned argspace = (args + sizeof(u64) - 1) / sizeof(u64);
+ BUG_ON(preemptible());
BUG_ON(argspace > MC_ARGS);
if (b->mcidx == MC_BATCH ||
@@ -83,7 +86,5 @@
ret.args = &b->args[b->argidx];
b->argidx += argspace;
- put_cpu_var(mc_buffer);
-
return ret;
}