aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/hypervisor.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-11-24 13:29:20 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-11-24 13:29:20 +0000
commit26aa688655105f22dc67bb98c5def9a2fb1209e3 (patch)
tree37ad75ea8a6ef84970928a26c2449071cc8e8d52 /extras/mini-os/hypervisor.c
parentcf64298141ead63b0b72fdee091d62f1148e89e1 (diff)
downloadxen-26aa688655105f22dc67bb98c5def9a2fb1209e3.tar.gz
xen-26aa688655105f22dc67bb98c5def9a2fb1209e3.tar.bz2
xen-26aa688655105f22dc67bb98c5def9a2fb1209e3.zip
[Mini-OS] Make sure schedule() is called safely
If a thread tries to sleep from a callback or with callbacks disabled, Mini-OS will completely lock, so make sure this never happens. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Diffstat (limited to 'extras/mini-os/hypervisor.c')
-rw-r--r--extras/mini-os/hypervisor.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/extras/mini-os/hypervisor.c b/extras/mini-os/hypervisor.c
index ed87845195..e84d34ccaf 100644
--- a/extras/mini-os/hypervisor.c
+++ b/extras/mini-os/hypervisor.c
@@ -33,6 +33,8 @@
((sh)->evtchn_pending[idx] & \
~(sh)->evtchn_mask[idx])
+int in_callback;
+
void do_hypervisor_callback(struct pt_regs *regs)
{
unsigned long l1, l2, l1i, l2i;
@@ -41,6 +43,7 @@ void do_hypervisor_callback(struct pt_regs *regs)
shared_info_t *s = HYPERVISOR_shared_info;
vcpu_info_t *vcpu_info = &s->vcpu_info[cpu];
+ in_callback = 1;
vcpu_info->evtchn_upcall_pending = 0;
/* NB. No need for a barrier here -- XCHG is a barrier on x86. */
@@ -59,6 +62,8 @@ void do_hypervisor_callback(struct pt_regs *regs)
do_event(port, regs);
}
}
+
+ in_callback = 0;
}