public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixer <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dhaval Giani <dhaval@linux.vnet.ibm.com>,
	vgoyal@redhat.com, hbabu@us.ibm.com, kexec@lists.infradead.org
Subject: Re: [PATCH] i386: handle an initrd in highmem (version 2)
Date: Tue, 8 Jan 2008 09:30:44 +0100	[thread overview]
Message-ID: <20080108083044.GI31838@elte.hu> (raw)
In-Reply-To: <200801080502.m0852rhW017142@tazenda.hos.anvin.org>


* H. Peter Anvin <hpa@zytor.com> wrote:

> Fix crash on NUMA reported by Dhaval Giani (reported as being a kexec 
> issue.)

here's the delta fix.

	Ingo

Index: linux-x86.q/arch/x86/kernel/setup_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/kernel/setup_32.c
+++ linux-x86.q/arch/x86/kernel/setup_32.c
@@ -510,16 +510,20 @@ static void __init reserve_initrd(void)
 	unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
 	unsigned long ramdisk_here;
 
+	initrd_start = 0;
+
+	if (!boot_params.hdr.type_of_loader ||
+	    !ramdisk_image || !ramdisk_size)
+		return;		/* No initrd provided by bootloader */
+
 	if (ramdisk_end < ramdisk_image) {
-		printk(KERN_ERR "initrd wraps around end of memory\n"
-		       KERN_ERR "disabling initrd\n");
-		initrd_start = 0;
+		printk(KERN_ERR "initrd wraps around end of memory, "
+		       "disabling initrd\n");
 		return;
 	}
 	if (ramdisk_size >= end_of_lowmem/2) {
-		printk(KERN_ERR "initrd too large to handle\n"
-		       KERN_ERR "disabling initrd\n");
-		initrd_start = 0;
+		printk(KERN_ERR "initrd too large to handle, "
+		       "disabling initrd\n");
 		return;
 	}
 	if (ramdisk_end <= end_of_lowmem) {
@@ -554,9 +558,10 @@ static void __init relocate_initrd(void)
 	char *p, *q;
 
 	if (!do_relocate_initrd)
-		return;		/* Nothing to do here... */
+		return;
 
 	ramdisk_here = initrd_start - PAGE_OFFSET;
+
 	q = (char *)initrd_start;
 
 	/* Copy any lowmem portion of the initrd */
@@ -642,11 +647,10 @@ void __init setup_bootmem_allocator(void
 	 */
 	find_smp_config();
 #endif
-	numa_kva_reserve();
 #ifdef CONFIG_BLK_DEV_INITRD
-	if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image)
-		reserve_initrd();
+	reserve_initrd();
 #endif
+	numa_kva_reserve();
 	reserve_crashkernel();
 }
 
@@ -799,12 +803,13 @@ void __init setup_arch(char **cmdline_p)
 	/*
 	 * NOTE: at this point the bootmem allocator is fully available.
 	 */
-	paravirt_post_allocator_init();
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	relocate_initrd();
 #endif
 
+	paravirt_post_allocator_init();
+
 	dmi_scan_machine();
 
 	io_delay_init();
Index: linux-x86.q/arch/x86/mm/discontig_32.c
===================================================================
--- linux-x86.q.orig/arch/x86/mm/discontig_32.c
+++ linux-x86.q/arch/x86/mm/discontig_32.c
@@ -288,8 +288,8 @@ unsigned long __init setup_memory(void)
 
 #ifdef CONFIG_BLK_DEV_INITRD
 	/* Numa kva area is below the initrd */
-	if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image)
-		kva_start_pfn = PFN_DOWN(boot_params.hdr.ramdisk_image)
+	if (initrd_start)
+		kva_start_pfn = PFN_DOWN(initrd_start - PAGE_OFFSET)
 			- kva_pages;
 #endif
 	kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1);

      parent reply	other threads:[~2008-01-08  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-08  5:02 [PATCH] i386: handle an initrd in highmem (version 2) H. Peter Anvin
2008-01-08  5:41 ` Dhaval Giani
2008-01-08  8:28 ` Ingo Molnar
2008-01-08  8:30 ` Ingo Molnar [this message]

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=20080108083044.GI31838@elte.hu \
    --to=mingo@elte.hu \
    --cc=dhaval@linux.vnet.ibm.com \
    --cc=hbabu@us.ibm.com \
    --cc=hpa@zytor.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vgoyal@redhat.com \
    /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