From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949Ab2GSQ2i (ORCPT ); Thu, 19 Jul 2012 12:28:38 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:35907 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559Ab2GSQ2d (ORCPT ); Thu, 19 Jul 2012 12:28:33 -0400 Message-ID: <500835AB.1090103@canonical.com> Date: Thu, 19 Jul 2012 09:28:27 -0700 From: Stefan Bader User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Linux Kernel Mailing List , Ingo Molnar CC: WANG Cong , Yinghai Lu , Tejun Heo , Andrew Morton Subject: Re: x86/mm: Limit 2/4M size calculation to x86_32 References: <5000259D.9020303@canonical.com> In-Reply-To: <5000259D.9020303@canonical.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/13/2012 06:41 AM, Stefan Bader wrote: > I was bisecting a problem on 64bit where any attempt to cause a crash kernel to > boot would hang. The bisect ended up on commit 722bc6b (x86/mm: Fix the size > calculation of mapping tables) and somehow, looking at the calling function and > the ranges printed on boot, I think the calculations should only be done in the > 32bit case. > > On 64bit: > [ 0.000000] init_memory_mapping: [mem 0x00000000-0x77e87fff] > [ 0.000000] [mem 0x00000000-0x77dfffff] page 2M > [ 0.000000] [mem 0x77e00000-0x77e87fff] page 4k > > Attached patch would fix this if you agree with it. Thanks. > Any news on this one? I thought it would be quite simple to check for sanity and not wasting memory sounds like a good thing to do. Even though there is plenty of it around most of the time. ;) -Stefan > -Stefan > > > From 6b679d1af20656929c0e829f29eed60b0a86a74f Mon Sep 17 00:00:00 2001 > From: Stefan Bader > Date: Fri, 13 Jul 2012 15:16:33 +0200 > Subject: [PATCH] x86/mm: Limit 2/4M size calculation to x86_32 > > commit 722bc6b (x86/mm: Fix the size calculation of mapping tables) > did modify the extra space calculation for mapping tables in order > to make up for the first 2/4M memory range using 4K pages. > However this setup is only used when compiling for 32bit. On 64bit > there is only the trailing area of 4K pages (which is already added). > > The code was already adapted once for things went wrong on a 8TB > machine (bd2753b x86/mm: Only add extra pages count for the first memory > range during pre-allocation early page table space), but it looks a bit > like it currently would overdo things for 64bit. > I only noticed while bisecting for the reason I could not make a crash > kernel boot (which ended up on this patch). > > Signed-off-by: Stefan Bader > Cc: WANG Cong > Cc: Yinghai Lu > Cc: Tejun Heo > --- > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c > index bc4e9d8..636bbfd 100644 > --- a/arch/x86/mm/init.c > +++ b/arch/x86/mm/init.c > @@ -60,10 +60,11 @@ static void __init find_early_table_space(struct map_range > *mr, unsigned long en > extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT); > #ifdef CONFIG_X86_32 > extra += PMD_SIZE; > -#endif > + > /* The first 2/4M doesn't use large pages. */ > if (mr->start < PMD_SIZE) > extra += mr->end - mr->start; > +#endif > > ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT; > } else >