From: Petr Tesarik <ptesarik@suse.cz>
To: Tony Luck <tony.luck@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>,
linux-ia64@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: Overlapping reserved regions at boot
Date: Tue, 29 Nov 2011 15:01:51 +0100 [thread overview]
Message-ID: <201111291501.51657.ptesarik@suse.cz> (raw)
Hello,
while working on the upcoming SLES11 SP2, I ran into an issue with booting the
panic kernel on a kernel crash. In the first iteration I found out that the
initial register backing store gets overwritten with zeroes, causing a kernel
crash shortly afterwards.
Further investigation revealed that rsvd_region[] contains overlapping
entries: find_memmap_space() returns a pointer which lies between KERNEL_START
and _end. This is correct with the EFI memmap as patched by the kexec
purgatory code. That code removes vmlinux LOAD segments from the usable map,
but there is a pretty large hole between the gate section and the per-cpu
section.
With the following patch, the panic kernel can boot and save the crash dump.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -225,6 +225,23 @@
}
}
+/* merge overlaps */
+static int __init
+merge_regions (struct rsvd_region *rsvd_region, int max)
+{
+ int i;
+ for (i = 1; i < max; ++i) {
+ if (rsvd_region[i].start >= rsvd_region[i-1].end)
+ continue;
+ if (rsvd_region[i].end > rsvd_region[i-1].end)
+ rsvd_region[i-1].end = rsvd_region[i].end;
+ --max;
+ memmove(&rsvd_region[i], &rsvd_region[i+1],
+ (max - i) * sizeof(struct rsvd_region));
+ }
+ return max;
+}
+
/*
* Request address space for all standard resources
*/
@@ -275,6 +292,7 @@
if (ret == 0 && size > 0) {
if (!base) {
sort_regions(rsvd_region, *n);
+ *n = merge_regions(rsvd_region, *n);
base = kdump_find_rsvd_region(size,
rsvd_region, *n);
}
@@ -392,6 +410,7 @@
BUG_ON(IA64_MAX_RSVD_REGIONS + 1 < n);
sort_regions(rsvd_region, num_rsvd_regions);
+ num_rsvd_regions = merge_regions(rsvd_region, num_rsvd_regions);
}
next reply other threads:[~2011-11-29 14:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-29 14:01 Petr Tesarik [this message]
2011-12-07 14:22 ` Overlapping reserved regions at boot Petr Tesarik
2011-12-09 23:10 ` Luck, Tony
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=201111291501.51657.ptesarik@suse.cz \
--to=ptesarik@suse.cz \
--cc=fenghua.yu@intel.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.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