* [PATCH] x86: clean up reserve_bootmem_generic
@ 2008-06-13 9:00 Yinghai Lu
2008-06-13 11:22 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Yinghai Lu @ 2008-06-13 9:00 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org
1. add reserve_bootmem_generic for 32bit
2. change len to unsigned long
3. make early_res_to_bootmem to use it
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -635,7 +635,7 @@ void __init early_res_to_bootmem(u64 sta
continue;
printk(KERN_INFO " early res: %d [%llx-%llx] %s\n", i,
final_start, final_end - 1, r->name);
- reserve_bootmem(final_start, final_end - final_start,
+ reserve_bootmem_generic(final_start, final_end - final_start,
BOOTMEM_DEFAULT);
}
}
Index: linux-2.6/arch/x86/kernel/mpparse.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/mpparse.c
+++ linux-2.6/arch/x86/kernel/mpparse.c
@@ -859,10 +859,11 @@ static int __init smp_scan_config(unsign
if (!reserve)
return 1;
-#ifdef CONFIG_X86_32
- reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
+ reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
BOOTMEM_DEFAULT);
if (mpf->mpf_physptr) {
+ unsigned long size = PAGE_SIZE;
+#ifdef CONFIG_X86_32
/*
* We cannot access to MPC table to compute
* table size yet, as only few megabytes from
@@ -872,22 +873,15 @@ static int __init smp_scan_config(unsign
* PAGE_SIZE from mpg->mpf_physptr yields BUG()
* in reserve_bootmem.
*/
- unsigned long size = PAGE_SIZE;
unsigned long end = max_low_pfn * PAGE_SIZE;
if (mpf->mpf_physptr + size > end)
size = end - mpf->mpf_physptr;
- reserve_bootmem(mpf->mpf_physptr, size,
+#endif
+ reserve_bootmem_generic(mpf->mpf_physptr, size,
BOOTMEM_DEFAULT);
}
-#else
- reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
- BOOTMEM_DEFAULT);
- if (mpf->mpf_physptr)
- reserve_bootmem_generic(mpf->mpf_physptr,
- PAGE_SIZE, BOOTMEM_DEFAULT);
-#endif
- return 1;
+ return 1;
}
bp += 4;
length -= 16;
Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_32.c
+++ linux-2.6/arch/x86/mm/init_32.c
@@ -781,3 +781,9 @@ void free_initrd_mem(unsigned long start
free_init_pages("initrd memory", start, end);
}
#endif
+
+int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+ int flags)
+{
+ return reserve_bootmem(phys, len, flags);
+}
Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -827,7 +827,8 @@ void free_initrd_mem(unsigned long start
}
#endif
-int __init reserve_bootmem_generic(unsigned long phys, unsigned len, int flags)
+int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+ int flags)
{
#ifdef CONFIG_NUMA
int nid, next_nid;
Index: linux-2.6/include/asm-x86/proto.h
===================================================================
--- linux-2.6.orig/include/asm-x86/proto.h
+++ linux-2.6/include/asm-x86/proto.h
@@ -14,8 +14,6 @@ extern void ia32_syscall(void);
extern void ia32_cstar_target(void);
extern void ia32_sysenter_target(void);
-extern int reserve_bootmem_generic(unsigned long phys, unsigned len, int flags);
-
extern void syscall32_cpu_init(void);
extern void check_efer(void);
Index: linux-2.6/include/linux/bootmem.h
===================================================================
--- linux-2.6.orig/include/linux/bootmem.h
+++ linux-2.6/include/linux/bootmem.h
@@ -84,6 +84,8 @@ extern int reserve_bootmem(unsigned long
__alloc_bootmem_low(x, PAGE_SIZE, 0)
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
+extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
+ int flags);
extern unsigned long free_all_bootmem(void);
extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
extern void *__alloc_bootmem_node(pg_data_t *pgdat,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: clean up reserve_bootmem_generic
2008-06-13 9:00 [PATCH] x86: clean up reserve_bootmem_generic Yinghai Lu
@ 2008-06-13 11:22 ` Ingo Molnar
2008-06-13 18:02 ` Yinghai Lu
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2008-06-13 11:22 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org
* Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> 1. add reserve_bootmem_generic for 32bit
> 2. change len to unsigned long
> 3. make early_res_to_bootmem to use it
applied to tip/x86/mpparse - thanks Yinghai.
This does properly finish my band-aid:
# x86/mpparse: f245905: x86: unify the reserve_bootmem() behavior of early_res_to_bootmem()
correct?
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: clean up reserve_bootmem_generic
2008-06-13 11:22 ` Ingo Molnar
@ 2008-06-13 18:02 ` Yinghai Lu
0 siblings, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2008-06-13 18:02 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Thomas Gleixner, H. Peter Anvin, linux-kernel@vger.kernel.org
On Fri, Jun 13, 2008 at 4:22 AM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>> 1. add reserve_bootmem_generic for 32bit
>> 2. change len to unsigned long
>> 3. make early_res_to_bootmem to use it
>
> applied to tip/x86/mpparse - thanks Yinghai.
>
> This does properly finish my band-aid:
>
> # x86/mpparse: f245905: x86: unify the reserve_bootmem() behavior of early_res_to_bootmem()
>
> correct?
yes. restore the original behavior of that for 64bit.
YH
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-13 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 9:00 [PATCH] x86: clean up reserve_bootmem_generic Yinghai Lu
2008-06-13 11:22 ` Ingo Molnar
2008-06-13 18:02 ` Yinghai Lu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.