diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-12-13 11:44:23 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-12-13 11:44:23 -0500 |
commit | 4ea2c9490eaf9df55ccbfe6f4c56518fc4bdce8f (patch) | |
tree | 02ddf7315fb52960dd72654010ccc10d5833327a /litmus/litmus.c | |
parent | 2ccc2c4cc981a68e703082e6e32f5483ad87b61c (diff) |
Fix klmirqd plugin switching to not panic.
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r-- | litmus/litmus.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index fa244ba53e22..f98aa9d778a2 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -445,8 +445,8 @@ long __litmus_admit_task(struct task_struct* tsk) | |||
445 | #endif | 445 | #endif |
446 | #ifdef CONFIG_LITMUS_SOFTIRQD | 446 | #ifdef CONFIG_LITMUS_SOFTIRQD |
447 | /* not an interrupt thread by default */ | 447 | /* not an interrupt thread by default */ |
448 | tsk_rt(tsk)->is_interrupt_thread = 0; | 448 | //tsk_rt(tsk)->is_interrupt_thread = 0; |
449 | tsk_rt(tsk)->klmirqd_info = NULL; | 449 | //tsk_rt(tsk)->klmirqd_info = NULL; |
450 | #endif | 450 | #endif |
451 | 451 | ||
452 | retval = litmus->admit_task(tsk); | 452 | retval = litmus->admit_task(tsk); |
@@ -523,11 +523,6 @@ static void synch_on_plugin_switch(void* info) | |||
523 | cpu_relax(); | 523 | cpu_relax(); |
524 | } | 524 | } |
525 | 525 | ||
526 | /* Switching a plugin in use is tricky. | ||
527 | * We must watch out that no real-time tasks exists | ||
528 | * (and that none is created in parallel) and that the plugin is not | ||
529 | * currently in use on any processor (in theory). | ||
530 | */ | ||
531 | int switch_sched_plugin(struct sched_plugin* plugin) | 526 | int switch_sched_plugin(struct sched_plugin* plugin) |
532 | { | 527 | { |
533 | //unsigned long flags; | 528 | //unsigned long flags; |
@@ -535,20 +530,21 @@ int switch_sched_plugin(struct sched_plugin* plugin) | |||
535 | 530 | ||
536 | BUG_ON(!plugin); | 531 | BUG_ON(!plugin); |
537 | 532 | ||
533 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
534 | if (!klmirqd_is_dead()) { | ||
535 | kill_klmirqd(); | ||
536 | } | ||
537 | #endif | ||
538 | |||
538 | /* forbid other cpus to use the plugin */ | 539 | /* forbid other cpus to use the plugin */ |
539 | atomic_set(&cannot_use_plugin, 1); | 540 | atomic_set(&cannot_use_plugin, 1); |
540 | /* send IPI to force other CPUs to synch with us */ | 541 | /* send IPI to force other CPUs to synch with us */ |
541 | smp_call_function(synch_on_plugin_switch, NULL, 0); | 542 | smp_call_function(synch_on_plugin_switch, NULL, 0); |
542 | 543 | ||
543 | /* wait until all other CPUs have started synch */ | 544 | /* wait until all other CPUs have started synch */ |
544 | while (atomic_read(&cannot_use_plugin) < num_online_cpus()) | 545 | while (atomic_read(&cannot_use_plugin) < num_online_cpus()) { |
545 | cpu_relax(); | 546 | cpu_relax(); |
546 | |||
547 | #ifdef CONFIG_LITMUS_SOFTIRQD | ||
548 | if (!klmirqd_is_dead()) { | ||
549 | kill_klmirqd(); | ||
550 | } | 547 | } |
551 | #endif | ||
552 | 548 | ||
553 | /* stop task transitions */ | 549 | /* stop task transitions */ |
554 | //raw_spin_lock_irqsave(&task_transition_lock, flags); | 550 | //raw_spin_lock_irqsave(&task_transition_lock, flags); |
@@ -571,6 +567,7 @@ int switch_sched_plugin(struct sched_plugin* plugin) | |||
571 | out: | 567 | out: |
572 | //raw_spin_unlock_irqrestore(&task_transition_lock, flags); | 568 | //raw_spin_unlock_irqrestore(&task_transition_lock, flags); |
573 | atomic_set(&cannot_use_plugin, 0); | 569 | atomic_set(&cannot_use_plugin, 0); |
570 | |||
574 | return ret; | 571 | return ret; |
575 | } | 572 | } |
576 | 573 | ||