LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Dave Hansen <dave.hansen@intel.com>,
	Yinghai Lu <yinghai@kernel.org>, <stable@vger.kernel.org>
Subject: [PATCH] x86: Fix booting with DEBUG_PAGE_ALLOC with more than 512G RAM
Date: Mon, 12 Aug 2013 16:43:24 -0700
Message-ID: <1376351004-4015-1-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <52090CF2.3040505@sr71.net>

Dave reported that system have early crash if DEBUG_PAGEALLOC is selected,
when system have between 500G and 600G.

> [    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
> [    0.000000]  [mem 0x00000000-0x000fffff] page 4k
> [    0.000000] BRK [0x02086000, 0x02086fff] PGTABLE
> [    0.000000] BRK [0x02087000, 0x02087fff] PGTABLE
> [    0.000000] BRK [0x02088000, 0x02088fff] PGTABLE
> [    0.000000] init_memory_mapping: [mem 0xe80ee00000-0xe80effffff]
> [    0.000000]  [mem 0xe80ee00000-0xe80effffff] page 4k
> [    0.000000] BRK [0x02089000, 0x02089fff] PGTABLE
> [    0.000000] BRK [0x0208a000, 0x0208afff] PGTABLE
> [    0.000000] Kernel panic - not syncing: alloc_low_page: ran out of memory

It turns out that we missed increasing needed pages in BRK to mapping
initial 2M and [0,1M) when we switch to use #PF handler set mem mapping.

> commit 8170e6bed465b4b0c7687f93e9948aca4358a33b
> Author: H. Peter Anvin <hpa@zytor.com>
> Date:   Thu Jan 24 12:19:52 2013 -0800
>
>     x86, 64bit: Use a #PF handler to materialize early mappings on demand

Before that, we have maping from [0,512M) in head_64.S, and we can
spare two pages [0-1M).  After that change, we can not reuse pages anymore.

When we have more than 512M ram, we need extra page for pgd page with
[512G, 1024g).

Increase pages in BRK for page table to solve the booting problem.

Reported-by: Dave Hansen <dave.hansen@intel.com>
Bisected-by: Dave Hansen <dave.hansen@intel.com>
Tested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: <stable@vger.kernel.org> 3.9+

---
 arch/x86/mm/init.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/mm/init.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init.c
+++ linux-2.6/arch/x86/mm/init.c
@@ -78,8 +78,8 @@ __ref void *alloc_low_pages(unsigned int
 	return __va(pfn << PAGE_SHIFT);
 }
 
-/* need 4 4k for initial PMD_SIZE, 4k for 0-ISA_END_ADDRESS */
-#define INIT_PGT_BUF_SIZE	(5 * PAGE_SIZE)
+/* need 3 4k for initial PMD_SIZE,  3 4k for 0-ISA_END_ADDRESS */
+#define INIT_PGT_BUF_SIZE	(6 * PAGE_SIZE)
 RESERVE_BRK(early_pgt_alloc, INIT_PGT_BUF_SIZE);
 void  __init early_alloc_pgt_buf(void)
 {

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-09 23:18 x86: early boot crash: "alloc_low_page: ran out of memory" (bisected) Dave Hansen
2013-08-09 23:23 ` Yinghai Lu
2013-08-10  1:19   ` Dave Hansen
2013-08-10  2:10     ` Yinghai Lu
2013-08-10  2:21       ` Yinghai Lu
2013-08-12 16:27         ` Dave Hansen
2013-08-12 23:43           ` Yinghai Lu [this message]
2013-08-12 23:50             ` [PATCH] x86: Fix booting with DEBUG_PAGE_ALLOC with more than 512G RAM Dave Hansen
2013-08-12 23:59               ` Yinghai Lu
2013-08-20  8:22             ` [tip:x86/urgent] x86/mm: Fix boot crash with DEBUG_PAGE_ALLOC= y and " tip-bot for Yinghai Lu
2013-08-12 23:47           ` x86: early boot crash: "alloc_low_page: ran out of memory" (bisected) Yinghai Lu

Reply instructions:

You may reply publically 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=1376351004-4015-1-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable@vger.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox