mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 4/4] rt_mutex: possible bugfixes
@ 2005-05-09 14:40 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2005-05-09 14:40 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Daniel Walker, Inaky Perez-Gonzalez

This is my first look at the kernel/rt.c, so I am probably very wrong.


pi_setprio()
	if (rt_task(p) && plist_empty(&w->pi_list)) {
	                  ^^^^^^^^^^^
		plist_init(&w->pi_list, prio);
		plist_add(&w->pi_list, &lock->owner->pi_waiters);

plist_empty() checks list_empty(&w->pi_list->dp_node), this does not
garantees that this w->pi_list is not on list, because all nodes with
the same priority have empty ->dp_node, except the first one.
I have changed this to plist_unhashed(&w->pi_list).


__up_mutex()
	RACE_BUG_ON(!lock->wait_list.dp_node.prev && !lock->wait_list.dp_node.next);
	                                         ^^^^
I guess, this should be '||' ?


init_lists()
	// we have to do this until the static initializers get fixed:
	if (!lock->wait_list.dp_node.prev && !lock->wait_list.dp_node.next)

I can't understand this comment, just changed ->dp_node to ->prio_list.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- V0.7.47-01/kernel/rt.c~3_UNSURE	2005-05-09 19:13:33.000000000 +0400
+++ V0.7.47-01/kernel/rt.c	2005-05-09 19:43:47.000000000 +0400
@@ -627,7 +627,7 @@ static void pi_setprio(struct rt_mutex *
 		lock = w->lock;
 		TRACE_BUG_ON(!lock);
 		TRACE_BUG_ON(!lock->owner);
-		if (rt_task(p) && plist_empty(&w->pi_list)) {
+		if (rt_task(p) && plist_unhashed(&w->pi_list)) {
 			TRACE_BUG_ON(was_rt);
 			w->pi_list.prio = prio;
 			plist_add(&w->pi_list, &lock->owner->pi_waiters);
@@ -645,7 +645,7 @@ static void pi_setprio(struct rt_mutex *
 		 * (TODO: this can be unfair to SCHED_NORMAL tasks if they
 		 *        get PI handled.)
 		 */
-		if (!rt_task(p) && !plist_empty(&w->pi_list)) {
+		if (!rt_task(p) && !plist_unhashed(&w->pi_list)) {
 			TRACE_BUG_ON(!was_rt);
 			plist_del(&w->pi_list);
 			plist_del(&w->list);
@@ -788,7 +788,7 @@ static inline struct task_struct * pick_
 static inline void init_lists(struct rt_mutex *lock)
 {
 	// we have to do this until the static initializers get fixed:
-	if (!lock->wait_list.dp_node.prev && !lock->wait_list.dp_node.next)
+	if (!lock->wait_list.prio_list.prev && !lock->wait_list.prio_list.next)
 		pl_head_init(&lock->wait_list);
 #ifdef CONFIG_RT_DEADLOCK_DETECT
 	if (!lock->held_list.prev && !lock->held_list.next)
@@ -1315,7 +1315,7 @@ static void __up_mutex(struct rt_mutex *
 	trace_lock_irqsave(&trace_lock, flags);
 	TRACE_BUG_ON(!irqs_disabled());
 	spin_lock(&lock->wait_lock);
-	TRACE_BUG_ON(!lock->wait_list.dp_node.prev && !lock->wait_list.dp_node.next);
+	TRACE_BUG_ON(!lock->wait_list.prio_list.prev || !lock->wait_list.prio_list.next);
 
 #ifdef CONFIG_RT_DEADLOCK_DETECT
 	TRACE_WARN_ON(list_empty(&lock->held_list));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-09 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-09 14:40 [PATCH 4/4] rt_mutex: possible bugfixes Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®