* MIPS : die at free_initmem() function 3.9+
@ 2013-05-03 7:47 EUNBONG SONG
2013-05-03 15:51 ` Jiang Liu
0 siblings, 1 reply; 4+ messages in thread
From: EUNBONG SONG @ 2013-05-03 7:47 UTC (permalink / raw)
To: liuj97, ralf@linux-mips.org
Cc: linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, jogo,
david.daney
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 3445 bytes --]
Hello. I try to boot my cavium board with david's patch.
It's is not applied yet in linux tree, i got the patch from mailing list.
And the patch is as follow.
This is only very lightly tested, we need more testing before
declaring it the definitive fix.
arch/mips/kernel/genex.S | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
index ecb347c..57cda9a 100644
--- a/arch/mips/kernel/genex.S
+++ b/arch/mips/kernel/genex.S
@@ -132,12 +132,13 @@ LEAF(r4k_wait)
.set noreorder
/* start of rollback region */
LONG_L t0, TI_FLAGS($28)
- nop
andi t0, _TIF_NEED_RESCHED
bnez t0, 1f
nop
- nop
- nop
+ /* Enable interrupts so WAIT will complete */
+ mfc0 t0, CP0_STATUS
+ ori t0, ST0_IE
+ mtc0 t0, CP0_STATUS
.set mips3
wait
/* end of rollback region (the region size must be power of two) */
I think, it works well. But i encounter another problem at free_initmem().
The log messages are as follow.
[ 132.134719] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.9.0+ #29
[ 132.141678] Stack : 0000000000000004 000000000000003f ffffffff80fa0000 ffffffff802924a8
0000000000000000 ffffffff80fa0000 00000000000000ff ffffffff80293760
0000000000000000 0000000000000000 ffffffff81080000 ffffffff81080000
ffffffff80e2baf0 ffffffff80f93977 a80000004146cbb8 0000000000000020
0000000000000003 0000000000000020 a800000041473da8 ffffffff810f0000
a800000041473a10 ffffffff806ef910 a800000041473828 ffffffff80290920
0000000000000000 ffffffff80293b90 000000000000000a ffffffff80e2baf0
0000000000000000 a800000041473750 000000004146cef8 ffffffff805e7794
0000000000000000 0000000000000000 0000000000000000 0000000000000000
0000000000000000 ffffffff80272498 0000000000000000 0000000000000000
...
[ 132.207201] Call Trace:
[ 132.209655] [<ffffffff80272498>] show_stack+0x68/0x80
[ 132.225943] [<ffffffff802bd4ac>] notifier_call_chain+0x5c/0xa8
[ 132.231776] [<ffffffff802bdb84>] __atomic_notifier_call_chain+0x3c/0x58
[ 132.238391] [<ffffffff802bdbe8>] notify_die+0x38/0x48
[ 132.243442] [<ffffffff802716cc>] die+0x4c/0x148
[ 132.247974] [<ffffffff8027f998>] do_page_fault+0x4b8/0x500
[ 132.253461] [<ffffffff8026c764>] resume_userspace_check+0x0/0x10
[ 132.259469] [<ffffffff80324a54>] free_reserved_area+0x8c/0x178
[ 132.265304] [<ffffffff806e0dc8>] kernel_init+0x20/0x100
[ 132.270529] [<ffffffff8026c7e0>] ret_from_kernel_thread+0x10/0x18
And i just changed free_initmem() functions as follow
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 9b973e0..e246e9b 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -447,7 +447,10 @@ void free_initrd_mem(unsigned long start, unsigned long end)
void __init_refok free_initmem(void)
{
prom_free_prom_memory();
- free_initmem_default(POISON_FREE_INITMEM);
+
+ free_init_pages("unused kernel memory",
+ __pa_symbol(&__init_begin),
+ __pa_symbol(&__init_end));
}
After that it works well. but i don't know why it works well.
Thanks. ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: MIPS : die at free_initmem() function 3.9+
2013-05-03 7:47 MIPS : die at free_initmem() function 3.9+ EUNBONG SONG
@ 2013-05-03 15:51 ` Jiang Liu
0 siblings, 0 replies; 4+ messages in thread
From: Jiang Liu @ 2013-05-03 15:51 UTC (permalink / raw)
To: eunb.song
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org, jogo, david.daney
Hi Eunbong,
Thanks for reporting!
I think this issue may be caused by __pa_symbol() on 64bits MIPS machines
due to following definition:
#ifdef CONFIG_64BIT
#define __pa(x) \
({ \
unsigned long __x = (unsigned long)(x); \
__x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x); \
})
#else
#define __pa(x) \
((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET)
#endif
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
So on 64bits MIPS platforms, __va(__pa(x)) may not equal to x, that may cause
trouble to free_initmem_default(). Could you please help to do another test
by changing
free_initmem_default(POISON_FREE_INITMEM);
to
free_initmem_default(0);
This test could help to identify whether this panic is caused by
memset((void *)pos, poison, PAGE_SIZE);
in function free_reserved_area().
Thanks!
Gerry
On 05/03/2013 03:47 PM, EUNBONG SONG wrote:
>
> Hello. I try to boot my cavium board with david's patch.
> It's is not applied yet in linux tree, i got the patch from mailing list.
> And the patch is as follow.
>
>
> This is only very lightly tested, we need more testing before
> declaring it the definitive fix.
>
> arch/mips/kernel/genex.S | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S
> index ecb347c..57cda9a 100644
> --- a/arch/mips/kernel/genex.S
> +++ b/arch/mips/kernel/genex.S
> @@ -132,12 +132,13 @@ LEAF(r4k_wait)
> .set noreorder
> /* start of rollback region */
> LONG_L t0, TI_FLAGS($28)
> - nop
> andi t0, _TIF_NEED_RESCHED
> bnez t0, 1f
> nop
> - nop
> - nop
> + /* Enable interrupts so WAIT will complete */
> + mfc0 t0, CP0_STATUS
> + ori t0, ST0_IE
> + mtc0 t0, CP0_STATUS
> .set mips3
> wait
> /* end of rollback region (the region size must be power of two) */
>
> I think, it works well. But i encounter another problem at free_initmem().
> The log messages are as follow.
>
> [ 132.134719] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.9.0+ #29
> [ 132.141678] Stack : 0000000000000004 000000000000003f ffffffff80fa0000 ffffffff802924a8
> 0000000000000000 ffffffff80fa0000 00000000000000ff ffffffff80293760
> 0000000000000000 0000000000000000 ffffffff81080000 ffffffff81080000
> ffffffff80e2baf0 ffffffff80f93977 a80000004146cbb8 0000000000000020
> 0000000000000003 0000000000000020 a800000041473da8 ffffffff810f0000
> a800000041473a10 ffffffff806ef910 a800000041473828 ffffffff80290920
> 0000000000000000 ffffffff80293b90 000000000000000a ffffffff80e2baf0
> 0000000000000000 a800000041473750 000000004146cef8 ffffffff805e7794
> 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000 ffffffff80272498 0000000000000000 0000000000000000
> ...
> [ 132.207201] Call Trace:
> [ 132.209655] [<ffffffff80272498>] show_stack+0x68/0x80
> [ 132.225943] [<ffffffff802bd4ac>] notifier_call_chain+0x5c/0xa8
> [ 132.231776] [<ffffffff802bdb84>] __atomic_notifier_call_chain+0x3c/0x58
> [ 132.238391] [<ffffffff802bdbe8>] notify_die+0x38/0x48
> [ 132.243442] [<ffffffff802716cc>] die+0x4c/0x148
> [ 132.247974] [<ffffffff8027f998>] do_page_fault+0x4b8/0x500
> [ 132.253461] [<ffffffff8026c764>] resume_userspace_check+0x0/0x10
> [ 132.259469] [<ffffffff80324a54>] free_reserved_area+0x8c/0x178
> [ 132.265304] [<ffffffff806e0dc8>] kernel_init+0x20/0x100
> [ 132.270529] [<ffffffff8026c7e0>] ret_from_kernel_thread+0x10/0x18
>
> And i just changed free_initmem() functions as follow
>
> diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
> index 9b973e0..e246e9b 100644
> --- a/arch/mips/mm/init.c
> +++ b/arch/mips/mm/init.c
> @@ -447,7 +447,10 @@ void free_initrd_mem(unsigned long start, unsigned long end)
> void __init_refok free_initmem(void)
> {
> prom_free_prom_memory();
> - free_initmem_default(POISON_FREE_INITMEM);
> +
> + free_init_pages("unused kernel memory",
> + __pa_symbol(&__init_begin),
> + __pa_symbol(&__init_end));
> }
>
> After that it works well. but i don't know why it works well.
>
> Thanks.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: MIPS : die at free_initmem() function 3.9+
@ 2013-05-05 22:39 EUNBONG SONG
2013-05-07 16:46 ` Jiang Liu
0 siblings, 1 reply; 4+ messages in thread
From: EUNBONG SONG @ 2013-05-05 22:39 UTC (permalink / raw)
To: Jiang Liu
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org, jogo@openwrt.org,
david.daney@cavium.com
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 792 bytes --]
>So on 64bits MIPS platforms, __va(__pa(x)) may not equal to x, that may cause
>trouble to free_initmem_default(). Could you please help to do another test
>by changing
>free_initmem_default(POISON_FREE_INITMEM);
>to
>free_initmem_default(0);
>This test could help to identify whether this panic is caused by
>memset((void *)pos, poison, PAGE_SIZE);
>in function free_reserved_area().
Hello, as you said i changed "free_initmem_default(POISON_FREE_INITMEM);" to
"free_initmem_default(0);". Panic still occurred.
Actually, i put the some debug messages. and i confirmed panic occurs in __free_reserved_page() function.
Thanks!
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: MIPS : die at free_initmem() function 3.9+
2013-05-05 22:39 EUNBONG SONG
@ 2013-05-07 16:46 ` Jiang Liu
2013-05-07 17:27 ` David Daney
0 siblings, 1 reply; 4+ messages in thread
From: Jiang Liu @ 2013-05-07 16:46 UTC (permalink / raw)
To: eunb.song
Cc: ralf@linux-mips.org, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org, jogo@openwrt.org,
david.daney@cavium.com
Hi Eunsong,
Thanks for your help. I have done some code inspection and have
found a possible reason for this issue. It seems that virt_to_page()
can't be used to handle address in compatible segments due to following
definitions.
#define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
static inline unsigned long virt_to_phys(volatile const void *address)
{
return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET;
}
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
#define __pa(x) \
({ \
unsigned long __x = (unsigned long)(x); \
__x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x); \
})
#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
#define XPHYSADDR(a) ((_ACAST64_(a)) & \
_CONST64_(0x000000ffffffffff))
#define XKUSEG _CONST64_(0x0000000000000000)
#define XKSSEG _CONST64_(0x4000000000000000)
#define XKPHYS _CONST64_(0x8000000000000000)
#define XKSEG _CONST64_(0xc000000000000000)
#define CKSEG0 _CONST64_(0xffffffff80000000)
#define CKSEG1 _CONST64_(0xffffffffa0000000)
#define CKSSEG _CONST64_(0xffffffffc0000000)
#define CKSEG3 _CONST64_(0xffffffffe0000000)
So could you please help to prepare a formal patch for this bug and send
it to Andrew Morton for v3.10-rc1? Otherwise I could help to it too.
Regards!
Gerry
=On 05/06/2013 06:39 AM, EUNBONG SONG wrote:
>
>> So on 64bits MIPS platforms, __va(__pa(x)) may not equal to x, that may cause
>> trouble to free_initmem_default(). Could you please help to do another test
>> by changing
>> free_initmem_default(POISON_FREE_INITMEM);
>> to
>> free_initmem_default(0);
>
>> This test could help to identify whether this panic is caused by
>> memset((void *)pos, poison, PAGE_SIZE);
>> in function free_reserved_area().
>
> Hello, as you said i changed "free_initmem_default(POISON_FREE_INITMEM);" to
> "free_initmem_default(0);". Panic still occurred.
> Actually, i put the some debug messages. and i confirmed panic occurs in __free_reserved_page() function.
> Thanks!
>
> N떑꿩�r툤y鉉싕b쾊Ф푤v�^�)頻{.n�+돴쪐{콗喩zX㎍\x17썳變}찠꼿쟺�&j:+v돣�\a쳭喩zZ+�+zf"톒쉱�~넮녬i�鎬z�\x1e췿ⅱ�?솳鈺�&�)刪^[f뷌^j푹y쬶끷@A첺뛴��\f0띠h�\x0f�i�
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: MIPS : die at free_initmem() function 3.9+
2013-05-07 16:46 ` Jiang Liu
@ 2013-05-07 17:27 ` David Daney
0 siblings, 0 replies; 4+ messages in thread
From: David Daney @ 2013-05-07 17:27 UTC (permalink / raw)
To: Jiang Liu, ralf@linux-mips.org
Cc: eunb.song, linux-mips@linux-mips.org,
linux-kernel@vger.kernel.org, jogo@openwrt.org,
david.daney@cavium.com
On 05/07/2013 09:46 AM, Jiang Liu wrote:
> Hi Eunsong,
> Thanks for your help. I have done some code inspection and have
> found a possible reason for this issue. It seems that virt_to_page()
> can't be used to handle address in compatible segments due to following
> definitions.
This has caused multiple problems in the past. I wrote a patch to
correct this problem, but it looks like it was never applied.
I just sent the patch to you guys as a separate e-mail.
David Daney
>
> #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr)))
> static inline unsigned long virt_to_phys(volatile const void *address)
> {
> return (unsigned long)address - PAGE_OFFSET + PHYS_OFFSET;
> }
> #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
> #define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x), 0))
> #define __pa(x) \
> ({ \
> unsigned long __x = (unsigned long)(x); \
> __x < CKSEG0 ? XPHYSADDR(__x) : CPHYSADDR(__x); \
> })
>
> #define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
> #define XPHYSADDR(a) ((_ACAST64_(a)) & \
> _CONST64_(0x000000ffffffffff))
>
> #define XKUSEG _CONST64_(0x0000000000000000)
> #define XKSSEG _CONST64_(0x4000000000000000)
> #define XKPHYS _CONST64_(0x8000000000000000)
> #define XKSEG _CONST64_(0xc000000000000000)
> #define CKSEG0 _CONST64_(0xffffffff80000000)
> #define CKSEG1 _CONST64_(0xffffffffa0000000)
> #define CKSSEG _CONST64_(0xffffffffc0000000)
> #define CKSEG3 _CONST64_(0xffffffffe0000000)
>
> So could you please help to prepare a formal patch for this bug and send
> it to Andrew Morton for v3.10-rc1? Otherwise I could help to it too.
>
> Regards!
> Gerry
>
>
> =On 05/06/2013 06:39 AM, EUNBONG SONG wrote:
>>
>>> So on 64bits MIPS platforms, __va(__pa(x)) may not equal to x, that may cause
>>> trouble to free_initmem_default(). Could you please help to do another test
>>> by changing
>>> free_initmem_default(POISON_FREE_INITMEM);
>>> to
>>> free_initmem_default(0);
>>
>>> This test could help to identify whether this panic is caused by
>>> memset((void *)pos, poison, PAGE_SIZE);
>>> in function free_reserved_area().
>>
>> Hello, as you said i changed "free_initmem_default(POISON_FREE_INITMEM);" to
>> "free_initmem_default(0);". Panic still occurred.
>> Actually, i put the some debug messages. and i confirmed panic occurs in __free_reserved_page() function.
>> Thanks!
>>
>> N떑꿩�r툤y鉉싕b쾊Ф푤v�^�)頻{.n�+돴쪐{콗喩zX㎍\x17썳變}찠꼿쟺�&j:+v돣�\a쳭喩zZ+�+zf"톒쉱�~넮녬i�鎬z�\x1e췿ⅱ�?솳鈺�&�)刪^[f뷌^j푹y쬶끷@A첺뛴��\f0띠h�\x0f�i�
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-05-07 17:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03 7:47 MIPS : die at free_initmem() function 3.9+ EUNBONG SONG
2013-05-03 15:51 ` Jiang Liu
-- strict thread matches above, loose matches on Subject: below --
2013-05-05 22:39 EUNBONG SONG
2013-05-07 16:46 ` Jiang Liu
2013-05-07 17:27 ` David Daney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox