All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH RFC] e820_remove_range fail?
Date: Tue, 30 Mar 2010 12:38:42 +1030	[thread overview]
Message-ID: <201003301238.43620.rusty@rustcorp.com.au> (raw)

Hi Yinghai,

   I just wrote this patch for lguest, but I think the real problem is
that e820_remove_range can't split a range.  Is this a problem for
real machines?

[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  LGUEST: 0000000000000000 - 0000000004000000 (usable)
[    0.000000] Notice: NX (Execute Disable) protection missing in CPU or disabled in BIOS!
[    0.000000] DMI not present or invalid.
[    0.000000] last_pfn = 0x3fa0 max_arch_pfn = 0x100000
[    0.000000] init_memory_mapping: 0000000000000000-0000000003fa0000

Thanks,
Rusty.
===
lguest: handle trimming of our e820 map

Lguest doesn't need to reserve space for the BIOS, but in commit
1b5576e69a5f Yinghai added trim_bios_range which mangles our e820 map.
But e820_remove_range does not handle removing a range from the middle
of a region correctly, so we end up with a bad max_pfn value.

The result is we can't find our (lguest-specific) device table which
we expect above the top of RAM, and fail to find the root device.

Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1135,12 +1135,15 @@ static struct notifier_block paniced = {
 static __init char *lguest_memory_setup(void)
 {
 	/*
-	 *The Linux bootloader header contains an "e820" memory map: the
+	 * The Linux bootloader header contains an "e820" memory map: the
 	 * Launcher populated the first entry with our memory limit.
+	 *
+	 * We have to skip the traditional BIOS area here, otherwise the
+	 * kernel messes up our map trying to "fix" it in trim_bios_range.
 	 */
-	e820_add_region(boot_params.e820_map[0].addr,
-			  boot_params.e820_map[0].size,
-			  boot_params.e820_map[0].type);
+	e820_add_region(0, BIOS_BEGIN, boot_params.e820_map[0].type);
+	e820_add_region(BIOS_END, boot_params.e820_map[0].size - BIOS_END,
+			boot_params.e820_map[0].type);
 
 	/* This string is for the boot messages. */
 	return "LGUEST";

             reply	other threads:[~2010-03-30  2:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30  2:08 Rusty Russell [this message]
2010-03-30  4:15 ` [PATCH RFC] e820_remove_range fail? Yinghai Lu
2010-03-30  5:38 ` [PATCH] x86: Make e820_remove_range to handle all covered case Yinghai Lu
2010-03-31 23:16   ` Rusty Russell
2010-04-01  1:00   ` [tip:x86/urgent] " tip-bot for Yinghai Lu

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=201003301238.43620.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=yinghai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.