Skip to contentSkip to conversation

memblock: Add limit checking to memblock_virt_alloc

PATCH In review Yinghai Lu 8 participants 22 messages Jan 28, 2014 – Jan 30, 2014

Subsystems (2)
lore
Share & tools
lore

Yinghai Lu

author
#0 lore raw

PATCH 1/1 memblock: Add limit checking to memblock_virt_alloc

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

---
 mm/memblock.c |    3 +++
 1 file changed, 3 insertions(+)
mm/memblock.c +3 -0
Index: linux-2.6/mm/memblock.c
===================================================================
@@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc
 	if (!align)
 		align = SMP_CACHE_BYTES;
 
+	if (max_addr > memblock.current_limit)
+		max_addr = memblock.current_limit;
+
 again:
 	alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
 					    nid);
#1 lore raw
Quoted 5 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

author
#2 lore raw
Quoted 10 lines · Dave Hansen
Quoted 5 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

thanks

Yinghai

#3 lore raw
Quoted 4 lines · Yinghai Lu
Quoted 3 lines · Dave Hansen
Quoted 2 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

OK, let me rephrase.

Does anyone want me to test this on a 1TB 64-bit x86 system? If yes, please tell me which patches you want me to test, and on top of which kernel. I have three patches in this area, I think, but I don't want to waste my time testing and reporting the wrong thing.

#4 lore raw
In reply to Yinghai Lu
Quoted 6 lines · Yinghai Lu
Quoted 5 lines · Dave Hansen
Quoted 4 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

It fixes the issue I saw with Xen and 32-bit dom0 blowing up.

Quoted 4 lines

thanks

Yinghai

#5 lore raw
In reply to Yinghai Lu
Quoted 6 lines · Yinghai Lu
Quoted 5 lines · Dave Hansen
Quoted 4 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

It fixes the issue I saw with Xen and 32-bit dom0 blowing up.

Quoted 4 lines

thanks

Yinghai

#6 lore raw

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800

memblock, nobootmem: add memblock_virt_alloc_low()

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!
swapper[0]: bugcheck! 0 [1]

Modules linked in:

CPU: 0 PID: 0 Comm: swapper Not tainted 3.13.0-bisect-09219-g5e345db #10
task: a000000101040000 ti: a000000101040f10 task.ti: a000000101040f10

psr : 00001010084a2018 ifs : 8000000000000797 ip :
[<a000000100eea530>] Not tainted (3.13.0-bisect-09219-g5e345db)
ip is at alloc_bootmem_bdata+0x230/0x790
unat: 0000000000000000 pfs : 0000000000000797 rsc : 0000000000000003
rnat: a000000100dff0ee bsps: 0000000000000000 pr : 96669601598a95a9
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f csd : 0930ffff00063000 ssd : 0930ffff00063000
b0 : a000000100eea530 b6 : a0000001005f4040 b7 : a0000001005f3e00 f6 : 000000000000000000000 f7 : 1003e0000000000000000 f8 : 1003e0044b82fa09b5a53 f9 : 1003e0000000000001680 f10 : 1003e0000000000000008 f11 : 1003e00000000000002d0 r1 : a0000001017ce170 r2 : a00000010158e0a0 r3 : a0000001015ced80 r8 : 000000000000001f r9 : 0000000000000664 r10 : 0000000000000000 r11 : 0000000000000000 r12 : a00000010104fe20 r13 : a000000101040000 r14 : a00000010158e0a8 r15 : a00000010158e0a8 r16 : 0000000006640332 r17 : 0000000000000000 r18 : 0000000000007fff r19 : 0000000000000000 r20 : a000000101727e98 r21 : 0000000000000058 r22 : a000000101616c98 r23 : a000000101616c00 r24 : a000000101616c00 r25 : 00000000000003f8 r26 : a000000100e901a8 r27 : a000000100f59480 r28 : 0000000000000058 r29 : 0000000000000057 r30 : 00000000000016d0 r31 : 0000000000000030

Unable to handle kernel NULL pointer dereference (address 0000000000000000)

swapper[0]: Oops 11012296146944 [2]

-Tony

Quoted 29 lines · Konrad Rzeszutek Wilk
Quoted 6 lines · Yinghai Lu
Quoted 5 lines · Dave Hansen
Quoted 4 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

It fixes the issue I saw with Xen and 32-bit dom0 blowing up.

Quoted 4 lines

thanks

Yinghai

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
In reply to Konrad Rzeszutek Wilk

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800

memblock, nobootmem: add memblock_virt_alloc_low()

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!
swapper[0]: bugcheck! 0 [1]

Modules linked in:

CPU: 0 PID: 0 Comm: swapper Not tainted 3.13.0-bisect-09219-g5e345db #10
task: a000000101040000 ti: a000000101040f10 task.ti: a000000101040f10

psr : 00001010084a2018 ifs : 8000000000000797 ip :
[<a000000100eea530>] Not tainted (3.13.0-bisect-09219-g5e345db)
ip is at alloc_bootmem_bdata+0x230/0x790
unat: 0000000000000000 pfs : 0000000000000797 rsc : 0000000000000003
rnat: a000000100dff0ee bsps: 0000000000000000 pr : 96669601598a95a9
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f csd : 0930ffff00063000 ssd : 0930ffff00063000
b0 : a000000100eea530 b6 : a0000001005f4040 b7 : a0000001005f3e00 f6 : 000000000000000000000 f7 : 1003e0000000000000000 f8 : 1003e0044b82fa09b5a53 f9 : 1003e0000000000001680 f10 : 1003e0000000000000008 f11 : 1003e00000000000002d0 r1 : a0000001017ce170 r2 : a00000010158e0a0 r3 : a0000001015ced80 r8 : 000000000000001f r9 : 0000000000000664 r10 : 0000000000000000 r11 : 0000000000000000 r12 : a00000010104fe20 r13 : a000000101040000 r14 : a00000010158e0a8 r15 : a00000010158e0a8 r16 : 0000000006640332 r17 : 0000000000000000 r18 : 0000000000007fff r19 : 0000000000000000 r20 : a000000101727e98 r21 : 0000000000000058 r22 : a000000101616c98 r23 : a000000101616c00 r24 : a000000101616c00 r25 : 00000000000003f8 r26 : a000000100e901a8 r27 : a000000100f59480 r28 : 0000000000000058 r29 : 0000000000000057 r30 : 00000000000016d0 r31 : 0000000000000030

Unable to handle kernel NULL pointer dereference (address 0000000000000000)

swapper[0]: Oops 11012296146944 [2]

-Tony

Quoted 29 lines · Konrad Rzeszutek Wilk
Quoted 6 lines · Yinghai Lu
Quoted 5 lines · Dave Hansen
Quoted 4 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Do you have a git tree or cumulative set of patches that you'd like us to all test? I'm happy to boot it on my system, I just want to make sure I've got the same set that you're testing.

This one should only affect on arm and x86 the 32 bit kernel with more then 4G RAM.

It fixes the issue I saw with Xen and 32-bit dom0 blowing up.

Quoted 4 lines

thanks

Yinghai

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#8 lore raw
Quoted 6 lines · Tony Luck

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800
Quoted 7 lines

memblock, nobootmem: add memblock_virt_alloc_low()

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!

that's another path with memblock_virt wrapper for bootmem.

Let's me check that.

author
#9 lore raw
Quoted 9 lines · Yinghai Lu
Quoted 8 lines · Tony Luck

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800

memblock, nobootmem: add memblock_virt_alloc_low()

Quoted 7 lines
Quoted 5 lines

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!

that's another path with memblock_virt wrapper for bootmem.

Please check attached patch.

Thanks

Yinghai

Subject: [PATCH] memblock, bootmem: Restore goal for alloc_low

Now we have memblock_virt_alloc_low to replace original bootmem api in swiotlb.

But we should not use BOOTMEM_LOW_LIMIT for arch that does not support CONFIG_NOBOOTMEM, as old api take 0.

| #define alloc_bootmem_low(x) \
|        __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
|#define alloc_bootmem_low_pages_nopanic(x) \
|        __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)

and we have
#define BOOTMEM_LOW_LIMIT __pa(MAX_DMA_ADDRESS)
for CONFIG_NOBOOTMEM.

Restore goal to 0 to fix ia64 crash, that Tony found.

---
 include/linux/bootmem.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bootmem.h +2 -2
Index: linux-2.6/include/linux/bootmem.h
===================================================================
@@ -264,7 +264,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_low_nopanic(
@@ -272,7 +272,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low_nopanic(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low_nopanic(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_from_nopanic(
#10 lore raw

Applying on top of Linus' tree (commit = dda68a8c1707b4011dc3c656fa1b2c6de6f7f304) I just get:

patching file include/linux/bootmem.h
Hunk #1 FAILED at 264.
Hunk #2 FAILED at 272.
2 out of 2 hunks FAILED -- saving rejects to file include/linux/bootmem.h.rej

- not a promising start :-(

-Tony

maintainer
#11 lore raw
Quoted 10 lines · On Wed, 29 Jan 2014 16:12:13 -0800 Tony Luck <[email protected]> wrote:

Applying on top of Linus' tree (commit = dda68a8c1707b4011dc3c656fa1b2c6de6f7f304) I just get:

patching file include/linux/bootmem.h
Hunk #1 FAILED at 264.
Hunk #2 FAILED at 272.
2 out of 2 hunks FAILED -- saving rejects to file include/linux/bootmem.h.rej

- not a promising start :-(

It applies for me. MIME getting you down?

From: Yinghai Lu <[email protected]>
Subject: memblock, bootmem: restore goal for alloc_low

Now we have memblock_virt_alloc_low to replace original bootmem api in swiotlb.

But we should not use BOOTMEM_LOW_LIMIT for arch that does not support CONFIG_NOBOOTMEM, as old api take 0.

| #define alloc_bootmem_low(x) \
|        __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
|#define alloc_bootmem_low_pages_nopanic(x) \
|        __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)

and we have
#define BOOTMEM_LOW_LIMIT __pa(MAX_DMA_ADDRESS)
for CONFIG_NOBOOTMEM.

Restore goal to 0 to fix ia64 crash, that Tony found.

---

 include/linux/bootmem.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bootmem.h renamed from include/linux/bootmem.h~memblock-bootmem-restore-goal-for-alloc_low +2 -2
diff -puN include/linux/bootmem.h~memblock-bootmem-restore-goal-for-alloc_low include/linux/bootmem.h
@@ -264,7 +264,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_low_nopanic(
@@ -272,7 +272,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low_nopanic(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low_nopanic(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_from_nopanic(

_

Tested-by
#12 lore raw
Quoted 1 line · Andrew Morton

It applies for me. MIME getting you down?

Perhaps - Gmail's web client showed me a downward pointing arrow when I moused over the attachment icon in Yinghai's e-mail. So I clicked it ... and it looked like it downloaded a patch-like looking file. So I ran "patch -p1 < file"
and whoops - that wasn't so great after all :-(

Your plain text e-mail version applied just fine.

GUI: 0 CLI: 1

Patch works - my ia64 boots again. Thanks.

-Tony

Tested-by
#13 lore raw
In reply to Andrew Morton
Quoted 1 line · Andrew Morton

It applies for me. MIME getting you down?

Perhaps - Gmail's web client showed me a downward pointing arrow when I moused over the attachment icon in Yinghai's e-mail. So I clicked it ... and it looked like it downloaded a patch-like looking file. So I ran "patch -p1 < file"
and whoops - that wasn't so great after all :-(

Your plain text e-mail version applied just fine.

GUI: 0 CLI: 1

Patch works - my ia64 boots again. Thanks.

-Tony

maintainer
#14 lore raw
In reply to Tony Luck
Quoted 10 lines · On Wed, 29 Jan 2014 16:12:13 -0800 Tony Luck <[email protected]> wrote:

Applying on top of Linus' tree (commit = dda68a8c1707b4011dc3c656fa1b2c6de6f7f304) I just get:

patching file include/linux/bootmem.h
Hunk #1 FAILED at 264.
Hunk #2 FAILED at 272.
2 out of 2 hunks FAILED -- saving rejects to file include/linux/bootmem.h.rej

- not a promising start :-(

It applies for me. MIME getting you down?

From: Yinghai Lu <[email protected]>
Subject: memblock, bootmem: restore goal for alloc_low

Now we have memblock_virt_alloc_low to replace original bootmem api in swiotlb.

But we should not use BOOTMEM_LOW_LIMIT for arch that does not support CONFIG_NOBOOTMEM, as old api take 0.

| #define alloc_bootmem_low(x) \
|        __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
|#define alloc_bootmem_low_pages_nopanic(x) \
|        __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)

and we have
#define BOOTMEM_LOW_LIMIT __pa(MAX_DMA_ADDRESS)
for CONFIG_NOBOOTMEM.

Restore goal to 0 to fix ia64 crash, that Tony found.

---

 include/linux/bootmem.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bootmem.h renamed from include/linux/bootmem.h~memblock-bootmem-restore-goal-for-alloc_low +2 -2
diff -puN include/linux/bootmem.h~memblock-bootmem-restore-goal-for-alloc_low include/linux/bootmem.h
@@ -264,7 +264,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_low_nopanic(
@@ -272,7 +272,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low_nopanic(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low_nopanic(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_from_nopanic(

_

#15 lore raw
In reply to Yinghai Lu

Applying on top of Linus' tree (commit = dda68a8c1707b4011dc3c656fa1b2c6de6f7f304) I just get:

patching file include/linux/bootmem.h
Hunk #1 FAILED at 264.
Hunk #2 FAILED at 272.
2 out of 2 hunks FAILED -- saving rejects to file include/linux/bootmem.h.rej

- not a promising start :-(

-Tony

author
#16 lore raw
In reply to Yinghai Lu
Quoted 9 lines · Yinghai Lu
Quoted 8 lines · Tony Luck

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800

memblock, nobootmem: add memblock_virt_alloc_low()

Quoted 7 lines
Quoted 5 lines

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!

that's another path with memblock_virt wrapper for bootmem.

Please check attached patch.

Thanks

Yinghai

Subject: [PATCH] memblock, bootmem: Restore goal for alloc_low

Now we have memblock_virt_alloc_low to replace original bootmem api in swiotlb.

But we should not use BOOTMEM_LOW_LIMIT for arch that does not support CONFIG_NOBOOTMEM, as old api take 0.

| #define alloc_bootmem_low(x) \
|        __alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
|#define alloc_bootmem_low_pages_nopanic(x) \
|        __alloc_bootmem_low_nopanic(x, PAGE_SIZE, 0)

and we have
#define BOOTMEM_LOW_LIMIT __pa(MAX_DMA_ADDRESS)
for CONFIG_NOBOOTMEM.

Restore goal to 0 to fix ia64 crash, that Tony found.

---
 include/linux/bootmem.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/bootmem.h +2 -2
Index: linux-2.6/include/linux/bootmem.h
===================================================================
@@ -264,7 +264,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_low_nopanic(
@@ -272,7 +272,7 @@ static inline void * __init memblock_vir
 {
 	if (!align)
 		align = SMP_CACHE_BYTES;
-	return __alloc_bootmem_low_nopanic(size, align, BOOTMEM_LOW_LIMIT);
+	return __alloc_bootmem_low_nopanic(size, align, 0);
 }
 
 static inline void * __init memblock_virt_alloc_from_nopanic(

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#17 lore raw
In reply to Tony Luck
Quoted 6 lines · Tony Luck

Hmmph. ia64 is broken too. git bisect says:

commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c

Author: Yinghai Lu <[email protected]>
Date:   Mon Jan 27 17:06:49 2014 -0800
Quoted 7 lines

memblock, nobootmem: add memblock_virt_alloc_low()

is to blame. But this patch doesn't fix it. Still dies with:

PID hash table entries: 4096 (order: -1, 32768 bytes) Sorting __ex_table...
kernel BUG at mm/bootmem.c:504!

that's another path with memblock_virt wrapper for bootmem.

Let's me check that.

maintainer
#18 lore raw
In reply to Yinghai Lu
Quoted 9 lines · On Tue, 28 Jan 2014 14:04:25 -0800 Yinghai Lu <[email protected]> wrote:

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

...

mm/memblock.c static void * __init memblock_virt_alloc · line 1085

Quoted 9 lines
mm/memblock.c +3 -0
@@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc
 	if (!align)
 		align = SMP_CACHE_BYTES;
 
+	if (max_addr > memblock.current_limit)
+		max_addr = memblock.current_limit;
+
 again:
 	alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
 					    nid);

Thanks.

Kevin, Olof and Konrad (at least) have been hitting this. It would be great to get some tested-by's, please?

Tested-by on v1 1/1
#20 lore raw
In reply to Yinghai Lu
Quoted 15 lines · Yinghai Lu

In original bootmem wrapper for memblock, we have limit checking.

Add it to memblock_virt_alloc, to address arm and x86 booting crash.

---
 mm/memblock.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6/mm/memblock.c
===================================================================

mm/memblock.c static void * __init memblock_virt_alloc · line 1085

Quoted 9 lines
mm/memblock.c +3 -0
@@ -1077,6 +1077,9 @@ static void * __init memblock_virt_alloc
        if (!align)
                align = SMP_CACHE_BYTES;
 
+       if (max_addr > memblock.current_limit)
+               max_addr = memblock.current_limit;
+
 again:
        alloc = memblock_find_in_range_node(size, align, min_addr, max_addr,
                                            nid);

Verified various ARM boots to be passing again.

Kevin