public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: extend e820 ealy_res support 32bit - fix #2
Date: Fri, 30 May 2008 16:50:55 +0100	[thread overview]
Message-ID: <4840225F.7010809@goop.org> (raw)
In-Reply-To: <86802c440805291214r50879732qc263b245985b4ba4@mail.gmail.com>

Yinghai Lu wrote:
> On Thu, May 29, 2008 at 11:52 AM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>   
>> On Thu, May 29, 2008 at 6:37 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>>     
>>> Yinghai Lu wrote:
>>>       
>>>> can we use e820 entries for that? So the domain builder could have
>>>> several entries for E820_RAM and E820_RESERVED...
>>>>
>>>>         
>>> I tried this, but it doesn't work; the kernel crashes during boot,
>>> presumably because it's trying to use the reserved memory as heap.  I
>>> suspect the e820 maps are not registered early enough or something...
>>>
>>> (One thought: if reserving in the E820 map were enough, then couldn't we use
>>> it for all the early reservations?)
>>>
>>> I've attached the non-working patch below.
>>>
>>> The working kernel reports:
>>>
>>> (early) BIOS-provided physical RAM map:
>>> (early)  Xen: 0000000000000000 - 000000000009f000 (usable)
>>> (early)  Xen: 0000000000100000 - 0000000010000000 (usable)
>>> (early) console [xenboot0] enabled
>>> (early) debug: ignoring loglevel setting.
>>> (early) 0MB HIGHMEM available.
>>> (early) 256MB LOWMEM available.
>>> (early)   low ram: 018fd000 - 10000000
>>> (early)   bootmap 018fd000 - 018ff000
>>> (early)   early res: 0 [0-fff] BIOS data page
>>> (early)   early res: 1 [1000-1fff] EX TRAMPOLINE
>>> (early)   early res: 2 [6000-6fff] TRAMPOLINE
>>> (early)   early res: 3 [18aa000-18ecfff] XEN
>>> (early)   early res: 4 [1000000-18a9303] TEXT DATA BSS
>>> (early)   early res: 5 [18ed000-18fcfff] INIT_PG_TABLE
>>> (early)   early res: 6 [18fd000-18fefff] BOOTMAP
>>>
>>> But the non-working one says:
>>>
>>> (early) BIOS-provided physical RAM map:
>>> (early)  Xen: 0000000000000000 - 000000000009f000 (usable)
>>> (early)  Xen: 0000000000100000 - 0000000010000000 (usable)
>>> (early)  Xen: 00000000018aa000 - 00000000018ed000 (reserved)
>>>       
>> it seems we miss to call sanitize_e820_map for 32 bit. we should get
>> (early)  Xen: 0000000000000000 - 000000000009f000 (usable)
>> (early)  Xen: 0000000000100000 - 00000000018aa000 (usable)
>> (early)  Xen: 00000000018aa000 - 00000000018ed000 (reserved)
>> (early)  Xen: 00000000018ed000 - 0000000010000000 (usable)
>>     
>
> xen pv override the memory_setup. and default one is
> machine_specific_memory_setup(), and it does call sanitize_e820_map...
>
> so you may need to add sanitize_e820_map to xen_memory_setup, or re
> arrange your add_memory_range parameter...

Yes, adding

        sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);

after the Xen reservation made everything happy.

    J

Subject: xen: reserve Xen-specific memory in e820 map

Make sure that the start_info and pfn->mfn translation array are reserved.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 arch/x86/xen/setup.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

===================================================================
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -40,8 +40,21 @@
 	max_pfn = min(MAX_DOMAIN_PAGES, max_pfn);
 
 	e820.nr_map = 0;
+
 	add_memory_region(0, LOWMEMSIZE(), E820_RAM);
 	add_memory_region(HIGH_MEMORY, PFN_PHYS(max_pfn)-HIGH_MEMORY, E820_RAM);
+
+	/*
+	 * Reserve Xen bits:
+	 *  - mfn_list
+	 *  - xen_start_info
+	 * See comment above "struct start_info" in <xen/interface/xen.h>
+	 */
+	add_memory_region(__pa(xen_start_info->mfn_list),
+			  xen_start_info->pt_base - xen_start_info->mfn_list,
+			  E820_RESERVED);
+
+	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 
 	return "Xen";
 }



  reply	other threads:[~2008-05-30 15:51 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-11  7:30 [PATCH] x86: make e820.c to have common functions Yinghai Lu
2008-05-13 13:05 ` Ingo Molnar
2008-05-13 17:35   ` Yinghai Lu
2008-05-18  8:18 ` [PATCH] x86: extend e820 ealy_res support 32bit Yinghai Lu
2008-05-21  3:10   ` [PATCH] x86: move e820_mark_nosave_regions to e820.c Yinghai Lu
2008-05-22  1:40   ` [PATCH] x86: extend e820 ealy_res support 32bit - fix Yinghai Lu
2008-05-22 10:12     ` Jeremy Fitzhardinge
2008-05-22 17:58       ` Yinghai Lu
2008-05-22 22:20     ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-23 23:08       ` Yinghai Lu
2008-05-23 23:32         ` Jeremy Fitzhardinge
2008-05-23 23:38         ` Jeremy Fitzhardinge
2008-05-24  0:01           ` Yinghai Lu
2008-05-24  0:09             ` Yinghai Lu
2008-05-24  8:54       ` Jeremy Fitzhardinge
2008-05-24  9:49         ` [PATCH] xen: boot via i386_start_kernel to get early reservations Jeremy Fitzhardinge
2008-05-24 22:04           ` Yinghai Lu
2008-05-24 19:57         ` [PATCH] x86: extend e820 ealy_res support 32bit - fix v2 Yinghai Lu
2008-05-25 17:00     ` [PATCH] x86: extend e820 ealy_res support 32bit - fix #2 Yinghai Lu
2008-05-27 15:44       ` Thomas Gleixner
2008-05-27 20:37         ` Jeremy Fitzhardinge
2008-05-27 20:58           ` Thomas Gleixner
2008-05-27 21:06             ` Jeremy Fitzhardinge
2008-05-27 21:06           ` Yinghai Lu
2008-05-27 21:22             ` Jeremy Fitzhardinge
2008-05-27 21:35               ` Yinghai Lu
2008-05-27 21:47                 ` Jeremy Fitzhardinge
2008-05-27 22:52                   ` Yinghai Lu
2008-05-28 10:01                     ` Jeremy Fitzhardinge
2008-05-28 20:48                       ` Yinghai Lu
2008-05-28 21:24                         ` Jeremy Fitzhardinge
2008-05-29 13:37                         ` Jeremy Fitzhardinge
2008-05-29 18:41                           ` Yinghai Lu
2008-05-29 18:58                             ` H. Peter Anvin
2008-05-29 18:52                           ` Yinghai Lu
2008-05-29 19:14                             ` Yinghai Lu
2008-05-30 15:50                               ` Jeremy Fitzhardinge [this message]
2008-05-29 19:56       ` [PATCH] x86: extend e820 early_res support 32bit -fix #3 Yinghai Lu
2008-05-29 19:57       ` [PATCH] x86: extend e820 early_res support 32bit -fix #4 Yinghai Lu
2008-05-29 19:58       ` [PATCH] x86: extend e820 early_res support 32bit -fix #5 Yinghai Lu
2008-05-29 23:25       ` [PATCH] x86: 32bit numa srat fix early_ioremap leak Yinghai Lu
2008-05-31  8:01         ` Ingo Molnar
2008-06-01  5:51         ` [PATCH] x86: 32bit numa increase max_elements to 1024 Yinghai Lu
2008-06-01  5:52           ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit Yinghai Lu
2008-06-01  5:53             ` [PATCH] x86: set node_remap_size[0] in fallback path Yinghai Lu
2008-06-01  5:56               ` [PATCH] x86: numa_32 print out debug info all kva Yinghai Lu
2008-06-01 20:15                 ` [PATCH] x86: numa_32 print out debug info all kva v2 Yinghai Lu
2008-06-03  2:16             ` [PATCH] x86: change propagate_e820_map back to find_max_pfn -32bit -v2 Yinghai Lu
2008-06-02  4:06         ` [PATCH] x86: numa_32 avoid clash between ramdisk and kva Yinghai Lu
2008-06-02  6:53           ` [PATCH] x86: cleanup max_pfn_mapped usage - 32bit Yinghai Lu
2008-06-02  6:55           ` [PATCH] x86: cleanup max_pfn_mapped usage - 64bit 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=4840225F.7010809@goop.org \
    --to=jeremy@goop.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=yhlu.kernel@gmail.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