From: Ingo Molnar <mingo@elte.hu>
To: Andrew Morton <akpm@osdl.org>
Cc: "Charles C. Bennett, Jr." <ccb@acm.org>, linux-kernel@vger.kernel.org
Subject: [patch] increase spinlock-debug looping timeouts from 1 sec to 1 min
Date: Mon, 19 Jun 2006 09:02:29 +0200 [thread overview]
Message-ID: <20060619070229.GA8293@elte.hu> (raw)
In-Reply-To: <20060617100710.ec05131f.akpm@osdl.org>
* Andrew Morton <akpm@osdl.org> wrote:
> Well. Obviously __write_lock_debug():print_once was meant to have
> static scope (__read_mostly, too). But that's a cosmetic thing.
no - this is an infinite loop we must not break out of, and we only want
to print the warning once per infinite loop. But we dont want to shut up
these messages globally. (so that we get a backtrace on all CPUs that
are looping, etc.)
> I'm suspecting that the debug code has simply gone wrong here - that
> there's such a lot of read_lock() traffic happening with this workload
> that the debug version of write_lock() simply isn't able to take the
> lock.
i'd go for the patch below - the current 1 second timeout might be both
inadequate for really high loads, and it might also be unrobust when
there's some miscalibration of loops_per_jiffies - turning a 1 sec
timeout into half-a-sec timeout or so. Builds/boots here on 32-bit and
64-bit.
Ingo
-----------
Subject: increase spinlock-debug looping timeouts from 1 sec to 1 min
From: Ingo Molnar <mingo@elte.hu>
increase the loop timeouts from 1 second to 60 seconds. This should also
handle the occasional case of loops_per_jiffy miscalibration, and it
should handle false positives due to high workloads.
(also make sure the right hand side of the comparison does not overflow
on 32-bits, and make the messages indicate that we dont know for a fact
whether this is due to a lockup or due to some extreme load.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
lib/spinlock_debug.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: linux/lib/spinlock_debug.c
===================================================================
--- linux.orig/lib/spinlock_debug.c
+++ linux/lib/spinlock_debug.c
@@ -104,7 +104,7 @@ static void __spin_lock_debug(spinlock_t
u64 i;
for (;;) {
- for (i = 0; i < loops_per_jiffy * HZ; i++) {
+ for (i = 0; i < (u64)loops_per_jiffy * 60 * HZ; i++) {
if (__raw_spin_trylock(&lock->raw_lock))
return;
__delay(1);
@@ -112,7 +112,7 @@ static void __spin_lock_debug(spinlock_t
/* lockup suspected: */
if (print_once) {
print_once = 0;
- printk(KERN_EMERG "BUG: spinlock lockup on CPU#%d, "
+ printk(KERN_EMERG "BUG: possible spinlock lockup on CPU#%d, "
"%s/%d, %p\n",
raw_smp_processor_id(), current->comm,
current->pid, lock);
@@ -169,7 +169,7 @@ static void __read_lock_debug(rwlock_t *
u64 i;
for (;;) {
- for (i = 0; i < loops_per_jiffy * HZ; i++) {
+ for (i = 0; i < (u64)loops_per_jiffy * 60 * HZ; i++) {
if (__raw_read_trylock(&lock->raw_lock))
return;
__delay(1);
@@ -177,7 +177,7 @@ static void __read_lock_debug(rwlock_t *
/* lockup suspected: */
if (print_once) {
print_once = 0;
- printk(KERN_EMERG "BUG: read-lock lockup on CPU#%d, "
+ printk(KERN_EMERG "BUG: possible read-lock lockup on CPU#%d, "
"%s/%d, %p\n",
raw_smp_processor_id(), current->comm,
current->pid, lock);
@@ -242,7 +242,7 @@ static void __write_lock_debug(rwlock_t
u64 i;
for (;;) {
- for (i = 0; i < loops_per_jiffy * HZ; i++) {
+ for (i = 0; i < (u64)loops_per_jiffy * 60 * HZ; i++) {
if (__raw_write_trylock(&lock->raw_lock))
return;
__delay(1);
@@ -250,7 +250,7 @@ static void __write_lock_debug(rwlock_t
/* lockup suspected: */
if (print_once) {
print_once = 0;
- printk(KERN_EMERG "BUG: write-lock lockup on CPU#%d, "
+ printk(KERN_EMERG "BUG: possible write-lock lockup on CPU#%d, "
"%s/%d, %p\n",
raw_smp_processor_id(), current->comm,
current->pid, lock);
next prev parent reply other threads:[~2006-06-19 7:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-12 19:53 BUG: write-lock lockup Charles C. Bennett, Jr.
2006-06-17 17:07 ` Andrew Morton
2006-06-19 7:02 ` Ingo Molnar [this message]
2006-06-19 7:59 ` [patch] increase spinlock-debug looping timeouts from 1 sec to 1 min Andrew Morton
2006-06-19 8:12 ` Ingo Molnar
2006-06-19 8:21 ` Ingo Molnar
2006-06-19 8:32 ` Andrew Morton
2006-06-19 8:35 ` Ingo Molnar
2006-06-19 9:13 ` Andrew Morton
2006-06-19 11:39 ` Ingo Molnar
2006-06-19 19:55 ` Andrew Morton
2006-06-20 8:06 ` Arjan van de Ven
2006-06-20 8:40 ` [patch] fix spinlock-debug looping Ingo Molnar
2006-06-20 8:52 ` Andrew Morton
2006-06-20 9:15 ` Ingo Molnar
2006-06-20 9:32 ` Andrew Morton
2006-06-20 9:34 ` Ingo Molnar
2006-06-20 16:02 ` Dave Olson
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=20060619070229.GA8293@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=ccb@acm.org \
--cc=linux-kernel@vger.kernel.org \
/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