From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH RT] add might_sleep in rt_spin_lock_fastlock
Date: Fri, 01 Jun 2007 18:35:21 -0400 [thread overview]
Message-ID: <1180737321.21781.46.camel@localhost.localdomain> (raw)
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]
Ingo,
Every so often we get bit by a bug "scheduling in atomic", and it comes
from a rtmutex spin_lock. The bug only happens when that lock has
contention, so we miss it a lot.
This patch adds a might_sleep() to the rt_spin_lock_fastlock to find
bugs where we can schedule in atomic.
The one place that exists now is from do_page_fault and sending a
signal. I wrote a simple crash program that segfaults (attached) and
with this patch, I get the warning.
-- Steve
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Index: linux-2.6.21-rt9/kernel/rtmutex.c
===================================================================
--- linux-2.6.21-rt9.orig/kernel/rtmutex.c
+++ linux-2.6.21-rt9/kernel/rtmutex.c
@@ -602,6 +602,8 @@ static inline void
rt_spin_lock_fastlock(struct rt_mutex *lock,
void fastcall (*slowfn)(struct rt_mutex *lock))
{
+ might_sleep();
+
if (likely(rt_mutex_cmpxchg(lock, NULL, current)))
rt_mutex_deadlock_account_lock(lock, current);
else
[-- Attachment #2: crashme.c --]
[-- Type: text/x-csrc, Size: 231 bytes --]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main (int argc, char **argv)
{
unsigned long *p = (void*)-1;
printf("crashing...\n");
/* nighty night */
*p = 0xbed;
printf("did we crash??\n");
return 0;
}
reply other threads:[~2007-06-01 22:36 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1180737321.21781.46.camel@localhost.localdomain \
--to=rostedt@goodmis.org \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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
all inboxes | Powered by JetHome®