Re: [PATCH 08/11] x86, acpi, memblock: Use __memblock_alloc_base() in acpi_initrd_override()

2013-08-27 Thread Rafael J. Wysocki
On Tuesday, August 27, 2013 05:37:45 PM Tang Chen wrote:
> The current acpi_initrd_override() calls memblock_find_in_range() to allocate
> memory, and pass 0 to %start, which will not limited by the current_limit_low.
> 
> acpi_initrd_override()
>  |->memblock_find_in_range(0, ...)
>  |->memblock_find_in_range_node(0, ...)
> 
> When we want to allocate memory from the end of kernel image to higher memory,
> we need to limit the lowest address to the end of kernel image.
> 
> We have modified memblock_alloc_base_nid() to call 
> memblock_find_in_range_node()
> with %start = MEMBLOCK_ALLOC_ACCESSIBLE, which means it will be limited by
> current_limit_low. And __memblock_alloc_base() calls 
> memblock_alloc_base_nid().
> 
> __memblock_alloc_base()
>  |->memblock_alloc_base_nid()
>  |->memblock_find_in_range_node(MEMBLOCK_ALLOC_ACCESSIBLE, ...)
> 
> So use __memblock_alloc_base() to allocate memory in acpi_initrd_override().
> 
> Signed-off-by: Tang Chen 
> Reviewed-by: Zhang Yanfei 

Looks OK to me.

Acked-by: Rafael J. Wysocki 

> ---
>  drivers/acpi/osl.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index fece767..1d68fc0 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -629,8 +629,8 @@ void __init acpi_initrd_override(void *data, size_t size)
>   return;
>  
>   /* under 4G at first, then above 4G */
> - acpi_tables_addr = memblock_find_in_range(0, (1ULL<<32) - 1,
> - all_tables_size, PAGE_SIZE);
> + acpi_tables_addr = __memblock_alloc_base(all_tables_size,
> +  PAGE_SIZE, (1ULL<<32) - 1);
>   if (!acpi_tables_addr) {
>   WARN_ON(1);
>   return;
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 08/11] x86, acpi, memblock: Use __memblock_alloc_base() in acpi_initrd_override()

2013-08-27 Thread Tang Chen
The current acpi_initrd_override() calls memblock_find_in_range() to allocate
memory, and pass 0 to %start, which will not limited by the current_limit_low.

acpi_initrd_override()
 |->memblock_find_in_range(0, ...)
 |->memblock_find_in_range_node(0, ...)

When we want to allocate memory from the end of kernel image to higher memory,
we need to limit the lowest address to the end of kernel image.

We have modified memblock_alloc_base_nid() to call memblock_find_in_range_node()
with %start = MEMBLOCK_ALLOC_ACCESSIBLE, which means it will be limited by
current_limit_low. And __memblock_alloc_base() calls memblock_alloc_base_nid().

__memblock_alloc_base()
 |->memblock_alloc_base_nid()
 |->memblock_find_in_range_node(MEMBLOCK_ALLOC_ACCESSIBLE, ...)

So use __memblock_alloc_base() to allocate memory in acpi_initrd_override().

Signed-off-by: Tang Chen 
Reviewed-by: Zhang Yanfei 
---
 drivers/acpi/osl.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index fece767..1d68fc0 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -629,8 +629,8 @@ void __init acpi_initrd_override(void *data, size_t size)
return;
 
/* under 4G at first, then above 4G */
-   acpi_tables_addr = memblock_find_in_range(0, (1ULL<<32) - 1,
-   all_tables_size, PAGE_SIZE);
+   acpi_tables_addr = __memblock_alloc_base(all_tables_size,
+PAGE_SIZE, (1ULL<<32) - 1);
if (!acpi_tables_addr) {
WARN_ON(1);
return;
-- 
1.7.1

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