mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"H. Peter Anvin" <hpa@linux.intel.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Yinghai Lu <yinghai@kernel.org>
Subject: Re: [PATCH 0/3] x86: remove x86_init.mapping.pagetable_reserve
Date: Wed, 22 Jun 2011 18:16:11 +0100	[thread overview]
Message-ID: <alpine.DEB.2.00.1106221224100.12963@kaball-desktop> (raw)
In-Reply-To: <20110621205859.GA2446@elte.hu>

On Tue, 21 Jun 2011, Ingo Molnar wrote:
> 
> -tip testing found that these patches cause the following boot crash 
> on native:
> 
> [    0.000000] Base memory trampoline at [ffff88000009d000] 9d000 size 8192
> [    0.000000] init_memory_mapping: 0000000000000000-000000003fff0000
> [    0.000000]  0000000000 - 003fff0000 page 4k
> [    0.000000] kernel direct mapping tables up to 3fff0000 @ 3fef0000-3fff0000
> [    0.000000] Kernel panic - not syncing: alloc_low_page: ran out of memory
> 
> Config attached, full bootlog below. I've excluded the commits for 
> now.
> 

Thanks for the logs; I was able to reproduce the problem and I know what
the issue is: CONFIG_DEBUG_PAGEALLOC forces use_pse to 0 while
on x86_64 cpu_has_pse is 1.
As a consequence the initial pagetable allocator in head_64.S didn't
allocate any pte pages but find_early_table_space assumes it did.
The issue doesn't happen on x86_32 (PAE and non-PAE) because head_32.S
always uses 4KB pages.

The patch below fixes the problem: on x86_64 we should not limit the
memory size we need to cover with 4KB ptes depending on the initial
allocation, because head_64.S always uses 2MB pages.

Ingo, if you know any other debug config options that might affect
page table allocations, please let me know.

---

commit 2b66a94cf8dbbf4cf2148456381b8674ed8191f0
Author: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Date:   Wed Jun 22 11:46:23 2011 +0000

    x86_64: do not assume head_64.S used 4KB pages when !use_pse
    
    head_64.S, which sets up the initial page table on x86_64, is not aware
    of PSE being enabled or disabled and it always allocates the initial
    mapping using 2MB pages.
    
    Therefore on x86_64 find_early_table_space shouldn't update the amount
    of pages needed for pte pages depending on the size of the initial
    mapping, because we know for sure that no pte pages have been allocated
    yet.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
    Reported-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 36bacfe..1e3098b 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -42,12 +42,19 @@ static void __init find_early_table_space(unsigned long start,
 			(PMD_SIZE * PTRS_PER_PMD));
 	pmd_mapped *= (PMD_SIZE * PTRS_PER_PMD);
 
+	/* 
+	 * On x86_64 do not limit the size we need to cover with 4KB pages
+	 * depending on the initial allocation because head_64.S always uses
+	 * 2MB pages.
+	 */
+#ifdef CONFIG_X86_32
 	if (start < PFN_PHYS(max_pfn_mapped)) {
 		if (PFN_PHYS(max_pfn_mapped) < end)
 			size -= PFN_PHYS(max_pfn_mapped) - start;
 		else
 			size = 0;
 	}
+#endif
 
 #ifndef __PAGETABLE_PUD_FOLDED
 	if (end > pud_mapped) {

      reply	other threads:[~2011-06-22 17:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07 18:13 Stefano Stabellini
2011-06-07 18:13 ` [PATCH 1/3] x86: calculate precisely the memory needed by init_memory_mapping stefano.stabellini
2011-06-20 22:37   ` H. Peter Anvin
2011-06-21 17:57     ` Stefano Stabellini
2011-06-21 18:02       ` H. Peter Anvin
2011-06-21 20:37   ` [tip:x86/mm] x86, mm: Calculate " tip-bot for Stefano Stabellini
2011-06-07 18:13 ` [PATCH 2/3] Revert "x86,xen: introduce x86_init.mapping.pagetable_reserve" stefano.stabellini
2011-06-21 20:37   ` [tip:x86/mm] " tip-bot for Stefano Stabellini
2011-06-07 18:13 ` [PATCH 3/3] x86: move memblock_x86_reserve_range PGTABLE to find_early_table_space stefano.stabellini
2011-06-21 20:38   ` [tip:x86/mm] x86, init : Move " tip-bot for Stefano Stabellini
     [not found] ` <m2n.s.1QU0lc-137774@chiark.greenend.org.uk>
2011-06-17 17:11   ` [Xen-devel] [PATCH 1/3] x86: calculate precisely the memory needed by init_memory_mapping Ian Jackson
2011-06-20 19:16     ` Stefano Stabellini
2011-06-21 20:58 ` [PATCH 0/3] x86: remove x86_init.mapping.pagetable_reserve Ingo Molnar
2011-06-22 17:16   ` Stefano Stabellini [this message]

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=alpine.DEB.2.00.1106221224100.12963@kaball-desktop \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=xen-devel@lists.xensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®