mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@in.ibm.com>
To: Fastboot mailing list <fastboot@lists.osdl.org>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Morton Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Kexec: Kexec on panic fix with nmi watchdog enabled
Date: Tue, 17 May 2005 14:18:59 +0530	[thread overview]
Message-ID: <20050517084859.GB6196@in.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: x86-hang-on-nmi-watchdog-fix.patch --]
[-- Type: text/plain, Size: 2161 bytes --]


o Problem: Kexec on panic hangs if first kernel is booted with nmi_watchdog
  command line parameter. This problem occurs because kexec crash shutdown
  code replaces the NMI callback handler. This handler saves the cpu register
  states and halts the cpu. If system is booted with nmi_watchdog parameter,
  then crashing cpu also runs this nmi handler and halts itself.

o This patch fixes the problem by keeping a track of crashing cpu and not
  executing the new nmi handler on crashing cpu.

o There is a dependence on smp_processor_id() function which might return
  insane value for cpu, if cpu field of thread_info is corrupted.

Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com>
---

 linux-2.6.12-rc4-mm2-nmi-vivek/arch/i386/kernel/crash.c |   12 ++++++++++++
 1 files changed, 12 insertions(+)

diff -puN arch/i386/kernel/crash.c~x86-hang-on-nmi-watchdog-fix arch/i386/kernel/crash.c
--- linux-2.6.12-rc4-mm2-nmi/arch/i386/kernel/crash.c~x86-hang-on-nmi-watchdog-fix	2005-05-17 14:11:24.724659160 +0530
+++ linux-2.6.12-rc4-mm2-nmi-vivek/arch/i386/kernel/crash.c	2005-05-17 14:11:24.731658096 +0530
@@ -28,6 +28,8 @@
 
 
 note_buf_t crash_notes[NR_CPUS];
+/* This keeps a track of which one is crashing cpu. */
+static int crashing_cpu;
 
 static u32 *append_elf_note(u32 *buf,
 	char *name, unsigned type, void *data, size_t data_len)
@@ -113,6 +115,13 @@ static atomic_t waiting_for_crash_ipi;
 static int crash_nmi_callback(struct pt_regs *regs, int cpu)
 {
 	struct pt_regs fixed_regs;
+
+	/* Don't do anything if this handler is invoked on crashing cpu.
+	 * Otherwise, system will completely hang. Crashing cpu can get
+	 * an NMI if system was initially booted with nmi_watchdog parameter.
+	 */
+	if (cpu == crashing_cpu)
+		return 1;
 	local_irq_disable();
 
 	/* CPU does not save ss and esp on stack if execution is already
@@ -187,6 +196,9 @@ void machine_crash_shutdown(void)
 	 */
 	/* The kernel is broken so disable interrupts */
 	local_irq_disable();
+
+	/* Make a note of crashing cpu. Will be used in NMI callback.*/
+	crashing_cpu = smp_processor_id();
 	nmi_shootdown_cpus();
 	lapic_shutdown();
 #if defined(CONFIG_X86_IO_APIC)
_

                 reply	other threads:[~2005-05-17  8:49 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=20050517084859.GB6196@in.ibm.com \
    --to=vgoyal@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=fastboot@lists.osdl.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

all inboxes | Powered by JetHome®