mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Mark Knecht <markknecht@gmail.com>
Cc: Steven Rostedt <rostedt@kihontech.com>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: 2.6.14-rc3-rt2
Date: Tue, 04 Oct 2005 22:45:07 +0200	[thread overview]
Message-ID: <1128458707.13057.68.camel@tglx.tec.linutronix.de> (raw)
In-Reply-To: <5bdc1c8b0510041158m3620f5dcy2dafda545ad3cd5e@mail.gmail.com>

On Tue, 2005-10-04 at 11:58 -0700, Mark Knecht wrote:
> > I guess its related to the priority leak I'm tracking down right now.
> > Can you please set following config options and check if you get a bug
> > similar to this ?
> >
> > BUG: init/1: leaked RT prio 98 (116)?
> >
> > Steven, it goes away when deadlock detection is enabled. Any pointers 

Thats actually a red hering caused by asymetric accounting which only
happens when

CONFIG_DEBUG_PREEMPT=y 
and 
# CONFIG_RT_DEADLOCK_DETECT is not set

tglx


Index: linux-2.6.14-rc3-rt8-ep/kernel/rt.c
===================================================================
--- linux-2.6.14-rc3-rt8-ep.orig/kernel/rt.c
+++ linux-2.6.14-rc3-rt8-ep/kernel/rt.c
@@ -295,6 +295,21 @@ void check_preempt_wakeup(struct task_st
 			dump_stack();
 		}
 }
+
+static inline void account_mutex_owner_down(struct rt_mutex *lock)
+{
+	current->owned_lock[current->lock_count] = lock;
+	current->lock_count++;
+}
+
+static inline void account_mutex_owner_up(struct rt_mutex *lock)
+{
+	current->lock_count--;
+	current->owned_lock[current->lock_count] = NULL;
+}
+
+#else
+#define account_mutex_owner(l) do { } while(0)
 #endif
 
 #ifdef CONFIG_RT_DEADLOCK_DETECT
@@ -1241,13 +1256,13 @@ static int __grab_lock(struct rt_mutex *
 	list_del_init(&lock->held_list);
 #endif
 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPT_RT)
+	owner->lock_count--;
 	if (owner->lock_count < 0 || owner->lock_count >= MAX_LOCK_STACK) {
 		TRACE_OFF();
 		printk("BUG: %s/%d: lock count of %u\n",
 			owner->comm, owner->pid, owner->lock_count);
 		dump_stack();
 	}
-	owner->lock_count--;
 	owner->owned_lock[owner->lock_count] = NULL;
 #endif
 	return 1;
@@ -1579,13 +1594,13 @@ ____up_mutex(struct rt_mutex *lock, int 
 		lock->owner = NULL;
 	_raw_spin_unlock(&lock->wait_lock);
 #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_PREEMPT_RT)
+	current->lock_count--;
 	if (current->lock_count < 0 || current->lock_count >= MAX_LOCK_STACK) {
 		TRACE_OFF();
 		printk("BUG: %s/%d: lock count of %u\n",
 			current->comm, current->pid, current->lock_count);
 		dump_stack();
 	}
-	current->lock_count--;
 	current->owned_lock[current->lock_count] = NULL;
 	if (!current->lock_count && !rt_prio(current->normal_prio) &&
 					rt_prio(current->prio)) {
@@ -1638,6 +1653,8 @@ static inline void __down_mutex_inline(s
 
 	if (unlikely(cmpxchg(&lock->owner, NULL, ti)))
 		___down_mutex(lock __EIP__);
+	else
+		account_mutex_owner_down(lock);
 }
 
 static inline void __down_inline(struct rt_mutex *lock __EIP_DECL__)
@@ -1646,6 +1663,8 @@ static inline void __down_inline(struct 
 
 	if (unlikely(cmpxchg(&lock->owner, NULL, ti)))
 		___down(lock __EIP__);
+	else
+		account_mutex_owner_down(lock);
 }
 
 void __sched __down_mutex(struct rt_mutex *lock __EIP_DECL__)
@@ -1697,6 +1716,8 @@ static inline void
 
 	if (unlikely(cmpxchg(&lock->owner, ti, NULL) != ti))
 		___up_mutex_savestate(lock __EIP__);
+	else
+		account_mutex_owner_up(lock);
 }
 
 void __sched __up_mutex_savestate(struct rt_mutex *lock __EIP_DECL__)
@@ -1711,6 +1732,8 @@ __up_mutex_nosavestate_inline(struct rt_
 
 	if (unlikely(cmpxchg(&lock->owner, ti, NULL) != ti))
 		___up_mutex_nosavestate(lock __EIP__);
+	else
+		account_mutex_owner_up(lock);
 }
 
 void __sched __up_mutex_nosavestate(struct rt_mutex *lock __EIP_DECL__)
@@ -2869,6 +2892,9 @@ void fastcall rt_mutex_set_owner(struct 
 	 */
 #ifdef CONFIG_DEBUG_PREEMPT
 	current->lock_count--;
+	current->owned_lock[current->lock_count] = NULL;
+	t->task->owned_lock[t->task->lock_count] = lock;
+	t->task->lock_count++;
 #endif
 	lock->owner = t;
 }




  reply	other threads:[~2005-10-04 20:43 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-04  8:44 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 12:51 ` 2.6.14-rc3-rt2 K.R. Foley
2005-10-04 13:00   ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 13:45     ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-04 14:27       ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 15:16         ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-04 15:32           ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 15:50             ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-04 15:46               ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-04 16:09                 ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-04 15:34           ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-04 16:09           ` 2.6.14-rc3-rt2 Daniel Walker
2005-10-04 16:32             ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-04 16:46               ` 2.6.14-rc3-rt2 Daniel Walker
2005-10-04 17:58             ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-04 17:54               ` 2.6.14-rc3-rt2 Daniel Walker
2005-10-04 18:11                 ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-04 18:27                   ` 2.6.14-rc3-rt2 Daniel Walker
2005-10-04 20:03                     ` 2.6.14-rc3-rt2 Dinakar Guniguntala
2005-10-05  7:37                       ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 14:25     ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-05  7:39       ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 16:44     ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-04 18:11       ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-04 18:20         ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-04 18:58           ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-04 20:45             ` Thomas Gleixner [this message]
2005-10-04 20:49               ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-04 20:53                 ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-04 21:21                   ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-05 10:56                 ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-05 17:14                   ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-06  7:54                     ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06  8:06                     ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06  8:10                       ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-06  8:29                         ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06  8:33                           ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-06  8:44                             ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06 16:04                             ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-06  8:37                           ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-06  8:37                         ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06  8:49                           ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-06  9:48                             ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-06 10:04                               ` 2.6.14-rc3-rt2 Andi Kleen
2005-10-06 11:08                                 ` [PATCH] cleanup u32 flags in acpi spin_lock calls Steven Rostedt
2005-10-06 16:25                                 ` 2.6.14-rc3-rt2 Luck, Tony
2005-10-06 15:26                             ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-07 11:08                               ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-07 11:15                                 ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-07 12:38                                   ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-07 13:26                                     ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-11  8:01                               ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-11  9:09                                 ` 2.6.14-rc3-rt12 Steven Rostedt
2005-10-11  9:12                                   ` 2.6.14-rc3-rt12 Ingo Molnar
2005-10-06  9:48                           ` 2.6.14-rc3-rt2 Andi Kleen
2005-10-06  9:36                         ` 2.6.14-rc3-rt2 Andi Kleen
2005-10-04 20:51               ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-05  7:12               ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-05 14:50                 ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-05  7:41               ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-04 20:38           ` 2.6.14-rc3-rt2 Mark Knecht
2005-10-06 14:31           ` 2.6.14-rc3-rt2 Lee Revell
2005-10-06 15:00             ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-05 13:36 ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-05 14:29   ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-05 15:41     ` 2.6.14-rc3-rt2 Daniel Walker
2005-10-05 15:48     ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-05 15:58       ` 2.6.14-rc3-rt2 david singleton
2005-10-05 16:08         ` 2.6.14-rc3-rt2 Thomas Gleixner
2005-10-05 16:13           ` 2.6.14-rc3-rt2 david singleton
2005-10-05 15:58       ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-05 16:07         ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-07 11:05           ` 2.6.14-rc3-rt2 Steven Rostedt
2005-10-07 11:14             ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-05 14:41   ` 2.6.14-rc3-rt2 Ingo Molnar
2005-10-05 20:24 ` 2.6.14-rc3-rt2 Esben Nielsen
2005-10-06 16:47 ` 2.6.14-rc3-rt2 Todd Kneisel
2005-10-06 17:18   ` 2.6.14-rc3-rt2 david singleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1128458707.13057.68.camel@tglx.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markknecht@gmail.com \
    --cc=mingo@elte.hu \
    --cc=rostedt@kihontech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®