From: Pekka Enberg <penberg@kernel.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
"H. Peter Anvin" <hpa@zytor.com>, Jacob Shin <jacob.shin@amd.com>,
Tejun Heo <tj@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -v2 10/13] x86: Only direct map addresses that are marked as E820_RAM
Date: Mon, 3 Sep 2012 08:34:43 +0300 [thread overview]
Message-ID: <CAOJsxLG6n==hVKwiJX_+yF+7M-NUsvUPRnxECADdn+MAP=Zj-g@mail.gmail.com> (raw)
In-Reply-To: <1346572019-15806-11-git-send-email-yinghai@kernel.org>
On Sun, Sep 2, 2012 at 10:46 AM, Yinghai Lu <yinghai@kernel.org> wrote:
> From: Jacob Shin <jacob.shin@amd.com>
>
> Currently direct mappings are created for [ 0 to max_low_pfn<<PAGE_SHIFT )
> and [ 4GB to max_pfn<<PAGE_SHIFT ), which may include regions that are not
> backed by actual DRAM. This is fine for holes under 4GB which are covered
> by fixed and variable range MTRRs to be UC. However, we run into trouble
> on higher memory addresses which cannot be covered by MTRRs.
>
> Our system with 1TB of RAM has an e820 that looks like this:
>
> BIOS-e820: [mem 0x0000000000000000-0x00000000000983ff] usable
> BIOS-e820: [mem 0x0000000000098400-0x000000000009ffff] reserved
> BIOS-e820: [mem 0x00000000000d0000-0x00000000000fffff] reserved
> BIOS-e820: [mem 0x0000000000100000-0x00000000c7ebffff] usable
> BIOS-e820: [mem 0x00000000c7ec0000-0x00000000c7ed7fff] ACPI data
> BIOS-e820: [mem 0x00000000c7ed8000-0x00000000c7ed9fff] ACPI NVS
> BIOS-e820: [mem 0x00000000c7eda000-0x00000000c7ffffff] reserved
> BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
> BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
> BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved
> BIOS-e820: [mem 0x0000000100000000-0x000000e037ffffff] usable
> BIOS-e820: [mem 0x000000e038000000-0x000000fcffffffff] reserved
> BIOS-e820: [mem 0x0000010000000000-0x0000011ffeffffff] usable
>
> and so direct mappings are created for huge memory hole between
> 0x000000e038000000 to 0x0000010000000000. Even though the kernel never
> generates memory accesses in that region, since the page tables mark
> them incorrectly as being WB, our (AMD) processor ends up causing a MCE
> while doing some memory bookkeeping/optimizations around that area.
>
> This patch iterates through e820 and only direct maps ranges that are
> marked as E820_RAM, and keeps track of those pfn ranges. Depending on
> the alignment of E820 ranges, this may possibly result in using smaller
> size (i.e. 4K instead of 2M or 1G) page tables.
>
> -v2: move changes from setup.c to mm/init.c, also use for_each_mem_pfn_range
> instead. - Yinghai Lu
> -v3: add calculate_all_table_space_size() to get correct needed page table
> size. - Yinghai Lu
>
> Signed-off-by: Jacob Shin <jacob.shin@amd.com>
Yinghai's sign-off is missing.
Reviewed-by: Pekka Enberg <penberg@kernel.org>
next prev parent reply other threads:[~2012-09-03 5:34 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-02 7:46 [PATCH -v2 00/13] x86, mm: init_memory_mapping cleanup Yinghai Lu
2012-09-02 7:46 ` [PATCH -v2 01/13] x86, mm: Add global page_size_mask Yinghai Lu
2012-09-03 5:23 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 02/13] x86, mm: Split out split_mem_range Yinghai Lu
2012-09-03 5:23 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 03/13] x86, mm: Moving init_memory_mapping calling Yinghai Lu
2012-09-03 5:24 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 04/13] x86, mm: Revert back good_end setting for 64bit Yinghai Lu
2012-09-03 5:25 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 05/13] x86, mm: Find early page table only one time Yinghai Lu
2012-09-03 5:27 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 06/13] x86, mm: Separate out calculate_table_space_size() Yinghai Lu
2012-09-03 5:28 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 07/13] x86, mm: Move down two calculate_table_space_size down Yinghai Lu
2012-09-03 5:29 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 08/13] x86: if kernel .text .data .bss are not marked as E820_RAM, complain and fix Yinghai Lu
2012-09-03 5:31 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 09/13] x86: Fixup code testing if a pfn is direct mapped Yinghai Lu
2012-09-03 5:32 ` Pekka Enberg
2012-09-02 7:46 ` [PATCH -v2 10/13] x86: Only direct map addresses that are marked as E820_RAM Yinghai Lu
2012-09-03 5:34 ` Pekka Enberg [this message]
2012-09-02 7:46 ` [PATCH -v2 11/13] x86/mm: calculate_table_space_size based on memory ranges that are being mapped Yinghai Lu
2012-09-03 5:36 ` Pekka Enberg
2012-09-03 6:21 ` Yinghai Lu
2012-09-02 7:46 ` [PATCH -v2 12/13] x86, mm: Use func pointer to table size calculation and mapping Yinghai Lu
2012-09-03 5:43 ` Pekka Enberg
2012-09-03 6:21 ` Yinghai Lu
2012-09-02 7:46 ` [PATCH -v2 13/13] x86, 64bit: Map first 1M ram early before memblock_x86_fill() Yinghai Lu
2012-09-03 5:50 ` Pekka Enberg
2012-09-03 6:17 ` Yinghai Lu
2012-09-03 6:26 ` Pekka Enberg
2012-09-03 7:18 ` Yinghai Lu
2012-09-04 2:48 ` 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='CAOJsxLG6n==hVKwiJX_+yF+7M-NUsvUPRnxECADdn+MAP=Zj-g@mail.gmail.com' \
--to=penberg@kernel.org \
--cc=hpa@zytor.com \
--cc=jacob.shin@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).