linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86, cma: reserve dma contiguous area after initmem_init()
@ 2014-10-24  9:00 Weijie Yang
  2014-10-24  9:45 ` Marek Szyprowski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Weijie Yang @ 2014-10-24  9:00 UTC (permalink / raw)
  To: mingo
  Cc: tglx, hpa, fengguang.wu, m.szyprowski, mina86, iamjoonsoo.kim,
	'Andrew Morton', 'linux-kernel',
	'Linux-MM', 'Weijie Yang'

Fengguang Wu reported a BUG: Int 6: CR2 (null) on x86 platform in
0-day Linux Kernel Performance Test:

[    0.000000] BRK [0x025ee000, 0x025eefff] PGTABLE
[    0.000000] cma: dma_contiguous_reserve(limit 13ffe000)
[    0.000000] cma: dma_contiguous_reserve: reserving 31 MiB for global area
[    0.000000] BUG: Int 6: CR2   (null)
[    0.000000]      EDI c0000000  ESI   (null)  EBP 41c11ea4  EBX 425cc101
[    0.000000]      ESP 41c11e98   ES 0000007b   DS 0000007b
[    0.000000]      EDX 00000001  ECX   (null)  EAX 41cd8150
[    0.000000]      vec 00000006  err   (null)  EIP 41072227   CS 00000060  flg 00210002
[    0.000000] Stack: 425cc150   (null)   (null) 41c11ef4 41d4ee4d   (null) 13ffe000 41c11ec4
[    0.000000]        41c2d900   (null) 13ffe000   (null) 4185793e 0000002e 410c2982 41c11f00
[    0.000000]        410c2df5   (null)   (null)   (null) 425cc150 00013efe   (null) 41c11f28
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-next-20141008 #815
[    0.000000]  00000000 425cc101 41c11e48 41850786 41c11ea4 41d2b1db 41d95f71 00000006
[    0.000000]  00000000 c0000000 00000000 41c11ea4 425cc101 41c11e98 0000007b 0000007b
[    0.000000]  00000001 00000000 41cd8150 00000006 00000000 41072227 00000060 00210002
[    0.000000] Call Trace:
[    0.000000]  [<41850786>] dump_stack+0x16/0x18
[    0.000000]  [<41d2b1db>] early_idt_handler+0x6b/0x6b
[    0.000000]  [<41072227>] ? __phys_addr+0x2e/0xca
[    0.000000]  [<41d4ee4d>] cma_declare_contiguous+0x3c/0x2d7
[    0.000000]  [<4185793e>] ? _raw_spin_unlock_irqrestore+0x59/0x91
[    0.000000]  [<410c2982>] ? wake_up_klogd+0x8/0x33
[    0.000000]  [<410c2df5>] ? console_unlock+0x448/0x461
[    0.000000]  [<41d6d359>] dma_contiguous_reserve_area+0x27/0x47
[    0.000000]  [<41d6d4d1>] dma_contiguous_reserve+0x158/0x163
[    0.000000]  [<41d33e0f>] setup_arch+0x79b/0xc68
[    0.000000]  [<4184c0b4>] ? printk+0x1c/0x1e
[    0.000000]  [<41d2b7cf>] start_kernel+0x9c/0x456
[    0.000000]  [<41d2b2ca>] i386_start_kernel+0x79/0x7d

see detail: https://lkml.org/lkml/2014/10/8/708

It is because dma_contiguous_reserve() is called before initmem_init() in x86,
the variable high_memory is not initialized but accessed by __pa(high_memory)
in dma_contiguous_reserve().

This patch moves dma_contiguous_reserve() after initmem_init() so that
high_memory is initialized before accessed.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
---
 arch/x86/kernel/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 235cfd3..ab08aa2 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p)
 	setup_real_mode();
 
 	memblock_set_current_limit(get_max_mapped());
-	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
 
 	/*
 	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
@@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p)
 	early_acpi_boot_init();
 
 	initmem_init();
+	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
 
 	/*
 	 * Reserve memory for crash kernel after SRAT is parsed so that it
-- 
1.7.0.4


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, cma: reserve dma contiguous area after initmem_init()
  2014-10-24  9:00 [PATCH] x86, cma: reserve dma contiguous area after initmem_init() Weijie Yang
@ 2014-10-24  9:45 ` Marek Szyprowski
  2014-10-24 16:38 ` Michal Nazarewicz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marek Szyprowski @ 2014-10-24  9:45 UTC (permalink / raw)
  To: Weijie Yang, mingo
  Cc: tglx, hpa, fengguang.wu, mina86, iamjoonsoo.kim,
	'Andrew Morton', 'linux-kernel',
	'Linux-MM', 'Weijie Yang'

Hello,

On 2014-10-24 11:00, Weijie Yang wrote:
> Fengguang Wu reported a BUG: Int 6: CR2 (null) on x86 platform in
> 0-day Linux Kernel Performance Test:
>
> [    0.000000] BRK [0x025ee000, 0x025eefff] PGTABLE
> [    0.000000] cma: dma_contiguous_reserve(limit 13ffe000)
> [    0.000000] cma: dma_contiguous_reserve: reserving 31 MiB for global area
> [    0.000000] BUG: Int 6: CR2   (null)
> [    0.000000]      EDI c0000000  ESI   (null)  EBP 41c11ea4  EBX 425cc101
> [    0.000000]      ESP 41c11e98   ES 0000007b   DS 0000007b
> [    0.000000]      EDX 00000001  ECX   (null)  EAX 41cd8150
> [    0.000000]      vec 00000006  err   (null)  EIP 41072227   CS 00000060  flg 00210002
> [    0.000000] Stack: 425cc150   (null)   (null) 41c11ef4 41d4ee4d   (null) 13ffe000 41c11ec4
> [    0.000000]        41c2d900   (null) 13ffe000   (null) 4185793e 0000002e 410c2982 41c11f00
> [    0.000000]        410c2df5   (null)   (null)   (null) 425cc150 00013efe   (null) 41c11f28
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-next-20141008 #815
> [    0.000000]  00000000 425cc101 41c11e48 41850786 41c11ea4 41d2b1db 41d95f71 00000006
> [    0.000000]  00000000 c0000000 00000000 41c11ea4 425cc101 41c11e98 0000007b 0000007b
> [    0.000000]  00000001 00000000 41cd8150 00000006 00000000 41072227 00000060 00210002
> [    0.000000] Call Trace:
> [    0.000000]  [<41850786>] dump_stack+0x16/0x18
> [    0.000000]  [<41d2b1db>] early_idt_handler+0x6b/0x6b
> [    0.000000]  [<41072227>] ? __phys_addr+0x2e/0xca
> [    0.000000]  [<41d4ee4d>] cma_declare_contiguous+0x3c/0x2d7
> [    0.000000]  [<4185793e>] ? _raw_spin_unlock_irqrestore+0x59/0x91
> [    0.000000]  [<410c2982>] ? wake_up_klogd+0x8/0x33
> [    0.000000]  [<410c2df5>] ? console_unlock+0x448/0x461
> [    0.000000]  [<41d6d359>] dma_contiguous_reserve_area+0x27/0x47
> [    0.000000]  [<41d6d4d1>] dma_contiguous_reserve+0x158/0x163
> [    0.000000]  [<41d33e0f>] setup_arch+0x79b/0xc68
> [    0.000000]  [<4184c0b4>] ? printk+0x1c/0x1e
> [    0.000000]  [<41d2b7cf>] start_kernel+0x9c/0x456
> [    0.000000]  [<41d2b2ca>] i386_start_kernel+0x79/0x7d
>
> see detail: https://lkml.org/lkml/2014/10/8/708
>
> It is because dma_contiguous_reserve() is called before initmem_init() in x86,
> the variable high_memory is not initialized but accessed by __pa(high_memory)
> in dma_contiguous_reserve().
>
> This patch moves dma_contiguous_reserve() after initmem_init() so that
> high_memory is initialized before accessed.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   arch/x86/kernel/setup.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 235cfd3..ab08aa2 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p)
>   	setup_real_mode();
>   
>   	memblock_set_current_limit(get_max_mapped());
> -	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>   
>   	/*
>   	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
> @@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p)
>   	early_acpi_boot_init();
>   
>   	initmem_init();
> +	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>   
>   	/*
>   	 * Reserve memory for crash kernel after SRAT is parsed so that it

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, cma: reserve dma contiguous area after initmem_init()
  2014-10-24  9:00 [PATCH] x86, cma: reserve dma contiguous area after initmem_init() Weijie Yang
  2014-10-24  9:45 ` Marek Szyprowski
@ 2014-10-24 16:38 ` Michal Nazarewicz
  2014-10-24 17:19 ` Ingo Molnar
  2014-10-28  6:39 ` [tip:x86/urgent] x86, cma: Reserve DMA " tip-bot for Weijie Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Michal Nazarewicz @ 2014-10-24 16:38 UTC (permalink / raw)
  To: Weijie Yang, mingo
  Cc: tglx, hpa, fengguang.wu, m.szyprowski, iamjoonsoo.kim,
	'Andrew Morton', 'linux-kernel',
	'Linux-MM', 'Weijie Yang'

On Fri, Oct 24 2014, Weijie Yang <weijie.yang@samsung.com> wrote:
> Fengguang Wu reported a BUG: Int 6: CR2 (null) on x86 platform in
> 0-day Linux Kernel Performance Test:
>
> [    0.000000] BRK [0x025ee000, 0x025eefff] PGTABLE
> [    0.000000] cma: dma_contiguous_reserve(limit 13ffe000)
> [    0.000000] cma: dma_contiguous_reserve: reserving 31 MiB for global area
> [    0.000000] BUG: Int 6: CR2   (null)
> [    0.000000]      EDI c0000000  ESI   (null)  EBP 41c11ea4  EBX 425cc101
> [    0.000000]      ESP 41c11e98   ES 0000007b   DS 0000007b
> [    0.000000]      EDX 00000001  ECX   (null)  EAX 41cd8150
> [    0.000000]      vec 00000006  err   (null)  EIP 41072227   CS 00000060  flg 00210002
> [    0.000000] Stack: 425cc150   (null)   (null) 41c11ef4 41d4ee4d   (null) 13ffe000 41c11ec4
> [    0.000000]        41c2d900   (null) 13ffe000   (null) 4185793e 0000002e 410c2982 41c11f00
> [    0.000000]        410c2df5   (null)   (null)   (null) 425cc150 00013efe   (null) 41c11f28
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-next-20141008 #815
> [    0.000000]  00000000 425cc101 41c11e48 41850786 41c11ea4 41d2b1db 41d95f71 00000006
> [    0.000000]  00000000 c0000000 00000000 41c11ea4 425cc101 41c11e98 0000007b 0000007b
> [    0.000000]  00000001 00000000 41cd8150 00000006 00000000 41072227 00000060 00210002
> [    0.000000] Call Trace:
> [    0.000000]  [<41850786>] dump_stack+0x16/0x18
> [    0.000000]  [<41d2b1db>] early_idt_handler+0x6b/0x6b
> [    0.000000]  [<41072227>] ? __phys_addr+0x2e/0xca
> [    0.000000]  [<41d4ee4d>] cma_declare_contiguous+0x3c/0x2d7
> [    0.000000]  [<4185793e>] ? _raw_spin_unlock_irqrestore+0x59/0x91
> [    0.000000]  [<410c2982>] ? wake_up_klogd+0x8/0x33
> [    0.000000]  [<410c2df5>] ? console_unlock+0x448/0x461
> [    0.000000]  [<41d6d359>] dma_contiguous_reserve_area+0x27/0x47
> [    0.000000]  [<41d6d4d1>] dma_contiguous_reserve+0x158/0x163
> [    0.000000]  [<41d33e0f>] setup_arch+0x79b/0xc68
> [    0.000000]  [<4184c0b4>] ? printk+0x1c/0x1e
> [    0.000000]  [<41d2b7cf>] start_kernel+0x9c/0x456
> [    0.000000]  [<41d2b2ca>] i386_start_kernel+0x79/0x7d
>
> see detail: https://lkml.org/lkml/2014/10/8/708
>
> It is because dma_contiguous_reserve() is called before initmem_init() in x86,
> the variable high_memory is not initialized but accessed by __pa(high_memory)
> in dma_contiguous_reserve().
>
> This patch moves dma_contiguous_reserve() after initmem_init() so that
> high_memory is initialized before accessed.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  arch/x86/kernel/setup.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 235cfd3..ab08aa2 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p)
>  	setup_real_mode();
>  
>  	memblock_set_current_limit(get_max_mapped());
> -	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>  
>  	/*
>  	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
> @@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p)
>  	early_acpi_boot_init();
>  
>  	initmem_init();
> +	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>  
>  	/*
>  	 * Reserve memory for crash kernel after SRAT is parsed so that it
> -- 
> 1.7.0.4
>
>

-- 
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
ooo +--<mpn@google.com>--<xmpp:mina86@jabber.org>--ooO--(_)--Ooo--

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86, cma: reserve dma contiguous area after initmem_init()
  2014-10-24  9:00 [PATCH] x86, cma: reserve dma contiguous area after initmem_init() Weijie Yang
  2014-10-24  9:45 ` Marek Szyprowski
  2014-10-24 16:38 ` Michal Nazarewicz
@ 2014-10-24 17:19 ` Ingo Molnar
  2014-10-28  6:39 ` [tip:x86/urgent] x86, cma: Reserve DMA " tip-bot for Weijie Yang
  3 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2014-10-24 17:19 UTC (permalink / raw)
  To: Weijie Yang, Akinobu Mita
  Cc: tglx, hpa, fengguang.wu, m.szyprowski, mina86, iamjoonsoo.kim,
	'Andrew Morton', 'linux-kernel',
	'Linux-MM', 'Weijie Yang'


* Weijie Yang <weijie.yang@samsung.com> wrote:

> Fengguang Wu reported a BUG: Int 6: CR2 (null) on x86 platform in
> 0-day Linux Kernel Performance Test:
> 
> [    0.000000] BRK [0x025ee000, 0x025eefff] PGTABLE
> [    0.000000] cma: dma_contiguous_reserve(limit 13ffe000)
> [    0.000000] cma: dma_contiguous_reserve: reserving 31 MiB for global area
> [    0.000000] BUG: Int 6: CR2   (null)
> [    0.000000]      EDI c0000000  ESI   (null)  EBP 41c11ea4  EBX 425cc101
> [    0.000000]      ESP 41c11e98   ES 0000007b   DS 0000007b
> [    0.000000]      EDX 00000001  ECX   (null)  EAX 41cd8150
> [    0.000000]      vec 00000006  err   (null)  EIP 41072227   CS 00000060  flg 00210002
> [    0.000000] Stack: 425cc150   (null)   (null) 41c11ef4 41d4ee4d   (null) 13ffe000 41c11ec4
> [    0.000000]        41c2d900   (null) 13ffe000   (null) 4185793e 0000002e 410c2982 41c11f00
> [    0.000000]        410c2df5   (null)   (null)   (null) 425cc150 00013efe   (null) 41c11f28
> [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-next-20141008 #815
> [    0.000000]  00000000 425cc101 41c11e48 41850786 41c11ea4 41d2b1db 41d95f71 00000006
> [    0.000000]  00000000 c0000000 00000000 41c11ea4 425cc101 41c11e98 0000007b 0000007b
> [    0.000000]  00000001 00000000 41cd8150 00000006 00000000 41072227 00000060 00210002
> [    0.000000] Call Trace:
> [    0.000000]  [<41850786>] dump_stack+0x16/0x18
> [    0.000000]  [<41d2b1db>] early_idt_handler+0x6b/0x6b
> [    0.000000]  [<41072227>] ? __phys_addr+0x2e/0xca
> [    0.000000]  [<41d4ee4d>] cma_declare_contiguous+0x3c/0x2d7
> [    0.000000]  [<4185793e>] ? _raw_spin_unlock_irqrestore+0x59/0x91
> [    0.000000]  [<410c2982>] ? wake_up_klogd+0x8/0x33
> [    0.000000]  [<410c2df5>] ? console_unlock+0x448/0x461
> [    0.000000]  [<41d6d359>] dma_contiguous_reserve_area+0x27/0x47
> [    0.000000]  [<41d6d4d1>] dma_contiguous_reserve+0x158/0x163
> [    0.000000]  [<41d33e0f>] setup_arch+0x79b/0xc68
> [    0.000000]  [<4184c0b4>] ? printk+0x1c/0x1e
> [    0.000000]  [<41d2b7cf>] start_kernel+0x9c/0x456
> [    0.000000]  [<41d2b2ca>] i386_start_kernel+0x79/0x7d
> 
> see detail: https://lkml.org/lkml/2014/10/8/708
> 
> It is because dma_contiguous_reserve() is called before initmem_init() in x86,
> the variable high_memory is not initialized but accessed by __pa(high_memory)
> in dma_contiguous_reserve().
> 
> This patch moves dma_contiguous_reserve() after initmem_init() so that
> high_memory is initialized before accessed.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
> ---
>  arch/x86/kernel/setup.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 235cfd3..ab08aa2 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p)
>  	setup_real_mode();
>  
>  	memblock_set_current_limit(get_max_mapped());
> -	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>  
>  	/*
>  	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
> @@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p)
>  	early_acpi_boot_init();
>  
>  	initmem_init();
> +	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
>  
>  	/*
>  	 * Reserve memory for crash kernel after SRAT is parsed so that it

I think this might be a boot regression that went upstream via 
akpm's tree, via the recent 'cma' change:

5ea3b1b2f8ad cma: add placement specifier for "cma=" kernel parameter

Next time around please put 'x86' into patches that 
enable features on x86 and which change its early init 
behavior. The 'cma: ...' prefix was rather misleading.

Thanks,

	Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:x86/urgent] x86, cma: Reserve DMA contiguous area after initmem_init()
  2014-10-24  9:00 [PATCH] x86, cma: reserve dma contiguous area after initmem_init() Weijie Yang
                   ` (2 preceding siblings ...)
  2014-10-24 17:19 ` Ingo Molnar
@ 2014-10-28  6:39 ` tip-bot for Weijie Yang
  3 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Weijie Yang @ 2014-10-28  6:39 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mina86, akpm, linux-kernel, weijie.yang.kh, fengguang.wu,
	linux-mm, tglx, mingo, weijie.yang, m.szyprowski, hpa

Commit-ID:  3c325f8233c35fb35dec3744ba01634aab4ea36a
Gitweb:     http://git.kernel.org/tip/3c325f8233c35fb35dec3744ba01634aab4ea36a
Author:     Weijie Yang <weijie.yang@samsung.com>
AuthorDate: Fri, 24 Oct 2014 17:00:34 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 Oct 2014 07:36:50 +0100

x86, cma: Reserve DMA contiguous area after initmem_init()

Fengguang Wu reported a boot crash on the x86 platform
via the 0-day Linux Kernel Performance Test:

  cma: dma_contiguous_reserve: reserving 31 MiB for global area
  BUG: Int 6: CR2   (null)
  [<41850786>] dump_stack+0x16/0x18
  [<41d2b1db>] early_idt_handler+0x6b/0x6b
  [<41072227>] ? __phys_addr+0x2e/0xca
  [<41d4ee4d>] cma_declare_contiguous+0x3c/0x2d7
  [<41d6d359>] dma_contiguous_reserve_area+0x27/0x47
  [<41d6d4d1>] dma_contiguous_reserve+0x158/0x163
  [<41d33e0f>] setup_arch+0x79b/0xc68
  [<41d2b7cf>] start_kernel+0x9c/0x456
  [<41d2b2ca>] i386_start_kernel+0x79/0x7d

(See details at: https://lkml.org/lkml/2014/10/8/708)

It is because dma_contiguous_reserve() is called before
initmem_init() in x86, the variable high_memory is not
initialized but accessed by __pa(high_memory) in
dma_contiguous_reserve().

This patch moves dma_contiguous_reserve() after initmem_init()
so that high_memory is initialized before accessed.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Weijie Yang <weijie.yang@samsung.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: iamjoonsoo.kim@lge.com
Cc: 'Linux-MM' <linux-mm@kvack.org>
Cc: 'Weijie Yang' <weijie.yang.kh@gmail.com>
Link: http://lkml.kernel.org/r/000101cfef69%2431e528a0%2495af79e0%24%25yang@samsung.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 235cfd3..ab08aa2 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p)
 	setup_real_mode();
 
 	memblock_set_current_limit(get_max_mapped());
-	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
 
 	/*
 	 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
@@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p)
 	early_acpi_boot_init();
 
 	initmem_init();
+	dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
 
 	/*
 	 * Reserve memory for crash kernel after SRAT is parsed so that it

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-10-28  6:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-24  9:00 [PATCH] x86, cma: reserve dma contiguous area after initmem_init() Weijie Yang
2014-10-24  9:45 ` Marek Szyprowski
2014-10-24 16:38 ` Michal Nazarewicz
2014-10-24 17:19 ` Ingo Molnar
2014-10-28  6:39 ` [tip:x86/urgent] x86, cma: Reserve DMA " tip-bot for Weijie Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox