From: Keith Owens <kaos@ocs.com.au>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [patch] ia64-011010 die() deadlock
Date: Tue, 16 Oct 2001 02:46:45 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590698805346@msgid-missing> (raw)
Any die() routine that uses die_lock to avoid multiple cpu reentrancy
will deadlock on recursive die() errors. This patch fixes ia64-011010.
Andrew Morton, who did the original die_lock code, agrees that this is
required.
The code makes best effort at diagnosing the first recursive error then
gives up. This patch removes the only reference to IA64_KERNEL_DEATH
so I deleted the flag as well.
Index: 11.7/arch/ia64/kernel/traps.c
--- 11.7/arch/ia64/kernel/traps.c Thu, 11 Oct 2001 14:03:29 +1000 kaos (linux-2.4/r/c/43_traps.c 1.1.4.1.3.4 644)
+++ 11.7(w)/arch/ia64/kernel/traps.c Tue, 16 Oct 2001 12:33:57 +1000 kaos (linux-2.4/r/c/43_traps.c 1.1.4.1.3.4 644)
@@ -88,21 +89,26 @@ void
die (const char *str, struct pt_regs *regs, long err)
{
static spinlock_t die_lock = SPIN_LOCK_UNLOCKED;
+ static int die_lock_owner = -1, die_lock_owner_depth = 0;
- console_verbose();
- spin_lock_irq(&die_lock);
- bust_spinlocks(1);
- printk("%s[%d]: %s %ld\n", current->comm, current->pid, str, err);
- show_regs(regs);
- bust_spinlocks(0);
- spin_unlock_irq(&die_lock);
+ if (die_lock_owner != smp_processor_id()) {
+ console_verbose();
+ spin_lock_irq(&die_lock);
+ die_lock_owner = smp_processor_id();
+ die_lock_owner_depth = 0;
+ bust_spinlocks(1);
+ }
- if (current->thread.flags & IA64_KERNEL_DEATH) {
- printk("die_if_kernel recursion detected.\n");
- sti();
- while (1);
+ if (++die_lock_owner_depth < 3) {
+ printk("%s[%d]: %s %ld\n", current->comm, current->pid, str, err);
+ show_regs(regs);
}
- current->thread.flags |= IA64_KERNEL_DEATH;
+ else
+ printk(KERN_ERR "Recursive die() failure, output suppressed\n");
+
+ bust_spinlocks(0);
+ die_lock_owner = -1;
+ spin_unlock_irq(&die_lock);
do_exit(SIGSEGV);
}
Index: 11.7/include/asm-ia64/processor.h
--- 11.7/include/asm-ia64/processor.h Thu, 11 Oct 2001 14:03:29 +1000 kaos (linux-2.4/s/49_processor. 1.1.3.2.2.1.1.4 644)
+++ 11.7(w)/include/asm-ia64/processor.h Tue, 16 Oct 2001 12:28:13 +1000 kaos (linux-2.4/s/49_processor. 1.1.3.2.2.1.1.4 644)
@@ -170,7 +170,6 @@
#define IA64_THREAD_KRBS_SYNCED (__IA64_UL(1) << 5) /* krbs synced with process vm? */
#define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6) /* don't log any fpswa faults */
#define IA64_THREAD_FPEMU_SIGFPE (__IA64_UL(1) << 7) /* send a SIGFPE for fpswa faults */
-#define IA64_KERNEL_DEATH (__IA64_UL(1) << 63) /* see die_if_kernel()... */
#define IA64_THREAD_UAC_SHIFT 3
#define IA64_THREAD_UAC_MASK (IA64_THREAD_UAC_NOPRINT | IA64_THREAD_UAC_SIGBUS)
next reply other threads:[~2001-10-16 2:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-16 2:46 Keith Owens [this message]
2001-10-18 0:47 ` [Linux-ia64] [patch] ia64-011010 die() deadlock David Mosberger
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=marc-linux-ia64-105590698805346@msgid-missing \
--to=kaos@ocs.com.au \
--cc=linux-ia64@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