Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932955AbYGQT0y (ORCPT ); Thu, 17 Jul 2008 15:26:54 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759980AbYGQTXA (ORCPT ); Thu, 17 Jul 2008 15:23:00 -0400 Received: from monty.telenet-ops.be ([195.130.132.56]:49837 "EHLO monty.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932279AbYGQTWw (ORCPT ); Thu, 17 Jul 2008 15:22:52 -0400 Message-Id: <20080717191758.556975996@mail.of.borg> References: <20080717191607.955742542@mail.of.borg> User-Agent: quilt/0.46-1 Date: Thu, 17 Jul 2008 21:16:36 +0200 From: Geert Uytterhoeven To: Linus Torvalds , Andrew Morton Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [patch 29/29] initrd: Fix virtual/physical mix-up in overwrite test Content-Disposition: inline; filename=m68k-initrd-fix.diff Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 68 From: Geert Uytterhoeven On recent kernels, I get the following error when using an initrd: | initrd overwritten (0x00b78000 < 0x07668000) - disabling it. My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual 0x00000000). The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual). The overwrite test compares the (virtual) initrd location to the (physical) first available memory location, which fails. This patch converts initrd_start to a page frame number, so it can safely be compared with min_low_pfn. Before the introduction of discontiguous memory support on m68k (12d810c1b8c2b913d48e629e2b5c01d105029839), min_low_pfn was just left untouched by the m68k-specific code (zero, I guess), and everything worked fine. Signed-off-by: Geert Uytterhoeven --- On several platforms, initrd_below_start_ok is set to 1: | arch/mips/kernel/setup.c: initrd_below_start_ok = 1; | arch/parisc/mm/init.c: initrd_below_start_ok = 1; | arch/powerpc/kernel/prom.c: initrd_below_start_ok = 1; | arch/ppc/platforms/hdpu.c: initrd_below_start_ok = 1; | arch/xtensa/kernel/setup.c: initrd_below_start_ok = 1; Some of these may be workarounds for this bug. Please check. init/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/init/main.c +++ b/init/main.c @@ -630,9 +630,10 @@ asmlinkage void __init start_kernel(void #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start && !initrd_below_start_ok && - initrd_start < min_low_pfn << PAGE_SHIFT) { + page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) { printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - " - "disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT); + "disabling it.\n", + page_to_pfn(virt_to_page(initrd_start)), min_low_pfn); initrd_start = 0; } #endif -- Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/