diff options
| author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-12-07 14:31:07 -0500 |
|---|---|---|
| committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-12-07 14:39:40 -0500 |
| commit | e5e0247f927753dc0f22c84773aa48a0beb0d8f9 (patch) | |
| tree | ff708cd87a4e526f8f942fb062287b9370f85603 | |
| parent | 63537c738e7eb0ad6bc064b5e47c88092897c1cb (diff) | |
Send reboot notifications to Litmus
This patch causes reboot notifications to be send
to Litmus. With this patch, Litmus attempts to
switch back to the Linux-plugin before the reboot
proceeds. Any failures to switch back are reported
via printk() (the reboot is not halted).
| -rw-r--r-- | litmus/litmus.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index c842de46587b..9c6b738ab99d 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/slab.h> | 11 | #include <linux/slab.h> |
| 12 | #include <linux/reboot.h> | ||
| 12 | 13 | ||
| 13 | #include <litmus/litmus.h> | 14 | #include <litmus/litmus.h> |
| 14 | #include <litmus/bheap.h> | 15 | #include <litmus/bheap.h> |
| @@ -528,6 +529,25 @@ static struct sysrq_key_op sysrq_kill_rt_tasks_op = { | |||
| 528 | 529 | ||
| 529 | extern struct sched_plugin linux_sched_plugin; | 530 | extern struct sched_plugin linux_sched_plugin; |
| 530 | 531 | ||
| 532 | static int litmus_shutdown_nb(struct notifier_block *unused1, | ||
| 533 | unsigned long unused2, void *unused3) | ||
| 534 | { | ||
| 535 | /* Attempt to switch back to regular Linux scheduling. | ||
| 536 | * Forces the active plugin to clean up. | ||
| 537 | */ | ||
| 538 | if (litmus != &linux_sched_plugin) { | ||
| 539 | int ret = switch_sched_plugin(&linux_sched_plugin); | ||
| 540 | if (ret) { | ||
| 541 | printk("Auto-shutdown of active Litmus plugin failed.\n"); | ||
| 542 | } | ||
| 543 | } | ||
| 544 | return NOTIFY_DONE; | ||
| 545 | } | ||
| 546 | |||
| 547 | static struct notifier_block shutdown_notifier = { | ||
| 548 | .notifier_call = litmus_shutdown_nb, | ||
| 549 | }; | ||
| 550 | |||
| 531 | static int __init _init_litmus(void) | 551 | static int __init _init_litmus(void) |
| 532 | { | 552 | { |
| 533 | /* Common initializers, | 553 | /* Common initializers, |
| @@ -555,11 +575,15 @@ static int __init _init_litmus(void) | |||
| 555 | init_topology(); | 575 | init_topology(); |
| 556 | #endif | 576 | #endif |
| 557 | 577 | ||
| 578 | register_reboot_notifier(&shutdown_notifier); | ||
| 579 | |||
| 558 | return 0; | 580 | return 0; |
| 559 | } | 581 | } |
| 560 | 582 | ||
| 561 | static void _exit_litmus(void) | 583 | static void _exit_litmus(void) |
| 562 | { | 584 | { |
| 585 | unregister_reboot_notifier(&shutdown_notifier); | ||
| 586 | |||
| 563 | exit_litmus_proc(); | 587 | exit_litmus_proc(); |
| 564 | kmem_cache_destroy(bheap_node_cache); | 588 | kmem_cache_destroy(bheap_node_cache); |
| 565 | kmem_cache_destroy(release_heap_cache); | 589 | kmem_cache_destroy(release_heap_cache); |
