Linux-MIPS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] MIPS: TXx9: Fix boot crash in free_initmem()
@ 2019-05-22  8:15 Geert Uytterhoeven
  2019-05-22 11:59 ` Atsushi Nemoto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2019-05-22  8:15 UTC (permalink / raw)
  To: Serge Semin, Ralf Baechle, Paul Burton, James Hogan, Atsushi Nemoto
  Cc: Mike Rapoport, Maciej W . Rozycki, linux-mips, linux-kernel,
	Geert Uytterhoeven

On rbtx4927:

    BUG: Bad page state in process swapper  pfn:00001
    page:804b7820 refcount:0 mapcount:-128 mapping:00000000 index:0x1
    flags: 0x0()
    raw: 00000000 00000100 00000200 00000000 00000001 00000000 ffffff7f 00000000
    page dumped because: nonzero mapcount
    Modules linked in:
    CPU: 0 PID: 1 Comm: swapper Not tainted 5.2.0-rc1-rbtx4927-00468-g3c05ea3d4077b756 #141
    Stack : 00000000 10008400 8040dc4c 87c1b974 8044af63 8040dc4c 00000001 804a3490
            00000001 81000000 0030f231 80148558 00000003 10008400 87c1dd80 3d0f9a2c
            00000000 00000000 804b0000 00000000 00000007 00000000 00000081 00000000
            62722d31 00000080 804b0000 39347874 00000000 804b7820 8040ce18 81000010
            00000001 00000007 00000001 81000000 00000018 8021de24 00000000 804a0000
            ...
    Call Trace:
    [<8010adec>] show_stack+0x74/0x104
    [<801a5e44>] bad_page+0x130/0x138
    [<801a654c>] free_pcppages_bulk+0x17c/0x3b0
    [<801a789c>] free_unref_page+0x40/0x68
    [<801120f4>] free_init_pages+0xec/0x104
    [<803bdde8>] free_initmem+0x10/0x58
    [<803bdb8c>] kernel_init+0x20/0x100
    [<801057c8>] ret_from_kernel_thread+0x14/0x1c

As of commit b93ddc4f9156205e ("mips: Reserve memory for the kernel
image resources"), bootmem_init() no longer reserves the memory below
the kernel, while prom_free_prom_memory() still frees it.

Fix this by reverting commit b6263ff2d6e58cc2 ("MIPS: TXx9: Implement
prom_free_prom_memory").

Suggested-by: Serge Semin <fancer.lancer@gmail.com>
Fixes: b93ddc4f9156205e ("mips: Reserve memory for the kernel image resources")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
Looks like arch/mips/dec/prom/memory.c needs a similar but more
complicated fix, due to declance handling?
---
 arch/mips/txx9/generic/setup.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 46537c2ca86a2eae..6d0fd0e055b4ba4a 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -33,7 +33,6 @@
 #include <asm/time.h>
 #include <asm/reboot.h>
 #include <asm/r4kcache.h>
-#include <asm/sections.h>
 #include <asm/setup.h>
 #include <asm/txx9/generic.h>
 #include <asm/txx9/pci.h>
@@ -343,11 +342,6 @@ void __init prom_init(void)
 
 void __init prom_free_prom_memory(void)
 {
-	unsigned long saddr = PAGE_SIZE;
-	unsigned long eaddr = __pa_symbol(&_text);
-
-	if (saddr < eaddr)
-		free_init_pages("prom memory", saddr, eaddr);
 }
 
 const char *get_system_type(void)
-- 
2.17.1


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

* Re: [PATCH] MIPS: TXx9: Fix boot crash in free_initmem()
  2019-05-22  8:15 [PATCH] MIPS: TXx9: Fix boot crash in free_initmem() Geert Uytterhoeven
@ 2019-05-22 11:59 ` Atsushi Nemoto
  2019-05-22 12:07 ` Maciej W. Rozycki
  2019-05-23  1:56 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: Atsushi Nemoto @ 2019-05-22 11:59 UTC (permalink / raw)
  To: geert
  Cc: fancer.lancer, ralf, paul.burton, jhogan, rppt, macro,
	linux-mips, linux-kernel

On Wed, 22 May 2019 10:15:35 +0200, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On rbtx4927:
...
> As of commit b93ddc4f9156205e ("mips: Reserve memory for the kernel
> image resources"), bootmem_init() no longer reserves the memory below
> the kernel, while prom_free_prom_memory() still frees it.
> 
> Fix this by reverting commit b6263ff2d6e58cc2 ("MIPS: TXx9: Implement
> prom_free_prom_memory").
> 
> Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> Fixes: b93ddc4f9156205e ("mips: Reserve memory for the kernel image resources")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

Thank you for fixing this.  It looks OK for me.

Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

---
Atsushi Nemoto

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

* Re: [PATCH] MIPS: TXx9: Fix boot crash in free_initmem()
  2019-05-22  8:15 [PATCH] MIPS: TXx9: Fix boot crash in free_initmem() Geert Uytterhoeven
  2019-05-22 11:59 ` Atsushi Nemoto
@ 2019-05-22 12:07 ` Maciej W. Rozycki
  2019-05-23  1:56 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: Maciej W. Rozycki @ 2019-05-22 12:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Serge Semin, Ralf Baechle, Paul Burton, James Hogan,
	Atsushi Nemoto, Mike Rapoport, linux-mips, linux-kernel

On Wed, 22 May 2019, Geert Uytterhoeven wrote:

> Looks like arch/mips/dec/prom/memory.c needs a similar but more
> complicated fix, due to declance handling?

 Thanks for the heads-up!  I think the declance hack should go away.  It 
should have gone long ago, but ISTR there used to be a problem with making 
such a large contiguous physical memory allocation in the modular case.  
Maybe it's not anymore these days.  I'll look into it when I get a chance 
to poke at hardware, which I have no access to at the moment.

  Maciej

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

* Re: [PATCH] MIPS: TXx9: Fix boot crash in free_initmem()
  2019-05-22  8:15 [PATCH] MIPS: TXx9: Fix boot crash in free_initmem() Geert Uytterhoeven
  2019-05-22 11:59 ` Atsushi Nemoto
  2019-05-22 12:07 ` Maciej W. Rozycki
@ 2019-05-23  1:56 ` Paul Burton
  2 siblings, 0 replies; 4+ messages in thread
From: Paul Burton @ 2019-05-23  1:56 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Serge Semin, Ralf Baechle, Paul Burton, James Hogan,
	Atsushi Nemoto, Mike Rapoport, Maciej W . Rozycki, linux-mips,
	linux-kernel, Geert Uytterhoeven, linux-mips

Hello,

Geert Uytterhoeven wrote:
> On rbtx4927:
> 
> BUG: Bad page state in process swapper  pfn:00001
> page:804b7820 refcount:0 mapcount:-128 mapping:00000000 index:0x1
> flags: 0x0()
> raw: 00000000 00000100 00000200 00000000 00000001 00000000 ffffff7f 00000000
> page dumped because: nonzero mapcount
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper Not tainted 5.2.0-rc1-rbtx4927-00468-g3c05ea3d4077b756 #141
> Stack : 00000000 10008400 8040dc4c 87c1b974 8044af63 8040dc4c 00000001 804a3490
> 00000001 81000000 0030f231 80148558 00000003 10008400 87c1dd80 3d0f9a2c
> 00000000 00000000 804b0000 00000000 00000007 00000000 00000081 00000000
> 62722d31 00000080 804b0000 39347874 00000000 804b7820 8040ce18 81000010
> 00000001 00000007 00000001 81000000 00000018 8021de24 00000000 804a0000
> ...
> Call Trace:
> [<8010adec>] show_stack+0x74/0x104
> [<801a5e44>] bad_page+0x130/0x138
> [<801a654c>] free_pcppages_bulk+0x17c/0x3b0
> [<801a789c>] free_unref_page+0x40/0x68
> [<801120f4>] free_init_pages+0xec/0x104
> [<803bdde8>] free_initmem+0x10/0x58
> [<803bdb8c>] kernel_init+0x20/0x100
> [<801057c8>] ret_from_kernel_thread+0x14/0x1c
> 
> As of commit b93ddc4f9156205e ("mips: Reserve memory for the kernel
> image resources"), bootmem_init() no longer reserves the memory below
> the kernel, while prom_free_prom_memory() still frees it.
> 
> Fix this by reverting commit b6263ff2d6e58cc2 ("MIPS: TXx9: Implement
> prom_free_prom_memory").
> 
> Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> Fixes: b93ddc4f9156205e ("mips: Reserve memory for the kernel image resources")
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Reviewed-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Applied to mips-fixes.

Thanks,
    Paul

[ This message was auto-generated; if you believe anything is incorrect
  then please email paul.burton@mips.com to report it. ]

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22  8:15 [PATCH] MIPS: TXx9: Fix boot crash in free_initmem() Geert Uytterhoeven
2019-05-22 11:59 ` Atsushi Nemoto
2019-05-22 12:07 ` Maciej W. Rozycki
2019-05-23  1:56 ` Paul Burton

Linux-MIPS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mips/0 linux-mips/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mips linux-mips/ https://lore.kernel.org/linux-mips \
		linux-mips@vger.kernel.org linux-mips@archiver.kernel.org
	public-inbox-index linux-mips


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-mips


AGPL code for this site: git clone https://public-inbox.org/ public-inbox