From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Yinghai <yinghai@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [PATCH 0/4] memblock related fixes for -tip
Date: Wed, 13 Oct 2010 17:24:36 -0700 [thread overview]
Message-ID: <4CB64DC4.6070303@goop.org> (raw)
In-Reply-To: <3149FE7E-AE5A-496D-8D54-03224C105015@kernel.org>
On 10/13/2010 05:08 PM, Yinghai wrote:
>
> On Oct 13, 2010, at 4:34 PM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>
>> On 10/13/2010 04:18 PM, H. Peter Anvin wrote:
>>> On 10/13/2010 04:14 PM, Jeremy Fitzhardinge wrote:
>>>> The Xen code is setting the max_pfn_mapped correctly, but it is just
>>>> being overridden by:
>>>>
>>>> max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
>>>>
>>>> in setup_arch() - and KERNEL_IMAGE_SIZE is hard-coded to 512MB...
>>>>
>>>> How is this correct? Does kernel/head_64.S map everything up to 512MB
>>>> or something?
>>>>
>>> Yes:
>>> /*
>>> * 512 MB kernel mapping. We spend a full page on this pagetable
>>> * anyway.
>>> *
>>> * The kernel code+data+bss must not be bigger than that.
>>> *
>>> * (NOTE: at +512MB starts the module area, see MODULES_VADDR.
>>> * If you want to increase this then increase MODULES_VADDR
>>> * too.)
>>> */
>>> PMDS(0, __PAGE_KERNEL_LARGE_EXEC,
>>> KERNEL_IMAGE_SIZE/PMD_SIZE)
>>>
>>> This is, however, wrong in the sense that it obviously shouldn't be
>>> getting executed on the Xen codepath.
>> I see. head_32.S sets max_pfn_mapped for itself, so head_64.S should
>> probably do that too. Patch below, but I haven't checked to see if it
>> fixes the original problem (but I don't see why the pagetable memory
>> allocation should be limited to the mapped region, especially if you
>> want to put it as high as possible, especially since the mm/init_64.c
>> code doesn't expect it to be mapped).
>>
>> J
>>
>> From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>> Date: Wed, 13 Oct 2010 16:31:11 -0700
>> Subject: [PATCH] x86-64: don't force max_pfn_mapped to 512MB
>>
>> head_64.S maps up to 512MB, but the Xen entry path doesn't necessarily
>> map that high. Set max_pfn_mapped in head_64.S accordingly. (The Xen
>> code already sets max_pfn_mapped correctly.)
>>
>> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
>>
>> diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
>> index 239046b..b75c6f4 100644
>> --- a/arch/x86/kernel/head_64.S
>> +++ b/arch/x86/kernel/head_64.S
>> @@ -141,6 +141,8 @@ ident_complete:
>> addq %rbp, trampoline_level4_pgt + (511*8)(%rip)
>> #endif
>>
>> + movq $KERNEL_IMAGE_SIZE / PAGE_SIZE, max_pfn_mapped(%rip)
>> +
>> /* Due to ENTRY(), sometimes the empty space gets filled with
>> * zeros. Better take a jmp than relying on empty space being
>> * filled with 0x90 (nop)
>> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
>> index b11a238..c3cebfe 100644
>> --- a/arch/x86/kernel/setup.c
>> +++ b/arch/x86/kernel/setup.c
>> @@ -932,7 +932,6 @@ void __init setup_arch(char **cmdline_p)
>> max_low_pfn = max_pfn;
>>
>> high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
>> - max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
>> #endif
>>
>> /*
>>
> I like this one, can you check if only this one is needed ?
It is sufficient, but I'd prefer to have both. I don't think limiting
the pagetable allocation to mapped memory is necessarily correct, and
there's no harm in making the Xen code more robust (plus it cleans up a
couple of #ifdefs).
J
next prev parent reply other threads:[~2010-10-14 0:24 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-04 21:57 [PATCH 0/4] memblock related fixes for -tip Yinghai Lu
2010-10-06 22:52 ` Jeremy Fitzhardinge
2010-10-06 22:57 ` Yinghai Lu
2010-10-06 22:59 ` H. Peter Anvin
2010-10-07 18:31 ` Jeremy Fitzhardinge
2010-11-03 5:05 ` Debug patches for memblock Yinghai Lu
2010-11-03 5:13 ` Jeremy Fitzhardinge
2010-10-12 0:01 ` [tip:core/memblock] memblock: Allow memblock_init to be called early tip-bot for Jeremy Fitzhardinge
2010-10-12 18:41 ` [PATCH 0/4] memblock related fixes for -tip Jeremy Fitzhardinge
2010-10-12 18:45 ` Yinghai Lu
2010-10-12 21:12 ` Yinghai Lu
2010-10-12 21:42 ` Jeremy Fitzhardinge
2010-10-12 21:50 ` H. Peter Anvin
2010-10-12 22:02 ` Yinghai Lu
2010-10-12 21:42 ` H. Peter Anvin
2010-10-12 22:01 ` Yinghai Lu
2010-10-12 22:10 ` H. Peter Anvin
2010-10-12 23:37 ` Jeremy Fitzhardinge
2010-10-13 5:40 ` Yinghai Lu
2010-10-13 16:31 ` Jeremy Fitzhardinge
2010-10-13 18:12 ` Yinghai Lu
2010-10-13 18:20 ` H. Peter Anvin
2010-10-13 20:03 ` Jeremy Fitzhardinge
2010-10-13 21:03 ` H. Peter Anvin
2010-10-13 23:02 ` Jeremy Fitzhardinge
2010-10-13 23:07 ` H. Peter Anvin
2010-10-14 0:31 ` [tip:core/memblock] xen: Cope with unmapped pages when initializing kernel pagetable tip-bot for Jeremy Fitzhardinge
2010-10-13 22:06 ` [PATCH 0/4] memblock related fixes for -tip Yinghai Lu
2010-10-13 23:07 ` Jeremy Fitzhardinge
2010-10-13 23:14 ` Jeremy Fitzhardinge
2010-10-13 23:18 ` H. Peter Anvin
2010-10-13 23:34 ` Jeremy Fitzhardinge
2010-10-14 0:08 ` Yinghai
2010-10-14 0:24 ` Jeremy Fitzhardinge [this message]
2010-10-14 0:27 ` H. Peter Anvin
2010-10-14 0:31 ` [tip:core/memblock] x86-64: Only set max_pfn_mapped to 512 MiB if we enter via head_64.S tip-bot for Jeremy Fitzhardinge
2010-10-14 5:57 ` Ingo Molnar
2010-10-14 5:59 ` Ingo Molnar
2010-10-14 6:06 ` Ingo Molnar
2010-10-14 6:07 ` Yinghai Lu
2010-10-14 6:37 ` Ingo Molnar
2010-10-14 7:03 ` Yinghai Lu
2010-10-14 7:42 ` tip-bot for Jeremy Fitzhardinge
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=4CB64DC4.6070303@goop.org \
--to=jeremy@goop.org \
--cc=benh@kernel.crashing.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=vgoyal@redhat.com \
--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.