aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2010-11-16 13:01:43 +0000
committerKeir Fraser <keir@xen.org>2010-11-16 13:01:43 +0000
commit430203d65f9e17b22b4a7ba404f535a7bba1a1ff (patch)
tree7c5e2b65b59bb3eb0179fee04c5d2134f5cc8530
parent43e7d2b21a0ccfdb23de338987edf3da05d50e22 (diff)
downloadxen-430203d65f9e17b22b4a7ba404f535a7bba1a1ff.tar.gz
xen-430203d65f9e17b22b4a7ba404f535a7bba1a1ff.tar.bz2
xen-430203d65f9e17b22b4a7ba404f535a7bba1a1ff.zip
Make multicall state per-vcpu rather than per-cpu
This is a prerequisite for allowing guest descheduling within a hypercall. Signed-off-by: Keir Fraser <keir@xen.org>
-rw-r--r--xen/arch/ia64/xen/hypercall.c2
-rw-r--r--xen/arch/x86/domain.c4
-rw-r--r--xen/arch/x86/x86_64/compat/mm.c2
-rw-r--r--xen/common/domain.c13
-rw-r--r--xen/common/multicall.c3
-rw-r--r--xen/common/schedule.c1
-rw-r--r--xen/include/xen/multicall.h2
-rw-r--r--xen/include/xen/sched.h4
8 files changed, 9 insertions, 22 deletions
diff --git a/xen/arch/ia64/xen/hypercall.c b/xen/arch/ia64/xen/hypercall.c
index b3193228b6..6ea15c290a 100644
--- a/xen/arch/ia64/xen/hypercall.c
+++ b/xen/arch/ia64/xen/hypercall.c
@@ -419,7 +419,7 @@ ia64_hypercall(struct pt_regs *regs)
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...)
{
- struct mc_state *mcs = &this_cpu(mc_state);
+ struct mc_state *mcs = &current->mc_state;
struct vcpu *v = current;
const char *p = format;
unsigned long arg;
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 4c7440c0e7..87439f8de9 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1556,7 +1556,7 @@ void sync_vcpu_execstate(struct vcpu *v)
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...)
{
- struct mc_state *mcs = &this_cpu(mc_state);
+ struct mc_state *mcs = &current->mc_state;
struct cpu_user_regs *regs;
const char *p = format;
unsigned long arg;
@@ -1638,7 +1638,7 @@ unsigned long hypercall_create_continuation(
int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...)
{
int rc = 0;
- struct mc_state *mcs = &this_cpu(mc_state);
+ struct mc_state *mcs = &current->mc_state;
struct cpu_user_regs *regs;
unsigned int i, cval = 0;
unsigned long nval = 0;
diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c
index 27b6227bfe..453fbac190 100644
--- a/xen/arch/x86/x86_64/compat/mm.c
+++ b/xen/arch/x86/x86_64/compat/mm.c
@@ -308,7 +308,7 @@ int compat_mmuext_op(XEN_GUEST_HANDLE(mmuext_op_compat_t) cmp_uops,
if ( err == __HYPERVISOR_mmuext_op )
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
- struct mc_state *mcs = &this_cpu(mc_state);
+ struct mc_state *mcs = &current->mc_state;
unsigned int arg1 = !test_bit(_MCSF_in_multicall, &mcs->flags)
? regs->ecx
: mcs->call.args[1];
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 20e89ea008..69a0ab4b62 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -495,19 +495,6 @@ void __domain_crash_synchronous(void)
{
__domain_crash(current->domain);
- /*
- * Flush multicall state before dying if a multicall is in progress.
- * This shouldn't be necessary, but some architectures are calling
- * domain_crash_synchronous() when they really shouldn't (i.e., from
- * within hypercall context).
- */
- if ( this_cpu(mc_state).flags != 0 )
- {
- dprintk(XENLOG_ERR,
- "FIXME: synchronous domain crash during a multicall!\n");
- this_cpu(mc_state).flags = 0;
- }
-
vcpu_end_shutdown_deferral(current);
for ( ; ; )
diff --git a/xen/common/multicall.c b/xen/common/multicall.c
index 7ee21b47c1..58b96b28a3 100644
--- a/xen/common/multicall.c
+++ b/xen/common/multicall.c
@@ -15,7 +15,6 @@
#include <asm/hardirq.h>
#ifndef COMPAT
-DEFINE_PER_CPU(struct mc_state, mc_state);
typedef long ret_t;
#define xlat_multicall_entry(mcs)
#endif
@@ -24,7 +23,7 @@ ret_t
do_multicall(
XEN_GUEST_HANDLE(multicall_entry_t) call_list, unsigned int nr_calls)
{
- struct mc_state *mcs = &this_cpu(mc_state);
+ struct mc_state *mcs = &current->mc_state;
unsigned int i;
if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index fcf2cf4df3..905f02f89a 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -1048,7 +1048,6 @@ static void schedule(void)
struct task_slice next_slice;
ASSERT(!in_irq());
- ASSERT(this_cpu(mc_state).flags == 0);
perfc_incr(sched_run);
diff --git a/xen/include/xen/multicall.h b/xen/include/xen/multicall.h
index 34cdb4664f..0e8d8bb0ae 100644
--- a/xen/include/xen/multicall.h
+++ b/xen/include/xen/multicall.h
@@ -25,6 +25,4 @@ struct mc_state {
};
};
-DECLARE_PER_CPU(struct mc_state, mc_state);
-
#endif /* __XEN_MULTICALL_H__ */
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index ca791eb1f6..955ec99711 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -25,6 +25,7 @@
#include <public/mem_event.h>
#include <xen/cpumask.h>
#include <xen/nodemask.h>
+#include <xen/multicall.h>
#ifdef CONFIG_COMPAT
#include <compat/vcpu.h>
@@ -169,6 +170,9 @@ struct vcpu
/* Tasklet for continue_hypercall_on_cpu(). */
struct tasklet continue_hypercall_tasklet;
+ /* Multicall information. */
+ struct mc_state mc_state;
+
struct arch_vcpu arch;
};