aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.21-pre4-sparse/include
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-03-15 00:16:44 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2003-03-15 00:16:44 +0000
commit998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb (patch)
treedae6b6e851344579442d3bb7b920cd7511854b0c /xenolinux-2.4.21-pre4-sparse/include
parentb500121df2e813156a8fe6220c1e0917be35744e (diff)
downloadxen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.tar.gz
xen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.tar.bz2
xen-998e4cfacfe9217a1d96e9300fbce22cf7e8b6bb.zip
bitkeeper revision 1.131 (3e7270ecL24hQl_PjDBYoS8hhB8GTA)
multicall.h: new file Many files: Multicall now available, so that Xen syscalls can be batched to amortise cost of trap to ring 0. Used by xenolinux to reduce the cost of a context switch.
Diffstat (limited to 'xenolinux-2.4.21-pre4-sparse/include')
-rw-r--r--xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h37
-rw-r--r--xenolinux-2.4.21-pre4-sparse/include/asm-xeno/mmu_context.h10
-rw-r--r--xenolinux-2.4.21-pre4-sparse/include/asm-xeno/multicall.h45
3 files changed, 82 insertions, 10 deletions
diff --git a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h
index 16f37cfe65..4b9591102c 100644
--- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h
+++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/hypervisor.h
@@ -129,6 +129,7 @@ static inline int flush_page_update_queue(void)
return idx;
}
#define XENO_flush_page_update_queue() (_flush_page_update_queue())
+void MULTICALL_flush_page_update_queue(void);
/*
@@ -183,14 +184,24 @@ static inline int HYPERVISOR_set_gdt(unsigned long *frame_list, int entries)
return ret;
}
-static inline int HYPERVISOR_stack_and_ldt_switch(
- unsigned long ss, unsigned long esp, unsigned long ldts)
+static inline int HYPERVISOR_stack_switch(unsigned long ss, unsigned long esp)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
- : "=a" (ret) : "0" (__HYPERVISOR_stack_and_ldt_switch),
- "b" (ss), "c" (esp), "d" (ldts) );
+ : "=a" (ret) : "0" (__HYPERVISOR_stack_switch),
+ "b" (ss), "c" (esp) : "memory" );
+
+ return ret;
+}
+
+static inline int HYPERVISOR_ldt_switch(unsigned long ldts)
+{
+ int ret;
+ __asm__ __volatile__ (
+ TRAP_INSTR
+ : "=a" (ret) : "0" (__HYPERVISOR_ldt_switch),
+ "b" (ldts) : "memory" );
return ret;
}
@@ -215,13 +226,12 @@ static inline int HYPERVISOR_fpu_taskswitch(void)
return ret;
}
-static inline int HYPERVISOR_do_sched_op(void *sched_op)
+static inline int HYPERVISOR_yield(void)
{
int ret;
__asm__ __volatile__ (
TRAP_INSTR
- : "=a" (ret) : "0" (__HYPERVISOR_sched_op),
- "b" (sched_op) );
+ : "=a" (ret) : "0" (__HYPERVISOR_yield) );
return ret;
}
@@ -296,7 +306,7 @@ static inline int HYPERVISOR_update_descriptor(
int ret;
__asm__ __volatile__ (
TRAP_INSTR
- : "=a" (ret) : "0" (__HYPERVISOR_set_gdt),
+ : "=a" (ret) : "0" (__HYPERVISOR_update_descriptor),
"b" (pa), "c" (word1), "d" (word2) );
return ret;
@@ -324,4 +334,15 @@ static inline int HYPERVISOR_dom_mem_op(void *dom_mem_op)
return ret;
}
+static inline int HYPERVISOR_multicall(void *call_list, int nr_calls)
+{
+ int ret;
+ __asm__ __volatile__ (
+ TRAP_INSTR
+ : "=a" (ret) : "0" (__HYPERVISOR_multicall),
+ "b" (call_list), "c" (nr_calls) : "memory" );
+
+ return ret;
+}
+
#endif /* __HYPERVISOR_H__ */
diff --git a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/mmu_context.h b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/mmu_context.h
index c5b3cdcd61..ad07796f95 100644
--- a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/mmu_context.h
+++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/mmu_context.h
@@ -5,6 +5,7 @@
#include <asm/desc.h>
#include <asm/atomic.h>
#include <asm/pgalloc.h>
+#include <asm/multicall.h>
/*
* possibly do the LDT unload here?
@@ -33,6 +34,7 @@ extern pgd_t *cur_pgd;
static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk, unsigned cpu)
{
+ cli(); /* protect flush_update_queue multicall */
if (prev != next) {
/* stop flush ipis for the previous mm */
clear_bit(cpu, &prev->cpu_vm_mask);
@@ -50,7 +52,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
/* Re-load page tables */
cur_pgd = next->pgd;
queue_pt_switch(__pa(cur_pgd));
- XENO_flush_page_update_queue();
+ MULTICALL_flush_page_update_queue();
}
#ifdef CONFIG_SMP
else {
@@ -70,6 +72,10 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, str
}
#define activate_mm(prev, next) \
- switch_mm((prev),(next),NULL,smp_processor_id())
+do { \
+ switch_mm((prev),(next),NULL,smp_processor_id()); \
+ execute_multicall_list(); \
+ sti(); /* matches 'cli' in switch_mm() */ \
+} while ( 0 )
#endif
diff --git a/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/multicall.h b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/multicall.h
new file mode 100644
index 0000000000..27126dcaac
--- /dev/null
+++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/multicall.h
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * multicall.h
+ */
+
+#ifndef __MULTICALL_H__
+#define __MULTICALL_H__
+
+#include <asm/hypervisor.h>
+
+extern multicall_entry_t multicall_list[];
+extern int nr_multicall_ents;
+
+static inline void queue_multicall0(unsigned long op)
+{
+ int i = nr_multicall_ents;
+ multicall_list[i].op = op;
+ nr_multicall_ents = i+1;
+}
+
+static inline void queue_multicall1(unsigned long op, unsigned long arg1)
+{
+ int i = nr_multicall_ents;
+ multicall_list[i].op = op;
+ multicall_list[i].args[0] = arg1;
+ nr_multicall_ents = i+1;
+}
+
+static inline void queue_multicall2(
+ unsigned long op, unsigned long arg1, unsigned long arg2)
+{
+ int i = nr_multicall_ents;
+ multicall_list[i].op = op;
+ multicall_list[i].args[0] = arg1;
+ multicall_list[i].args[1] = arg2;
+ nr_multicall_ents = i+1;
+}
+
+static inline void execute_multicall_list(void)
+{
+ if ( unlikely(nr_multicall_ents == 0) ) return;
+ (void)HYPERVISOR_multicall(multicall_list, nr_multicall_ents);
+ nr_multicall_ents = 0;
+}
+
+#endif /* __MULTICALL_H__ */