aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/xen/smp.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@xensource.com>2007-10-16 14:51:30 -0400
committerJeremy Fitzhardinge <jeremy@goop.org>2007-10-16 14:51:30 -0400
commitf0d733942750c1ee6358c3a4a1a5d7ba73b7122f (patch)
tree32d0802b60078b6a2f43ce19d9019033ada6485d /arch/x86/xen/smp.c
parentd626a1f1cbbdfac90c529216e40a4fa2a22ecc3d (diff)
xen: yield to IPI target if necessary
When sending a call-function IPI to a vcpu, yield if the vcpu isn't running. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Diffstat (limited to 'arch/x86/xen/smp.c')
-rw-r--r--arch/x86/xen/smp.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 557b8e24706a..865953e6f341 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -360,7 +360,8 @@ int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *),
360 void *info, int wait) 360 void *info, int wait)
361{ 361{
362 struct call_data_struct data; 362 struct call_data_struct data;
363 int cpus; 363 int cpus, cpu;
364 bool yield;
364 365
365 /* Holding any lock stops cpus from going down. */ 366 /* Holding any lock stops cpus from going down. */
366 spin_lock(&call_lock); 367 spin_lock(&call_lock);
@@ -389,9 +390,14 @@ int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *),
389 /* Send a message to other CPUs and wait for them to respond */ 390 /* Send a message to other CPUs and wait for them to respond */
390 xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR); 391 xen_send_IPI_mask(mask, XEN_CALL_FUNCTION_VECTOR);
391 392
392 /* Make sure other vcpus get a chance to run. 393 /* Make sure other vcpus get a chance to run if they need to. */
393 XXX too severe? Maybe we should check the other CPU's states? */ 394 yield = false;
394 HYPERVISOR_sched_op(SCHEDOP_yield, 0); 395 for_each_cpu_mask(cpu, mask)
396 if (xen_vcpu_stolen(cpu))
397 yield = true;
398
399 if (yield)
400 HYPERVISOR_sched_op(SCHEDOP_yield, 0);
395 401
396 /* Wait for response */ 402 /* Wait for response */
397 while (atomic_read(&data.started) != cpus || 403 while (atomic_read(&data.started) != cpus ||