lkml.org 
[lkml]   [2012]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [ 18/85] x86: Exclude E820_RESERVED regions and memory holes above 4 GB from direct mapping.
From
Date
On Thu, 2012-10-25 at 17:05 -0700, Greg Kroah-Hartman wrote:
> 3.6-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Jacob Shin <jacob.shin@amd.com>
>
> commit 1bbbbe779aabe1f0768c2bf8f8c0a5583679b54a upstream.
>
> On systems with very large memory (1 TB in our case), BIOS may report a
> reserved region or a hole in the E820 map, even above the 4 GB range. Exclude
> these from the direct mapping.
>
> [ hpa: this should be done not just for > 4 GB but for everything above the legacy
> region (1 MB), at the very least. That, however, turns out to require significant
> restructuring. That work is well underway, but is not suitable for rc/stable. ]
[...]
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -919,8 +919,21 @@ void __init setup_arch(char **cmdline_p)
>
> #ifdef CONFIG_X86_64
> if (max_pfn > max_low_pfn) {
> - max_pfn_mapped = init_memory_mapping(1UL<<32,
> - max_pfn<<PAGE_SHIFT);
> + int i;
> + for (i = 0; i < e820.nr_map; i++) {
> + struct e820entry *ei = &e820.map[i];
> +
> + if (ei->addr + ei->size <= 1UL << 32)
> + continue;
> +
> + if (ei->type == E820_RESERVED)
> + continue;
> +
> + max_pfn_mapped = init_memory_mapping(
> + ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
> + ei->addr + ei->size);

Is it safe to assume that the e820 entries are sorted? If not, this
assignment needs to be conditional.

Ben.

> + }
> +
> /* can we preseve max_low_pfn ?*/
> max_low_pfn = max_pfn;
> }

--
Ben Hutchings
Never attribute to conspiracy what can adequately be explained by stupidity.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-10-27 19:01    [W:2.283 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site