aboutsummaryrefslogtreecommitdiffstats
path: root/litmus
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-11-19 06:52:08 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-20 18:15:14 -0500
commitd40413efabc0ab388f6ed83f48b28dc253d47238 (patch)
treee4f95dc9e239bf926c23e7f27e05c8e123397411 /litmus
parent1726017e944d0086f14f867befbf5ebf07adc7dd (diff)
Bugfix: synchronize with all other CPUs before switching plugin
The CPU triggering the plugin switch should wait until all other CPUs are in a proper state (synch_on_plugin_switch()) before performing the actual switch. Based on the original patch from Jeremy Erickson <jerickso@cs.unc.edu>. This should solve (for most practical cases) the C-EDF-related plugin-switch problem reported on the ML.
Diffstat (limited to 'litmus')
-rw-r--r--litmus/litmus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 0756d0156f8f..8efd3f9ef7ee 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -382,7 +382,8 @@ void litmus_exit_task(struct task_struct* tsk)
382/* IPI callback to synchronize plugin switching */ 382/* IPI callback to synchronize plugin switching */
383static void synch_on_plugin_switch(void* info) 383static void synch_on_plugin_switch(void* info)
384{ 384{
385 while (atomic_read(&cannot_use_plugin)) 385 atomic_inc(&cannot_use_plugin);
386 while (atomic_read(&cannot_use_plugin) > 0)
386 cpu_relax(); 387 cpu_relax();
387} 388}
388 389
@@ -403,6 +404,10 @@ int switch_sched_plugin(struct sched_plugin* plugin)
403 /* send IPI to force other CPUs to synch with us */ 404 /* send IPI to force other CPUs to synch with us */
404 smp_call_function(synch_on_plugin_switch, NULL, 0); 405 smp_call_function(synch_on_plugin_switch, NULL, 0);
405 406
407 /* wait until all other CPUs have started synch */
408 while (atomic_read(&cannot_use_plugin) < num_online_cpus())
409 cpu_relax();
410
406 /* stop task transitions */ 411 /* stop task transitions */
407 raw_spin_lock_irqsave(&task_transition_lock, flags); 412 raw_spin_lock_irqsave(&task_transition_lock, flags);
408 413