Re: [PATCH] memblock: Add limit checking to memblock_virt_alloc
From: Yinghai Lu
Date: Wed Jan 29 2014 - 18:53:20 EST
On Wed, Jan 29, 2014 at 3:39 PM, Yinghai Lu <yinghai@xxxxxxxxxx> wrote:
> On Wed, Jan 29, 2014 at 3:07 PM, Tony Luck <tony.luck@xxxxxxxxx> wrote:
>> Hmmph. ia64 is broken too. git bisect says:
>>
>> commit ad6492b80f60a2139fa9bf8fd79b182fe5e3647c
>> Author: Yinghai Lu <yinghai@xxxxxxxxxx>
>> 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!
>
> 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.
Reported-by: Tony Luck <tony.luck@xxxxxxxxx>
Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>
---
include/linux/bootmem.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6/include/linux/bootmem.h
===================================================================
--- linux-2.6.orig/include/linux/bootmem.h
+++ 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(