aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-02-19 10:36:42 -0500
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-02-19 10:43:23 -0500
commite7c1feeb9f7beb971be3c79f0b236ada78955372 (patch)
treef9c571aae307cefcfb6984e307ea55ded85aa889
parent0371d837d973073c08dc20f4a2f262cfefa7b0b7 (diff)
Bugfix: C-EDF init when num online Cpus less than min cluster size
If the number of online Cpus is less than the minimum cluster size (currently set to 4), it is pointless to load C-EDF plugin. This fixes the following memory corruption problem reported by Bjoern: It always hangs after initializing Feather-Trace. [ 0.151575] TCP bind hash table entries: 65536 (order: 9, 3670016 bytes) [ 0.163623] TCP: Hash tables configured (established 262144 bind 65536) [ 0.164728] TCP reno registered [ 0.165667] NET: Registered protocol family 1 [ 0.166383] pci 0000:00:00.0: Limiting direct PCI/PCI transfers [ 0.167319] pci 0000:00:01.0: PIIX3: Enabling Passive Release [ 0.168270] pci 0000:00:01.0: Activating ISA DMA hang workarounds [ 0.181699] NTFS driver 2.1.29 [Flags: R/W]. [ 0.182751] msgmni has been set to 3868 [ 0.184463] alg: No test for cipher_null (cipher_null-generic) [ 0.185464] alg: No test for ecb(cipher_null) (ecb-cipher_null) [ 0.186430] alg: No test for digest_null (digest_null-generic) [ 0.187387] alg: No test for compress_null (compress_null-generic) [ 0.190236] alg: No test for fcrypt (fcrypt-generic) [ 0.193586] alg: No test for stdrng (krng) [ 0.202158] alg: No test for ghash (ghash-generic) [ 0.202969] io scheduler noop registered [ 0.203615] io scheduler anticipatory registered [ 0.204324] io scheduler deadline registered [ 0.205019] io scheduler cfq registered (default) [ 0.205749] Starting LITMUS^RT kernel [ 0.206302] Registering LITMUS^RT plugin Linux. [ 0.207066] Registered kill rt tasks magic sysrq. [ 0.207862] Initializing SRP per-CPU ceilings... done! [ 0.208696] Initializing LITMUS^RT control device. [ 0.209539] Registering LITMUS^RT plugin GSN-EDF. [ 0.210291] Registering LITMUS^RT plugin PSN-EDF. [ 0.211029] Registering LITMUS^RT plugin C-EDF. [ 0.211837] Registering LITMUS^RT plugin PFAIR. [ 0.212611] Initializing TRACE() device [ 0.213209] Registered dump-trace-buffer(Y) magic sysrq. [ 0.214027] Initializing Feather-Trace overhead tracing device. I've attached with GDB and got the following stacktrace: (gdb) target remote localhost:1234 Remote debugging using localhost:1234 [New Thread 1] delay_tsc (loops=2127684) at arch/x86/lib/delay.c:62 62 rdtscl(now); (gdb) bt at kernel/panic.c:138 at kernel/exit.c:722 signr=1) at arch/x86/kernel/dumpstack.c:244 str=0xffffffff815e78b1 "general protection fault", regs=0xffff88007c8e19a8, err=0) at arch/x86/kernel/dumpstack.c:303 error_code=0) at arch/x86/kernel/traps.c:308 (gdb) quit So we got some memory corruption, and even the panic() fails. According to git bisect, the problem appeared in: 6834f41a1aa2f92e5b7ca6ae8c80b6fee0fa1208 is the first bad commit
-rw-r--r--litmus/sched_cedf.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index f37d5f67a308..d0767ce9e178 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -112,6 +112,8 @@ cpu_entry_t* *cedf_cpu_entries_array;
112 */ 112 */
113int cluster_size = 4; 113int cluster_size = 4;
114 114
115int do_cleanup = 1;
116
115typedef struct { 117typedef struct {
116 rt_domain_t domain; 118 rt_domain_t domain;
117 int first_cpu; 119 int first_cpu;
@@ -667,6 +669,19 @@ static int __init init_cedf(void)
667 int cpu; 669 int cpu;
668 cpu_entry_t *entry; 670 cpu_entry_t *entry;
669 671
672 /* num_online_cpus() should have been set already
673 * if the number of available cpus is less then the cluster
674 * size (currently 4) then it is pointless trying to use
675 * CEDF, so we disable this plugin
676 */
677 if(num_online_cpus() < cluster_size) {
678 printk(KERN_INFO "Not registering C-EDF plugin: "
679 "Num Online Cpus (%d) < Min Cluster Size (%d)\n",
680 num_online_cpus(), cluster_size);
681 do_cleanup = 0;
682 return 0;
683 }
684
670 /* 685 /*
671 * initialize short_cut for per-cpu cedf state; 686 * initialize short_cut for per-cpu cedf state;
672 * there may be a problem here if someone removes a cpu 687 * there may be a problem here if someone removes a cpu
@@ -701,8 +716,10 @@ static int __init init_cedf(void)
701 716
702static void clean_cedf(void) 717static void clean_cedf(void)
703{ 718{
704 kfree(cedf_cpu_entries_array); 719 if(do_cleanup) {
705 kfree(cedf_domains_array); 720 kfree(cedf_cpu_entries_array);
721 kfree(cedf_domains_array);
722 }
706} 723}
707 724
708module_init(init_cedf); 725module_init(init_cedf);