Skip to contentSkip to conversation

Widespread boot failures on ARM due to "mm/page_alloc.c: calculate zone_start_pfn at zone_spanned_pages_in_node()"

DISCUSSION Mark Brown 6 participants 14 messages Jan 4, 2016 – Jan 6, 2016

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

Since 20151231 -next has been failing to boot on a wide range of ARM platforms in the kernelci.org boot tests[1]. Doing bisections with Arndale and BeagleBone Black identifies 904769ac82ebf (mm/page_alloc.c:
calculate zone_start_pfn at zone_spanned_pages_in_node()) from the akpm tree as the first broken commit[2,3]. An example bootlog from the failure is:

http://storage.kernelci.org/next/next-20151231/arm-multi_v7_defconfig/lab-cambridge/boot-exynos5250-arndale.html

which shows no output on the console once we start the kernel, a brief sampling of failing boards suggests this is the normal failure mode. x86 and arm64 targets seem fine (juno shows up as failing but the boot log seems fine so it's probably a false positive, Mustang was failing already) and there are a small number of ARM platforms that boot. I've not yet had any time to investigate further than that (including trying a revert of that commit), sorry.

[1] http://kernelci.org/boot/all/job/next/kernel/next-20151231/
[2] https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/135/console
[3] https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/136/console
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160104/4feed3d4/attachment-0001.sig>

maintainer
#1 lore raw
Quoted 17 lines · On Mon, 4 Jan 2016 22:42:33 +0000 Mark Brown <[email protected]> wrote:

Since 20151231 -next has been failing to boot on a wide range of ARM platforms in the kernelci.org boot tests[1]. Doing bisections with Arndale and BeagleBone Black identifies 904769ac82ebf (mm/page_alloc.c:
calculate zone_start_pfn at zone_spanned_pages_in_node()) from the akpm tree as the first broken commit[2,3]. An example bootlog from the failure is:

   http://storage.kernelci.org/next/next-20151231/arm-multi_v7_defconfig/lab-cambridge/boot-exynos5250-arndale.html

which shows no output on the console once we start the kernel, a brief sampling of failing boards suggests this is the normal failure mode. x86 and arm64 targets seem fine (juno shows up as failing but the boot log seems fine so it's probably a false positive, Mustang was failing already) and there are a small number of ARM platforms that boot. I've not yet had any time to investigate further than that (including trying a revert of that commit), sorry.

Quoted 3 lines

[1] http://kernelci.org/boot/all/job/next/kernel/next-20151231/
[2] https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/135/console
[3] https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/136/console

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Arnd's tentative fix is below.

I shall drop that patchset for now.

From: Arnd Bergmann <[email protected]>
Subject: mm/page_alloc.c: set a zone_start_pfn value in zone_spanned_pages_in_node

We got a new build warning in linux-next:

mm/page_alloc.c: In function 'free_area_init_node':
mm/page_alloc.c:5278:25: warning: 'zone_start_pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    zone->zone_start_pfn = zone_start_pfn;

mm/page_alloc.c:5265:17: note: 'zone_start_pfn' was declared here
unsigned long zone_start_pfn, zone_end_pfn;

The code indeed looks wrong, but this is just a guess of what the fix might be: I have not looked it in detail, so please treat this as a bug report.

---

 mm/page_alloc.c |    2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node-fix +2 -0
diff -puN mm/page_alloc.c~mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node-fix mm/page_alloc.c
@@ -5013,6 +5013,8 @@ static inline unsigned long __meminit zo
 					unsigned long *zone_end_pfn,
 					unsigned long *zones_size)
 {
+	*zone_start_pfn = node_start_pfn;
+	*zone_end_pfn = node_end_pfn;
 	return zones_size[zone_type];
 }
 

_

author maintainer
#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 5 lines · On Mon, 4 Jan 2016 22:42:33 +0000 Mark Brown <[email protected]> wrote:

platforms in the kernelci.org boot tests[1]. Doing bisections with Arndale and BeagleBone Black identifies 904769ac82ebf (mm/page_alloc.c:
calculate zone_start_pfn at zone_spanned_pages_in_node()) from the akpm tree as the first broken commit[2,3]. An example bootlog from the failure is:

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160104/05a406fe/attachment.sig>

maintainer
#3 lore raw
Quoted 9 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Mon, 4 Jan 2016 22:42:33 +0000 Mark Brown <[email protected]> wrote:

platforms in the kernelci.org boot tests[1]. Doing bisections with Arndale and BeagleBone Black identifies 904769ac82ebf (mm/page_alloc.c:
calculate zone_start_pfn at zone_spanned_pages_in_node()) from the akpm tree as the first broken commit[2,3]. An example bootlog from the failure is:

Quoted 4 lines
Quoted 2 lines

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Stephen, can we please retain

mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node.patch mm-introduce-kernelcore=mirror-option.patch mm-introduce-kernelcore=mirror-option-fix.patch mm-introduce-kernelcore=mirror-option-fix-2.patch

and add the below?

Or don't bother - I'll do an mmotm tomorrow with these in it.

I'd still like reviewing and testing from Taku Izumi please.

From: Arnd Bergmann <[email protected]>
Subject: mm/page_alloc.c: set a zone_start_pfn value in zone_spanned_pages_in_node

We got a new build warning in linux-next:

mm/page_alloc.c: In function 'free_area_init_node':
mm/page_alloc.c:5278:25: warning: 'zone_start_pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

    zone->zone_start_pfn = zone_start_pfn;

mm/page_alloc.c:5265:17: note: 'zone_start_pfn' was declared here
unsigned long zone_start_pfn, zone_end_pfn;

The code indeed looks wrong, but this is just a guess of what the fix might be: I have not looked it in detail, so please treat this as a bug report.

---

 mm/page_alloc.c |    2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node-fix +2 -0
diff -puN mm/page_alloc.c~mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node-fix mm/page_alloc.c
@@ -5013,6 +5013,8 @@ static inline unsigned long __meminit zo
 					unsigned long *zone_end_pfn,
 					unsigned long *zones_size)
 {
+	*zone_start_pfn = node_start_pfn;
+	*zone_end_pfn = node_end_pfn;
 	return zones_size[zone_type];
 }
 

_

#4 lore raw

Hi Andrew,

Quoted 9 lines · On Mon, 4 Jan 2016 16:35:28 -0800 Andrew Morton <[email protected]>…

Stephen, can we please retain

mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node.patch mm-introduce-kernelcore=mirror-option.patch mm-introduce-kernelcore=mirror-option-fix.patch mm-introduce-kernelcore=mirror-option-fix-2.patch

and add the below?

Sure, that is easier than dropping the above patches, anyway.

Signature · 2 lines
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
#5 lore raw

Hi Andrew,

Quoted 5 lines · On Tue, 5 Jan 2016 11:49:18 +1100 Stephen Rothwell <[email protected]> wrote:
Quoted 3 lines · On Mon, 4 Jan 2016 16:35:28 -0800 Andrew Morton <[email protected]>…

Stephen, can we please retain

Quoted 8 lines
Quoted 6 lines

mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node.patch mm-introduce-kernelcore=mirror-option.patch mm-introduce-kernelcore=mirror-option-fix.patch mm-introduce-kernelcore=mirror-option-fix-2.patch

and add the below?

Sure, that is easier than dropping the above patches, anyway.

I have done that *except* that mm-introduce-kernelcore=mirror-option-fix-2.patch is not in mmotm and I cannot find it anywhere.

Signature · 2 lines
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
maintainer
#6 lore raw
Quoted 13 lines · On Tue, 5 Jan 2016 16:47:16 +1100 Stephen Rothwell <[email protected]> wrote:

Hi Andrew,

Quoted 10 lines · On Tue, 5 Jan 2016 11:49:18 +1100 Stephen Rothwell <[email protected]> wrote:
Quoted 8 lines · On Mon, 4 Jan 2016 16:35:28 -0800 Andrew Morton <[email protected]>…

Stephen, can we please retain

mm-calculate-zone_start_pfn-at-zone_spanned_pages_in_node.patch mm-introduce-kernelcore=mirror-option.patch mm-introduce-kernelcore=mirror-option-fix.patch mm-introduce-kernelcore=mirror-option-fix-2.patch

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

and add the below?

Sure, that is easier than dropping the above patches, anyway.

I have done that *except* that mm-introduce-kernelcore=mirror-option-fix-2.patch is not in mmotm and I cannot find it anywhere.

oops sorry, I took it out so it isn't in today's
http://ozlabs.org/~akpm/mmots/broken-out/. Here:

From: Arnd Bergmann <[email protected]>
Subject: mm: avoid unused variables in memmap_init_zone

A quick fix on mm/page_alloc.c introduced a harmless warning:

mm/page_alloc.c: In function 'memmap_init_zone':
mm/page_alloc.c:4617:44: warning: unused variable 'tmp' [-Wunused-variable] mm/page_alloc.c:4617:26: warning: unused variable 'r' [-Wunused-variable]

This uses another #ifdef to avoid declaring the two variables when the code is not built.

---

 mm/page_alloc.c |    2 ++
 1 file changed, 2 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-introduce-kernelcore=mirror-option-fix-2 +2 -0
diff -puN mm/page_alloc.c~mm-introduce-kernelcore=mirror-option-fix-2 mm/page_alloc.c
@@ -4465,7 +4465,9 @@ void __meminit memmap_init_zone(unsigned
 	unsigned long pfn;
 	struct zone *z;
 	unsigned long nr_initialised = 0;
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
 	struct memblock_region *r = NULL, *tmp;
+#endif
 
 	if (highest_memmap_pfn < end_pfn - 1)
 		highest_memmap_pfn = end_pfn - 1;

_

author maintainer
#7 lore raw
In reply to Andrew Morton
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:
Quoted 2 lines · Andrew Morton

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160105/73cf50d5/attachment.sig>

#8 lore raw
Quoted 9 lines · Mark Brown
Quoted 7 lines · Andrew Morton
Quoted 6 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:
Quoted 2 lines · Andrew Morton

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

Quoted 9 lines
Quoted 1 line

OK, thanks.

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.

With both patches applied(one already in today's -next), I am able to boot on ARM64 platform but I get huge load(for each pfn) of below warning:

-->8

BUG: Bad page state in process swapper  pfn:900000
page:ffffffbde4000000 count:0 mapcount:1 mapping: (null) index:0x0
flags: 0x0()
page dumped because: nonzero mapcount
Modules linked in:
Hardware name: ARM Juno development board (r0) (DT)
Call trace:
[<ffffffc000089830>] dump_backtrace+0x0/0x180
[<ffffffc0000899c4>] show_stack+0x14/0x20
[<ffffffc000335008>] dump_stack+0x90/0xc8
[<ffffffc0001531f8>] bad_page+0xd8/0x138
[<ffffffc000153470>] free_pages_prepare+0x218/0x290
[<ffffffc000154d4c>] __free_pages_ok+0x1c/0xb8
[<ffffffc000155638>] __free_pages+0x30/0x50
[<ffffffc00092fa9c>] __free_pages_bootmem+0xa0/0xa8
[<ffffffc0009321d0>] free_all_bootmem+0x11c/0x184
[<ffffffc000925264>] mem_init+0x48/0x1b4
[<ffffffc0009217e0>] start_kernel+0x224/0x3b4

[<0000000080663000>] 0x80663000
Disabling lock debugging due to kernel taint

Signature · 2 lines
Regards,
Sudeep
author maintainer
#9 lore raw
Quoted 15 lines · Sudeep Holla
Quoted 13 lines · Mark Brown
Quoted 9 lines · Andrew Morton
Quoted 6 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:
Quoted 2 lines · Andrew Morton

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

Quoted 6 lines
Quoted 3 lines

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.

With both patches applied(one already in today's -next), I am able to boot on ARM64 platform but I get huge load(for each pfn) of below warning:

Bisect on today's -next with Arndale (an ARM platform) flags the same patch:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

as does Juno which is an arm64 platform:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/138/console

(it does get to a console but with lots of the backtraces Sudeep
indicated).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160105/66d224f6/attachment.sig>

#10 lore raw
In reply to Sudeep Holla
Quoted 53 lines · Sudeep Holla
Quoted 18 lines · Mark Brown
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:

On Mon, Jan 04, 2016 at 03:09:46PM -0800, Andrew Morton wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Quoted 8 lines

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.

With both patches applied(one already in today's -next), I am able to boot on ARM64 platform but I get huge load(for each pfn) of below warning:

-->8

BUG: Bad page state in process swapper  pfn:900000
page:ffffffbde4000000 count:0 mapcount:1 mapping: (null) index:0x0
flags: 0x0()
page dumped because: nonzero mapcount
Modules linked in:
Hardware name: ARM Juno development board (r0) (DT)
Call trace:
[<ffffffc000089830>] dump_backtrace+0x0/0x180
[<ffffffc0000899c4>] show_stack+0x14/0x20
[<ffffffc000335008>] dump_stack+0x90/0xc8
[<ffffffc0001531f8>] bad_page+0xd8/0x138
[<ffffffc000153470>] free_pages_prepare+0x218/0x290
[<ffffffc000154d4c>] __free_pages_ok+0x1c/0xb8
[<ffffffc000155638>] __free_pages+0x30/0x50
[<ffffffc00092fa9c>] __free_pages_bootmem+0xa0/0xa8
[<ffffffc0009321d0>] free_all_bootmem+0x11c/0x184
[<ffffffc000925264>] mem_init+0x48/0x1b4
[<ffffffc0009217e0>] start_kernel+0x224/0x3b4
Quoted 4 lines

[<0000000080663000>] 0x80663000
Disabling lock debugging due to kernel taint

--

I managed to get 904769ac82ebf60cb54f225f59ae7c064772a4d7 booting on an arm64 machine without errors with the following changes:

=====================================

mm/page_alloc.c +0 -0
index a8bb70d..0edb608 100644
@@ -5013,6 +5013,15 @@ static inline unsigned long __meminit

zone_spanned_pages_in_node(int nid,
unsigned long *zone_end_pfn, unsigned long *zones_size)
{
+ unsigned int zone;
+
+ *zone_start_pfn = node_start_pfn;
+ for (zone = 0; zone < zone_type; zone++) {
+ *zone_start_pfn += zones_size[zone];
+ }
+
+ *zone_end_pfn = *zone_start_pfn + zones_size[zone_type];
+

        return zones_size[zone_type];

}

@@ -5328,6 +5337,8 @@ void __paginginit free_area_init_node(int nid, unsigned long *zones_size,

        pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
                (u64)start_pfn << PAGE_SHIFT,
                end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);

+#else
+ start_pfn = node_start_pfn;
#endif
calculate_node_totalpages(pgdat, start_pfn, end_pfn,
zones_size, zholes_size);

=====================================

My understanding is that 904769a ("mm/page_alloc.c: calculate zone_start_pfn@zone_spanned_pages_in_node()") inadvertently discards information when pgdat->node_start_pfn is removed from free_area_init_core (and zone_start_pfn is no longer updated by "size" in the loop inside free_area_init_core). This isn't an issue with systems where CONFIG_HAVE_MEMBLOCK_NODE_MAP is enabled as zone_start_pfn is set correctly. On systems without CONFIG_HAVE_MEMBLOCK_NODE_MAP, zone_start_pfn is always 0.

When I ported the above fix to linux-next (8ef79cd05e6894c01ab9b41aa918a402fa8022a7) I was able to boot in a VM but not on my actual machine, I'll investigate that tomorrow.

Cheers,
--
Steve

#13 lore raw
In reply to Mark Brown
Quoted 9 lines · Mark Brown

Since 20151231 -next has been failing to boot on a wide range of ARM platforms in the kernelci.org boot tests[1]. Doing bisections with Arndale and BeagleBone Black identifies 904769ac82ebf (mm/page_alloc.c:
calculate zone_start_pfn at zone_spanned_pages_in_node()) from the akpm tree as the first broken commit[2,3]. An example bootlog from the failure is:

   http://storage.kernelci.org/next/next-20151231/arm-multi_v7_defconfig/lab-cambridge/boot-exynos5250-arndale.html
Quoted 8 lines

which shows no output on the console once we start the kernel, a brief sampling of failing boards suggests this is the normal failure mode. x86 and arm64 targets seem fine (juno shows up as failing but the boot log seems fine so it's probably a false positive, Mustang was failing already) and there are a small number of ARM platforms that boot. I've not yet had any time to investigate further than that (including trying a revert of that commit), sorry.

I see the same problem with my qemu tests for arm.

Reverting the offending commit together with cd31fe16b585 ("mm/page_alloc.c:
set a zone_start_pfn value in zone_spanned_pages_in_node") fixes the problem.

Guenter

#11 lore raw
In reply to Steve Capper
Quoted 107 lines · Steve Capper
Quoted 53 lines · Sudeep Holla
Quoted 18 lines · Mark Brown
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:

On Mon, Jan 04, 2016 at 03:09:46PM -0800, Andrew Morton wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Quoted 8 lines

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.

With both patches applied(one already in today's -next), I am able to boot on ARM64 platform but I get huge load(for each pfn) of below warning:

-->8

BUG: Bad page state in process swapper  pfn:900000
page:ffffffbde4000000 count:0 mapcount:1 mapping: (null) index:0x0
flags: 0x0()
page dumped because: nonzero mapcount
Modules linked in:
Hardware name: ARM Juno development board (r0) (DT)
Call trace:
[<ffffffc000089830>] dump_backtrace+0x0/0x180
[<ffffffc0000899c4>] show_stack+0x14/0x20
[<ffffffc000335008>] dump_stack+0x90/0xc8
[<ffffffc0001531f8>] bad_page+0xd8/0x138
[<ffffffc000153470>] free_pages_prepare+0x218/0x290
[<ffffffc000154d4c>] __free_pages_ok+0x1c/0xb8
[<ffffffc000155638>] __free_pages+0x30/0x50
[<ffffffc00092fa9c>] __free_pages_bootmem+0xa0/0xa8
[<ffffffc0009321d0>] free_all_bootmem+0x11c/0x184
[<ffffffc000925264>] mem_init+0x48/0x1b4
[<ffffffc0009217e0>] start_kernel+0x224/0x3b4
Quoted 4 lines

[<0000000080663000>] 0x80663000
Disabling lock debugging due to kernel taint

--

I managed to get 904769ac82ebf60cb54f225f59ae7c064772a4d7 booting on an arm64 machine without errors with the following changes:

=====================================

mm/page_alloc.c +11 -0
index a8bb70d..0edb608 100644
@@ -5013,6 +5013,15 @@ static inline unsigned long __meminit
 zone_spanned_pages_in_node(int nid,
                                         unsigned long *zone_end_pfn,
                                         unsigned long *zones_size)
  {
+       unsigned int zone;
+
+       *zone_start_pfn = node_start_pfn;
+       for (zone = 0; zone < zone_type; zone++) {
+               *zone_start_pfn += zones_size[zone];
+       }
+
+       *zone_end_pfn = *zone_start_pfn + zones_size[zone_type];
+
         return zones_size[zone_type];
  }
@@ -5328,6 +5337,8 @@ void __paginginit free_area_init_node(int nid,
 unsigned long *zones_size,
         pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
                 (u64)start_pfn << PAGE_SHIFT,
                 end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
+#else
+       start_pfn = node_start_pfn;
  #endif
         calculate_node_totalpages(pgdat, start_pfn, end_pfn,
                                   zones_size, zholes_size);

=====================================

My understanding is that 904769a ("mm/page_alloc.c: calculate zone_start_pfn at zone_spanned_pages_in_node()") inadvertently discards information when pgdat->node_start_pfn is removed from free_area_init_core (and zone_start_pfn is no longer updated by "size" in the loop inside free_area_init_core). This isn't an issue with systems where CONFIG_HAVE_MEMBLOCK_NODE_MAP is enabled as zone_start_pfn is set correctly. On systems without CONFIG_HAVE_MEMBLOCK_NODE_MAP, zone_start_pfn is always 0.

Quoted 4 lines

When I ported the above fix to linux-next (8ef79cd05e6894c01ab9b41aa918a402fa8022a7) I was able to boot in a VM but not on my actual machine, I'll investigate that tomorrow.

It fixes the issue on real hardware too(Juno).

Signature · 2 lines
Regards,
Sudeep
#12 lore raw
In reply to Steve Capper
Quoted 107 lines · Steve Capper
Quoted 53 lines · Sudeep Holla
Quoted 18 lines · Mark Brown
Quoted 6 lines · Andrew Morton
Quoted 2 lines · On Mon, 4 Jan 2016 23:55:12 +0000 Mark Brown <[email protected]> wrote:

On Mon, Jan 04, 2016 at 03:09:46PM -0800, Andrew Morton wrote:

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Thanks. That patch has rather a blooper if CONFIG_HAVE_MEMBLOCK_NODE_MAP=n. Is that the case in your testing?

Seems to be what's making a difference from a quick run through, yes.

OK, thanks.

Quoted 8 lines

Seems like I was mistaken here somehow or there's some other problem - I've kicked off another bisect for today's -next:

https://ci.linaro.org/view/people/job/tbaker-boot-bisect-bot/137/console

and will follow up with any results.

With both patches applied(one already in today's -next), I am able to boot on ARM64 platform but I get huge load(for each pfn) of below warning:

-->8

BUG: Bad page state in process swapper  pfn:900000
page:ffffffbde4000000 count:0 mapcount:1 mapping: (null) index:0x0
flags: 0x0()
page dumped because: nonzero mapcount
Modules linked in:
Hardware name: ARM Juno development board (r0) (DT)
Call trace:
[<ffffffc000089830>] dump_backtrace+0x0/0x180
[<ffffffc0000899c4>] show_stack+0x14/0x20
[<ffffffc000335008>] dump_stack+0x90/0xc8
[<ffffffc0001531f8>] bad_page+0xd8/0x138
[<ffffffc000153470>] free_pages_prepare+0x218/0x290
[<ffffffc000154d4c>] __free_pages_ok+0x1c/0xb8
[<ffffffc000155638>] __free_pages+0x30/0x50
[<ffffffc00092fa9c>] __free_pages_bootmem+0xa0/0xa8
[<ffffffc0009321d0>] free_all_bootmem+0x11c/0x184
[<ffffffc000925264>] mem_init+0x48/0x1b4
[<ffffffc0009217e0>] start_kernel+0x224/0x3b4
Quoted 4 lines

[<0000000080663000>] 0x80663000
Disabling lock debugging due to kernel taint

--

I managed to get 904769ac82ebf60cb54f225f59ae7c064772a4d7 booting on an arm64 machine without errors with the following changes:

=====================================

mm/page_alloc.c +11 -0
index a8bb70d..0edb608 100644
@@ -5013,6 +5013,15 @@ static inline unsigned long __meminit
 zone_spanned_pages_in_node(int nid,
                                        unsigned long *zone_end_pfn,
                                        unsigned long *zones_size)
 {
+       unsigned int zone;
+
+       *zone_start_pfn = node_start_pfn;
+       for (zone = 0; zone < zone_type; zone++) {
+               *zone_start_pfn += zones_size[zone];
+       }
+
+       *zone_end_pfn = *zone_start_pfn + zones_size[zone_type];
+
        return zones_size[zone_type];
 }
@@ -5328,6 +5337,8 @@ void __paginginit free_area_init_node(int nid,
 unsigned long *zones_size,
        pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
                (u64)start_pfn << PAGE_SHIFT,
                end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
+#else
+       start_pfn = node_start_pfn;
 #endif
        calculate_node_totalpages(pgdat, start_pfn, end_pfn,
                                  zones_size, zholes_size);

=====================================

My understanding is that 904769a ("mm/page_alloc.c: calculate zone_start_pfn at zone_spanned_pages_in_node()") inadvertently discards information when pgdat->node_start_pfn is removed from free_area_init_core (and zone_start_pfn is no longer updated by "size" in the loop inside free_area_init_core). This isn't an issue with systems where CONFIG_HAVE_MEMBLOCK_NODE_MAP is enabled as zone_start_pfn is set correctly. On systems without CONFIG_HAVE_MEMBLOCK_NODE_MAP, zone_start_pfn is always 0.

Quoted 3 lines

When I ported the above fix to linux-next (8ef79cd05e6894c01ab9b41aa918a402fa8022a7) I was able to boot in a VM but not on my actual machine, I'll investigate that tomorrow.

I got 8ef79cd05e6894c01ab9b41aa918a402fa8022a7 working on my main devboard with the fix above. (It turned out that I had a misconfigured earlycon command line option and this became a problem with one of the pl011 patches.)

Cheers,

Signature · 1 line
Steve