From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755188Ab0CESn0 (ORCPT ); Fri, 5 Mar 2010 13:43:26 -0500 Received: from hera.kernel.org ([140.211.167.34]:35687 "EHLO hera.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754151Ab0CESnZ (ORCPT ); Fri, 5 Mar 2010 13:43:25 -0500 Message-ID: <4B915074.4020704@kernel.org> Date: Fri, 05 Mar 2010 10:41:56 -0800 From: Yinghai Lu User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0 MIME-Version: 1.0 To: Greg Thelen , Andrew Morton , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar CC: Johannes Weiner , linux-mm@kvack.org, "linux-kernel@vger.kernel.org" Subject: Re: mmotm boot panic bootmem-avoid-dma32-zone-by-default.patch References: <49b004811003041321g2567bac8yb73235be32a27e7c@mail.gmail.com> <20100305032106.GA12065@cmpxchg.org> <49b004811003042117n720f356h7e10997a1a783475@mail.gmail.com> In-Reply-To: <49b004811003042117n720f356h7e10997a1a783475@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/04/2010 09:17 PM, Greg Thelen wrote: > On Thu, Mar 4, 2010 at 7:21 PM, Johannes Weiner wrote: >> On Thu, Mar 04, 2010 at 01:21:41PM -0800, Greg Thelen wrote: >>> On several systems I am seeing a boot panic if I use mmotm >>> (stamp-2010-03-02-18-38). If I remove >>> bootmem-avoid-dma32-zone-by-default.patch then no panic is seen. I >>> find that: >>> * 2.6.33 boots fine. >>> * 2.6.33 + mmotm w/o bootmem-avoid-dma32-zone-by-default.patch: boots fine. >>> * 2.6.33 + mmotm (including >>> bootmem-avoid-dma32-zone-by-default.patch): panics. ... > > Note: mmotm has been recently updated to stamp-2010-03-04-18-05. I > re-tested with 'make defconfig' to confirm the panic with this later > mmotm. please check [PATCH] early_res: double check with updated goal in alloc_memory_core_early Johannes Weiner pointed out that new early_res replacement for alloc_bootmem_node change the behavoir about goal. original bootmem one will try go further regardless of goal. and it will break his patch about default goal from MAX_DMA to MAX_DMA32... also broke uncommon machines with <=16M of memory. (really? our x86 kernel still can run on 16M system?) so try again with update goal. Reported-by: Greg Thelen Signed-off-by: Yinghai Lu --- mm/bootmem.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) Index: linux-2.6/mm/bootmem.c =================================================================== --- linux-2.6.orig/mm/bootmem.c +++ linux-2.6/mm/bootmem.c @@ -170,6 +170,28 @@ void __init free_bootmem_late(unsigned l } #ifdef CONFIG_NO_BOOTMEM +static void * __init ___alloc_memory_core_early(pg_data_t *pgdat, u64 size, + u64 align, u64 goal, u64 limit) +{ + void *ptr; + unsigned long end_pfn; + + ptr = __alloc_memory_core_early(pgdat->node_id, size, align, + goal, limit); + if (ptr) + return ptr; + + /* check goal according */ + end_pfn = pgdat->node_start_pfn + pgdat->node_spanned_pages; + if ((end_pfn << PAGE_SHIFT) < (goal + size)) { + goal = pgdat->node_start_pfn << PAGE_SHIFT; + ptr = __alloc_memory_core_early(pgdat->node_id, size, align, + goal, limit); + } + + return ptr; +} + static void __init __free_pages_memory(unsigned long start, unsigned long end) { int i; @@ -836,7 +858,7 @@ void * __init __alloc_bootmem_node(pg_da return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); #ifdef CONFIG_NO_BOOTMEM - return __alloc_memory_core_early(pgdat->node_id, size, align, + return ___alloc_memory_core_early(pgdat, size, align, goal, -1ULL); #else return ___alloc_bootmem_node(pgdat->bdata, size, align, goal, 0); @@ -920,7 +942,7 @@ void * __init __alloc_bootmem_node_nopan return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); #ifdef CONFIG_NO_BOOTMEM - ptr = __alloc_memory_core_early(pgdat->node_id, size, align, + ptr = ___alloc_memory_core_early(pgdat, size, align, goal, -1ULL); #else ptr = alloc_arch_preferred_bootmem(pgdat->bdata, size, align, goal, 0); @@ -980,7 +1002,7 @@ void * __init __alloc_bootmem_low_node(p return kzalloc_node(size, GFP_NOWAIT, pgdat->node_id); #ifdef CONFIG_NO_BOOTMEM - return __alloc_memory_core_early(pgdat->node_id, size, align, + return ___alloc_memory_core_early(pgdat, size, align, goal, ARCH_LOW_ADDRESS_LIMIT); #else return ___alloc_bootmem_node(pgdat->bdata, size, align,