public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: fastboot@lists.osdl.org, kexec@lists.infradead.org,
	linux-ia64@vger.kernel.org
Cc: Nanhai Zou <nanhai.zou@intel.com>,
	Vivek Goyal <vgoyal@in.ibm.com>, Tony Luck <tony.luck@intel.com>
Subject: [patch 2/3] Use per-cpu elf_prstatus
Date: Tue, 08 May 2007 09:31:16 +0000	[thread overview]
Message-ID: <20070508093329.088911844@tabatha.lab.ultramonkey.org> (raw)
In-Reply-To: 20070508093114.767199973@tabatha.lab.ultramonkey.org

Use a pre-allocated per-cpu variable for saving the cpu registers, as per
the IA64 specific code. This is in order to reduce possible stack
contention at crash-time as per the inline comment.

A following patch will update ia64 to use crash_save_cpu() rather
than its own re-implementation of the routine.

Signed-off-by: Simon Horman <horms@verge.net.au>

--- 
 linux-2.6/kernel/kexec.c |   20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Index: linux-2.6/kernel/kexec.c
=================================--- linux-2.6.orig/kernel/kexec.c	2007-05-08 18:08:50.000000000 +0900
+++ linux-2.6/kernel/kexec.c	2007-05-08 18:22:45.000000000 +0900
@@ -1097,9 +1097,18 @@ static void final_note(u32 *buf)
 	memcpy(buf, &note, sizeof(note));
 }
 
+/*
+ * There is some concern that on architectures where struct elf_prstatus is
+ * large, such as IA64, having elf_prstatus on the stack in
+ * crash_save_cpu() could cause problems given that this function
+ * is run after a kernel crash has occured. To aleviate this problem
+ * a pre-allocated per-cpu value is used instead.
+ */
+static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
+
 void crash_save_cpu(struct pt_regs *regs, int cpu)
 {
-	struct elf_prstatus prstatus;
+	struct elf_prstatus *prstatus;
 	u32 *buf;
 
 	if ((cpu < 0) || (cpu >= NR_CPUS))
@@ -1115,11 +1124,12 @@ void crash_save_cpu(struct pt_regs *regs
 	buf = (u32*)per_cpu_ptr(crash_notes, cpu);
 	if (!buf)
 		return;
-	memset(&prstatus, 0, sizeof(prstatus));
-	prstatus.pr_pid = current->pid;
-	kexec_elf_core_copy_regs(&prstatus.pr_reg, regs);
+	prstatus = &per_cpu(elf_prstatus, cpu);
+	memset(prstatus, 0, sizeof(struct elf_prstatus));
+	prstatus->pr_pid = current->pid;
+	kexec_elf_core_copy_regs(&(prstatus->pr_reg), regs);
 	buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS,
-		      	      &prstatus, sizeof(prstatus));
+			      prstatus, sizeof(struct elf_prstatus));
 	final_note(buf);
 }
 

-- 

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


  parent reply	other threads:[~2007-05-08  9:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-08  9:31 [patch 0/3] [KEXEC] Use generic elf code on ia64 Simon Horman
2007-05-08  9:31 ` [patch 1/3] Add kdump_elf_core_copy_regs() Simon Horman
2007-05-08  9:31 ` Simon Horman [this message]
2007-05-08  9:31 ` [patch 3/3] Use generic elf code on ia64 Simon Horman

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=20070508093329.088911844@tabatha.lab.ultramonkey.org \
    --to=horms@verge.net.au \
    --cc=fastboot@lists.osdl.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=nanhai.zou@intel.com \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@in.ibm.com \
    /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