linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [patch 29/29] initrd: Fix virtual/physical mix-up in overwrite test
Date: Thu, 17 Jul 2008 21:16:36 +0200	[thread overview]
Message-ID: <20080717191758.556975996@mail.of.borg> (raw)
In-Reply-To: 20080717191607.955742542@mail.of.borg

[-- Attachment #1: m68k-initrd-fix.diff --]
[-- Type: text/plain, Size: 2246 bytes --]

From: Geert Uytterhoeven <geert@linux-m68k.org>

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 <geert@linux-m68k.org>
---
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


  parent reply	other threads:[~2008-07-17 19:26 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-17 19:16 [patch 00/29] m68k patches for 2.6.27 Geert Uytterhoeven
2008-07-17 19:16 ` [patch 01/29] m68k: remove CVS keywords Geert Uytterhoeven
2008-07-17 19:16 ` [patch 02/29] ariadne: use netstats in net_device structure Geert Uytterhoeven
2008-07-17 19:45   ` Jeff Garzik
2008-07-17 19:16 ` [patch 03/29] m68k: Return -ENODEV if no device is found Geert Uytterhoeven
2008-07-17 19:16 ` [patch 04/29] m68k: vmlinux-std/sun3.lds.S cleanup - use PAGE_SIZE macro Geert Uytterhoeven
2008-07-17 19:16 ` [patch 05/29] m68k: Allow no CPU/platform type for allnoconfig Geert Uytterhoeven
2008-07-17 19:16 ` [patch 06/29] m68k: remove -traditional Geert Uytterhoeven
2008-07-17 19:16 ` [patch 07/29] m68k: make multi_defconfig the default defconfig Geert Uytterhoeven
2008-07-17 19:16 ` [patch 08/29] m68k: remove AP1000 code Geert Uytterhoeven
2008-07-17 19:16 ` [patch 09/29] ZORRO: Replace deprecated __initcall with equivalent device_initcall Geert Uytterhoeven
2008-07-17 19:16 ` [patch 10/29] zorro: use memory_read_from_buffer Geert Uytterhoeven
2008-07-17 19:16 ` [patch 11/29] amifb: Register Amiga-specific video modes with sysfs Geert Uytterhoeven
2008-07-17 19:16 ` [patch 12/29] atafb: Register Atari-specific " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 13/29] drivers/video/c2p.c: add MODULE_LICENSE Geert Uytterhoeven
2008-07-17 19:16 ` [patch 14/29] export amiga_vblank Geert Uytterhoeven
2008-07-17 19:16 ` [patch 15/29] export c2p Geert Uytterhoeven
2008-07-17 19:16 ` [patch 16/29] m68k/amiga/: possible cleanups Geert Uytterhoeven
2008-07-17 19:16 ` [patch 17/29] m68k/atari/debug.c: " Geert Uytterhoeven
2008-07-20 20:06   ` Michael Schmitz
2008-07-21  0:11     ` Geert Uytterhoeven
2008-07-17 19:16 ` [patch 18/29] m68k/mac/: " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 19/29] m68k/q40/config.c: make functions static Geert Uytterhoeven
2008-07-17 19:16 ` [patch 20/29] m68k/sun3/: possible cleanups Geert Uytterhoeven
2008-07-17 19:16 ` [patch 21/29] m68k: remove stale ARCH_SUN4 #define Geert Uytterhoeven
2008-07-17 19:16 ` [patch 22/29] m68k/apollo: Add missing call to apollo_parse_bootinfo() Geert Uytterhoeven
2008-07-17 19:16 ` [patch 23/29] m68k/Mac: remove the unused ADB_KEYBOARD option Geert Uytterhoeven
2008-07-17 19:16 ` [patch 24/29] m68k/Atari: remove the dead ATARI_SCC{,_DMA} options Geert Uytterhoeven
2008-07-17 19:16 ` [patch 25/29] m68k/Apollo: remove the unused APOLLO_ELPLUS option Geert Uytterhoeven
2008-07-17 19:16 ` [patch 26/29] arch/m68k/mm/motorola.c: Eliminate NULL test and memset after alloc_bootmem Geert Uytterhoeven
2008-07-17 19:16 ` [patch 27/29] arch/m68k/mm/sun3mmu.c: " Geert Uytterhoeven
2008-07-17 19:16 ` [patch 28/29] dio: use dio_match_device() in dio_bus_match() Geert Uytterhoeven
2008-07-17 19:16 ` Geert Uytterhoeven [this message]
2008-07-24 15:35   ` [patch 29/29] initrd: Fix virtual/physical mix-up in overwrite test Atsushi Nemoto
2008-07-24 18:49     ` Geert Uytterhoeven
2008-07-25 16:27       ` Atsushi Nemoto
2008-07-25 19:22         ` Geert Uytterhoeven
2008-07-26 14:46           ` Atsushi Nemoto

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=20080717191758.556975996@mail.of.borg \
    --to=geert@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).