linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <rostedt@goodmis.org>, <tglx@linutronix.de>,
	<bigeasy@linutronix.de>, <paulmck@linux.vnet.ibm.com>
Cc: <linux-rt-users@vger.kernel.org>,
	Paul Gortmaker <paul.gortmaker@windriver.com>
Subject: [PATCH 2/2] list_bl: make list head lock a raw lock
Date: Mon, 10 Jun 2013 17:36:49 -0400	[thread overview]
Message-ID: <1370900209-40769-3-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1370900209-40769-1-git-send-email-paul.gortmaker@windriver.com>

As a bit spinlock, we had no lockdep visibility into the usage
of the list head locking.  Now, as a separate lock, we see:

[    3.613354] BUG: sleeping function called from invalid context at kernel/rtmutex.c:658
[    3.613356] in_atomic(): 1, irqs_disabled(): 0, pid: 122, name: udevd
[    3.613357] 5 locks held by udevd/122:
[    3.613358]  #0:  (&sb->s_type->i_mutex_key#7/1){+.+.+.}, at: [<ffffffff811967e8>] lock_rename+0xe8/0xf0
[    3.613363]  #1:  (rename_lock){+.+...}, at: [<ffffffff811a277c>] d_move+0x2c/0x60
[    3.613367]  #2:  (&dentry->d_lock){+.+...}, at: [<ffffffff811a0763>] dentry_lock_for_move+0xf3/0x130
[    3.613370]  #3:  (&dentry->d_lock/2){+.+...}, at: [<ffffffff811a0734>] dentry_lock_for_move+0xc4/0x130
[    3.613373]  #4:  (&dentry->d_lock/3){+.+...}, at: [<ffffffff811a0747>] dentry_lock_for_move+0xd7/0x130
[    3.613377] Pid: 122, comm: udevd Not tainted 3.4.47-rt62-00002-gfedcea8 #7
[    3.613378] Call Trace:
[    3.613382]  [<ffffffff810b9624>] __might_sleep+0x134/0x1f0
[    3.613385]  [<ffffffff817a24d4>] rt_spin_lock+0x24/0x60
[    3.613387]  [<ffffffff811a0c4c>] __d_shrink+0x5c/0xa0
[    3.613389]  [<ffffffff811a1b2d>] __d_drop+0x1d/0x40
[    3.613391]  [<ffffffff811a24be>] __d_move+0x8e/0x320
[    3.613393]  [<ffffffff811a278e>] d_move+0x3e/0x60
[    3.613394]  [<ffffffff81199598>] vfs_rename+0x198/0x4c0
[    3.613396]  [<ffffffff8119b093>] sys_renameat+0x213/0x240
[    3.613398]  [<ffffffff817a2de5>] ? _raw_spin_unlock+0x35/0x60
[    3.613401]  [<ffffffff8107781c>] ? do_page_fault+0x1ec/0x4b0
[    3.613403]  [<ffffffff817a32ca>] ? retint_swapgs+0xe/0x13
[    3.613406]  [<ffffffff813eb0e6>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[    3.613408]  [<ffffffff8119b0db>] sys_rename+0x1b/0x20
[    3.613410]  [<ffffffff817a3b96>] system_call_fastpath+0x1a/0x1f

For now, lets assume that the list head lock isn't held for big
stretches, and hence it being raw won't be a significant latency
concern.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 include/linux/list_bl.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/list_bl.h b/include/linux/list_bl.h
index 9c46fea..64ba33b 100644
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -34,7 +34,7 @@
 struct hlist_bl_head {
 	struct hlist_bl_node *first;
 #ifdef CONFIG_PREEMPT_RT_BASE
-	spinlock_t lock;
+	raw_spinlock_t lock;
 #endif
 };
 
@@ -46,7 +46,7 @@ static inline void INIT_HLIST_BL_HEAD(struct hlist_bl_head *h)
 {
 	h->first = NULL;
 #ifdef CONFIG_PREEMPT_RT_BASE
-	spin_lock_init(&h->lock);
+	raw_spin_lock_init(&h->lock);
 #endif
 }
 
@@ -130,7 +130,7 @@ static inline void hlist_bl_lock(struct hlist_bl_head *b)
 #ifndef CONFIG_PREEMPT_RT_BASE
 	bit_spin_lock(0, (unsigned long *)b);
 #else
-	spin_lock(&b->lock);
+	raw_spin_lock(&b->lock);
 #endif
 }
 
@@ -139,7 +139,7 @@ static inline void hlist_bl_unlock(struct hlist_bl_head *b)
 #ifndef CONFIG_PREEMPT_RT_BASE
 	__bit_spin_unlock(0, (unsigned long *)b);
 #else
-	spin_unlock(&b->lock);
+	raw_spin_unlock(&b->lock);
 #endif
 }
 
-- 
1.8.1.2


  parent reply	other threads:[~2013-06-10 21:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10 21:36 [PATCH 0/2] Avoid more bit_spin_lock usage on RT kernels Paul Gortmaker
2013-06-10 21:36 ` [PATCH 1/2] list_bl.h: make list head locking RT safe Paul Gortmaker
2013-06-21 12:23   ` Sebastian Andrzej Siewior
2013-06-21 15:25     ` Paul Gortmaker
2013-06-21 15:36       ` Sebastian Andrzej Siewior
2013-06-21 19:07         ` [PATCH v2] " Paul Gortmaker
2013-06-28 11:23           ` Sebastian Andrzej Siewior
2013-06-10 21:36 ` Paul Gortmaker [this message]
2013-06-10 21:56 ` [PATCH 0/2] Avoid more bit_spin_lock usage on RT kernels Paul E. McKenney

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=1370900209-40769-3-git-send-email-paul.gortmaker@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).