debug rsdl 0.33

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Con Kolivas
Date: Friday, March 23, 2007 - 4:26 pm

On Saturday 24 March 2007 08:45, Con Kolivas wrote:

Better yet this one which checks the expired array as well and after 
pull_task.

If anyone's getting a bug they think might be due to rsdl please try this (on 
rsdl 0.33).

---
 kernel/sched.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

Index: linux-2.6.21-rc4-mm1/kernel/sched.c
===================================================================
--- linux-2.6.21-rc4-mm1.orig/kernel/sched.c	2007-03-24 08:32:19.000000000 +1100
+++ linux-2.6.21-rc4-mm1/kernel/sched.c	2007-03-24 10:22:59.000000000 +1100
@@ -659,6 +659,35 @@ static inline void set_task_entitlement(
 	p->time_slice = p->quota;
 }
 
+static int debug_rqbitmap(struct rq *rq)
+{
+	struct list_head *queue;
+	int idx = 0, error = 0;
+	struct prio_array *array;
+
+	for (idx = 0; idx < MAX_PRIO; idx++) {
+		array = rq->active;
+		queue = array->queue + idx;
+		if (!list_empty(queue)) {
+			if (!test_bit(idx, rq->dyn_bitmap)) {
+				__set_bit(idx, rq->dyn_bitmap);
+				error = 1;
+				printk(KERN_ERR "MISSING DYNAMIC BIT %d\n", idx);
+			}
+		}
+		array = rq->expired;
+		queue = array->queue + idx;
+		if (!list_empty(queue)) {
+			if (!test_bit(idx, rq->exp_bitmap)) {
+				__set_bit(idx, rq->exp_bitmap);
+				error = 1;
+				printk(KERN_ERR "MISSING EXPIRED BIT %d\n", idx);
+			}
+		}
+	}
+	return error;
+}
+
 /*
  * There is no specific hard accounting. The dynamic bits can have
  * false positives. rt_tasks can only be on the active queue.
@@ -679,6 +708,7 @@ static void dequeue_task(struct task_str
 	list_del_init(&p->run_list);
 	if (list_empty(p->array->queue + p->prio))
 		__clear_bit(p->prio, p->array->prio_bitmap);
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -797,12 +827,14 @@ static void enqueue_task(struct task_str
 {
 	__enqueue_task(p, rq);
 	list_add_tail(&p->run_list, p->array->queue + p->prio);
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 static inline void enqueue_task_head(struct task_struct *p, struct rq *rq)
 {
 	__enqueue_task(p, rq);
 	list_add(&p->run_list, p->array->queue + p->prio);
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -820,6 +852,7 @@ static void requeue_task(struct task_str
 			__clear_bit(old_prio, old_array->prio_bitmap);
 		set_dynamic_bit(p, rq);
 	}
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -906,6 +939,7 @@ static inline void __activate_task(struc
 {
 	enqueue_task(p, rq);
 	inc_nr_running(p, rq);
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -1006,6 +1040,7 @@ static void deactivate_task(struct task_
 {
 	dec_nr_running(p, rq);
 	dequeue_task(p, rq);
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -1718,9 +1753,11 @@ void fastcall wake_up_new_task(struct ta
 		 * Parent and child are on different CPUs, now get the
 		 * parent runqueue to update the parent's ->flags:
 		 */
+		WARN_ON(debug_rqbitmap(rq));
 		task_rq_unlock(rq, &flags);
 		this_rq = task_rq_lock(current, &flags);
 	}
+	WARN_ON(debug_rqbitmap(this_rq));
 	task_rq_unlock(this_rq, &flags);
 }
 
@@ -2124,6 +2161,8 @@ static void pull_task(struct rq *src_rq,
 	enqueue_pulled_task(src_rq, this_rq, p);
 	p->timestamp = (p->timestamp - src_rq->most_recent_timestamp)
 				+ this_rq->most_recent_timestamp;
+	WARN_ON(debug_rqbitmap(src_rq));
+	WARN_ON(debug_rqbitmap(this_rq));
 	try_preempt(p, this_rq);
 }
 
@@ -3357,6 +3396,7 @@ static inline void major_prio_rotation(s
 	rq->dyn_bitmap = rq->active->prio_bitmap;
 	rq->best_static_prio = MAX_PRIO - 1;
 	rq->prio_rotation++;
+	WARN_ON(debug_rqbitmap(rq));
 }
 
 /*
@@ -3399,6 +3439,8 @@ static inline void rotate_runqueue_prior
 		}
 		memset(rq->prio_quota, 0, ARRAY_SIZE(rq->prio_quota));
 		major_prio_rotation(rq);
+		WARN_ON(debug_rqbitmap(rq));
+
 	} else {
 		/* Minor rotation */
 		new_prio_level = rq->prio_level + 1;
@@ -3409,6 +3451,7 @@ static inline void rotate_runqueue_prior
 			__set_bit(new_prio_level, rq->dyn_bitmap);
 		}
 		rq_quota(rq, rq->prio_level) = 0;
+		WARN_ON(debug_rqbitmap(rq));
 	}
 	rq->prio_level = new_prio_level;
 	/*
@@ -3431,6 +3474,10 @@ static void task_running_tick(struct rq 
 		return;
 
 	spin_lock(&rq->lock);
+	if (!p->time_slice) {
+		printk(KERN_ERR "NO TIME_SLICE IN TRT \n");
+		p->time_slice++;
+	}
 	/*
 	 * Accounting is performed by both the task and the runqueue. This
 	 * allows frequently sleeping tasks to get their proper quota of
@@ -3460,6 +3507,7 @@ static void task_running_tick(struct rq 
 		set_tsk_need_resched(p);
 	}
 out_unlock:
+	WARN_ON(debug_rqbitmap(rq));
 	spin_unlock(&rq->lock);
 }
 
@@ -3479,6 +3527,7 @@ void scheduler_tick(void)
 
 	if (!idle_at_tick)
 		task_running_tick(rq, p, 1);
+	WARN_ON(debug_rqbitmap(rq));
 #ifdef CONFIG_SMP
 	update_load(rq);
 	rq->idle_at_tick = idle_at_tick;
@@ -3548,6 +3597,7 @@ static inline struct task_struct *next_d
 	struct prio_array *array = rq->active;
 	int expirations = 0;
 
+	WARN_ON(debug_rqbitmap(rq));
 retry:
 	if (idx >= MAX_PRIO) {
 		BUG_ON(++expirations > 1);
@@ -3601,6 +3651,7 @@ retry:
 	if (next->static_prio < rq->best_static_prio &&
 	    next->policy != SCHED_BATCH)
 		rq->best_static_prio = next->static_prio;
+	WARN_ON(debug_rqbitmap(rq));
 	return next;
 }
 

-- 
-ck
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.21-rc4-mm1, Andrew Morton, (Mon Mar 19, 9:56 pm)
Re: 2.6.21-rc4-mm1, Michal Piotrowski, (Tue Mar 20, 12:54 am)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Tue Mar 20, 2:45 am)
Re: 2.6.21-rc4-mm1 [PATCH] init/missing_syscalls.h fix, Stephane Jourdois, (Tue Mar 20, 3:52 am)
Re: 2.6.21-rc4-mm1, Jiri Slaby, (Tue Mar 20, 7:31 am)
Re: 2.6.21-rc4-mm1, Andrew Morton, (Tue Mar 20, 9:09 am)
Re: 2.6.21-rc4-mm1, J.A. , (Tue Mar 20, 9:36 am)
Re: 2.6.21-rc4-mm1, Randy Dunlap, (Tue Mar 20, 10:31 am)
[PATCH] utrace: make an inline void, Randy Dunlap, (Tue Mar 20, 11:09 am)
Re: 2.6.21-rc4-mm1, Pavel Machek, (Tue Mar 20, 11:38 am)
Re: 2.6.21-rc4-mm1, Kees Cook, (Tue Mar 20, 12:20 pm)
Re: 2.6.21-rc4-mm1, Jiri Slaby, (Tue Mar 20, 12:40 pm)
Re: 2.6.21-rc4-mm1, Pavel Machek, (Tue Mar 20, 12:56 pm)
Re: 2.6.21-rc4-mm1, Rafael J. Wysocki, (Tue Mar 20, 1:12 pm)
Re: 2.6.21-rc4-mm1, Jiri Slaby, (Tue Mar 20, 1:13 pm)
Re: [linux-pm] 2.6.21-rc4-mm1, Pavel Machek, (Tue Mar 20, 1:21 pm)
Re: 2.6.21-rc4-mm1, Stéphane Jourdois, (Tue Mar 20, 1:42 pm)
Re: 2.6.21-rc4-mm1, Randy Dunlap, (Tue Mar 20, 1:50 pm)
Re: [linux-pm] 2.6.21-rc4-mm1, Jiri Slaby, (Tue Mar 20, 1:58 pm)
Re: [linux-pm] 2.6.21-rc4-mm1, Rafael J. Wysocki, (Tue Mar 20, 1:58 pm)
Re: 2.6.21-rc4-mm1, J.A. , (Tue Mar 20, 2:04 pm)
Re: [linux-pm] 2.6.21-rc4-mm1, Rafael J. Wysocki, (Tue Mar 20, 2:06 pm)
FireWire update in -mm (was 2.6.21-rc4-mm1), Stefan Richter, (Tue Mar 20, 4:10 pm)
Re: 2.6.21-rc4-mm1, Randy Dunlap, (Tue Mar 20, 4:49 pm)
Re: 2.6.21-rc4-mm1, J.A. , (Tue Mar 20, 5:14 pm)
Re: 2.6.21-rc4-mm1, Randy Dunlap, (Tue Mar 20, 6:47 pm)
Re: [PATCH] utrace: make an inline void, Roland McGrath, (Tue Mar 20, 6:48 pm)
Re: 2.6.21-rc4-mm1, Andrew Morton, (Tue Mar 20, 10:47 pm)
Re: 2.6.21-rc4-mm1, Reuben Farrelly, (Wed Mar 21, 3:14 am)
Re: 2.6.21-rc4-mm1, David Woodhouse, (Wed Mar 21, 4:25 am)
Re: 2.6.21-rc4-mm1, Sam Ravnborg, (Wed Mar 21, 4:59 am)
Re: 2.6.21-rc4-mm1, Greg KH, (Wed Mar 21, 11:36 am)
Re: 2.6.21-rc4-mm1: multiple definition of `queue_pushbutt ..., Kristen Carlson Accardi, (Wed Mar 21, 11:45 am)
Re: 2.6.21-rc4-mm1, Sam Ravnborg, (Wed Mar 21, 3:19 pm)
Re: 2.6.21-rc4-mm1, Andrew Morton, (Wed Mar 21, 4:01 pm)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Thu Mar 22, 1:41 am)
Re: 2.6.21-rc4-mm1, Sam Ravnborg, (Thu Mar 22, 1:54 am)
Re: 2.6.21-rc4-mm1, David Woodhouse, (Thu Mar 22, 2:17 am)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Thu Mar 22, 2:48 am)
Re: 2.6.21-rc4-mm1, Con Kolivas, (Thu Mar 22, 3:04 am)
Re: 2.6.21-rc4-mm1, Sam Ravnborg, (Thu Mar 22, 4:41 am)
Re: 2.6.21-rc4-mm1, David Woodhouse, (Thu Mar 22, 9:25 am)
Re: 2.6.21-rc4-mm1, Sam Ravnborg, (Thu Mar 22, 9:28 am)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Thu Mar 22, 10:07 am)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Thu Mar 22, 11:17 am)
Re: 2.6.21-rc4-mm1, Con Kolivas, (Thu Mar 22, 3:14 pm)
Re: 2.6.21-rc4-mm1, J.A. , (Thu Mar 22, 4:27 pm)
Re: 2.6.21-rc4-mm1, Andrew Morton, (Thu Mar 22, 6:41 pm)
Re: 2.6.21-rc4-mm1, Con Kolivas, (Thu Mar 22, 11:18 pm)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Fri Mar 23, 1:45 am)
Re: 2.6.21-rc4-mm1, Andy Whitcroft, (Fri Mar 23, 5:28 am)
Re: 2.6.21-rc4-mm1, Con Kolivas, (Fri Mar 23, 2:45 pm)
debug rsdl 0.33, Con Kolivas, (Fri Mar 23, 4:26 pm)
[-mm patch] lguest: #if 0 check_bug_kill(), Adrian Bunk, (Sat Mar 24, 6:06 am)
[-mm patch] unexport bio_{,un}map_user, Adrian Bunk, (Sat Mar 24, 6:07 am)
Re: [-mm patch] lguest: #if 0 check_bug_kill(), Rusty Russell, (Sun Mar 25, 12:33 am)
Re: debug rsdl 0.33, Andy Whitcroft, (Sun Mar 25, 5:27 am)
[-mm patch] lguest: remove check_bug_kill(), Adrian Bunk, (Sun Mar 25, 7:57 am)
Re: debug rsdl 0.33, Torsten Kaiser, (Sun Mar 25, 11:28 am)
Re: debug rsdl 0.33, Andrew Morton, (Sun Mar 25, 3:01 pm)
Re: debug rsdl 0.33, Con Kolivas, (Sun Mar 25, 3:49 pm)
Re: debug rsdl 0.33, Con Kolivas, (Sun Mar 25, 3:59 pm)
Re: debug rsdl 0.33, Andy Whitcroft, (Mon Mar 26, 12:49 am)
Re: debug rsdl 0.33, Andy Whitcroft, (Mon Mar 26, 8:28 am)
Re: debug rsdl 0.33, Con Kolivas, (Mon Mar 26, 9:12 am)
Re: 2.6.21-rc4-mm1, Jean Delvare, (Mon Mar 26, 12:35 pm)
Re: 2.6.21-rc4-mm1, Badari Pulavarty, (Mon Mar 26, 12:47 pm)
Re: 2.6.21-rc4-mm1, Badari Pulavarty, (Mon Mar 26, 1:05 pm)
Re: 2.6.21-rc4-mm1, J.A. , (Mon Mar 26, 1:31 pm)
Re: 2.6.21-rc4-mm1, Badari Pulavarty, (Mon Mar 26, 2:57 pm)
Re: 2.6.21-rc4-mm1, Andrew Morton, (Mon Mar 26, 3:22 pm)
Re: 2.6.21-rc4-mm1, Greg KH, (Mon Mar 26, 4:26 pm)
Re: 2.6.21-rc4-mm1, Paul Mackerras, (Mon Mar 26, 4:29 pm)
Re: 2.6.21-rc4-mm1, Badari Pulavarty, (Mon Mar 26, 4:43 pm)