From: Yinghai Lu <yhlu.kernel@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86: introduce init_memory_mapping for 32bit #2
Date: Tue, 24 Jun 2008 12:18:58 -0700 [thread overview]
Message-ID: <200806241218.58613.yhlu.kernel@gmail.com> (raw)
In-Reply-To: <200806241218.14436.yhlu.kernel@gmail.com>
moving relocate_initrd early
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
---
arch/x86/kernel/setup_32.c | 22 +++++++---------------
arch/x86/mm/init_32.c | 3 ---
include/asm-x86/setup.h | 1 -
3 files changed, 7 insertions(+), 19 deletions(-)
Index: xy/arch/x86/kernel/setup_32.c
===================================================================
--- xy.orig/arch/x86/kernel/setup_32.c
+++ xy/arch/x86/kernel/setup_32.c
@@ -187,7 +187,7 @@ static inline void copy_edd(void)
#ifdef CONFIG_BLK_DEV_INITRD
-static bool do_relocate_initrd = false;
+static void __init relocate_initrd(void);
static void __init reserve_initrd(void)
{
@@ -196,7 +196,6 @@ static void __init reserve_initrd(void)
u64 ramdisk_end = ramdisk_image + ramdisk_size;
u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
u64 ramdisk_here;
- u64 ramdisk_target;
if (!boot_params.hdr.type_of_loader ||
!ramdisk_image || !ramdisk_size)
@@ -243,12 +242,12 @@ static void __init reserve_initrd(void)
printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n",
ramdisk_here, ramdisk_here + ramdisk_size);
- do_relocate_initrd = true;
+ relocate_initrd();
}
#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
-void __init post_reserve_initrd(void)
+static void __init relocate_initrd(void)
{
u64 ramdisk_image = boot_params.hdr.ramdisk_image;
u64 ramdisk_size = boot_params.hdr.ramdisk_size;
@@ -257,9 +256,6 @@ void __init post_reserve_initrd(void)
unsigned long slop, clen, mapaddr;
char *p, *q;
- if (!do_relocate_initrd)
- return;
-
ramdisk_here = initrd_start - PAGE_OFFSET;
q = (char *)initrd_start;
@@ -270,10 +266,6 @@ void __init post_reserve_initrd(void)
p = (char *)__va(ramdisk_image);
memcpy(q, p, clen);
q += clen;
- /* need to free these low pages...*/
- printk(KERN_INFO "Freeing old partial RAMDISK %08llx-%08llx\n",
- ramdisk_image, ramdisk_image + clen - 1);
- free_bootmem(ramdisk_image, clen);
ramdisk_image += clen;
ramdisk_size -= clen;
}
@@ -299,16 +291,16 @@ void __init post_reserve_initrd(void)
ramdisk_image, ramdisk_image + ramdisk_size - 1,
ramdisk_here, ramdisk_here + ramdisk_size - 1);
- /* need to free that, otherwise init highmem will reserve it again */
+ /*
+ * need to free old one, otherwise init cross max_low_pfn could be
+ * converted to bootmem
+ */
free_early(ramdisk_image, ramdisk_image+ramdisk_size);
}
#else
void __init reserve_initrd(void)
{
}
-void __init post_reserve_initrd(void)
-{
-}
#endif /* CONFIG_BLK_DEV_INITRD */
#ifdef CONFIG_MCA
Index: xy/arch/x86/mm/init_32.c
===================================================================
--- xy.orig/arch/x86/mm/init_32.c
+++ xy/arch/x86/mm/init_32.c
@@ -831,9 +831,6 @@ void __init paging_init(void)
/*
* NOTE: at this point the bootmem allocator is fully available.
*/
-
- post_reserve_initrd();
-
remapped_pgdat_init();
sparse_init();
zone_sizes_init();
Index: xy/include/asm-x86/setup.h
===================================================================
--- xy.orig/include/asm-x86/setup.h
+++ xy/include/asm-x86/setup.h
@@ -39,7 +39,6 @@ void reserve_crashkernel(void);
#include <asm/bootparam.h>
void reserve_standard_io_resources(void);
-extern void post_reserve_initrd(void);
#ifndef _SETUP
next prev parent reply other threads:[~2008-06-24 19:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 2:51 [PATCH] x86: move some func calling from setup_arch to paging_init Yinghai Lu
2008-06-24 2:52 ` [PATCH] x86: setup_arch 64bit move efi_init calling early Yinghai Lu
2008-06-24 2:52 ` [PATCH] x86: setup_arch 64bit move kvmclock_init later Yinghai Lu
2008-06-24 2:53 ` [PATCH] x86: setup_arch 32bit move efi check later Yinghai Lu
2008-06-24 2:54 ` [PATCH] x86: setup_arch 32bit move command line copying early Yinghai Lu
2008-06-24 2:55 ` [PATCH] x86: setup_arch 32bit move kvm_guest_init later Yinghai Lu
2008-06-24 10:53 ` Ingo Molnar
2008-06-24 11:10 ` Yinghai Lu
2008-06-24 11:10 ` [PATCH] x86: introduce init_memory_mapping for 32bit Yinghai Lu
2008-06-24 11:30 ` Ingo Molnar
2008-06-24 17:16 ` Yinghai Lu
2008-06-24 19:22 ` Yinghai Lu
2008-06-24 22:02 ` Yinghai Lu
2008-06-25 14:45 ` Ingo Molnar
2008-06-24 19:18 ` [PATCH] x86: introduce init_memory_mapping for 32bit #1 Yinghai Lu
2008-06-24 19:18 ` Yinghai Lu [this message]
2008-06-24 19:19 ` [PATCH] x86: introduce init_memory_mapping for 32bit #3 Yinghai Lu
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=200806241218.58613.yhlu.kernel@gmail.com \
--to=yhlu.kernel@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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