diff mbox series

[v4,5/6] mm: Only remove nomap flag for initrd

Message ID 20220613082147.183145-6-mawupeng1@huawei.com (mailing list archive)
State New
Headers show
Series introduce mirrored memory support for arm64 | expand

Commit Message

mawupeng June 13, 2022, 8:21 a.m. UTC
From: Ma Wupeng <mawupeng1@huawei.com>

Commit 177e15f0c144 ("arm64: add the initrd region to the linear mapping explicitly")
remove all the flags of the memory used by initrd. This is fine since
MEMBLOCK_MIRROR is not used in arm64.

However with mirrored feature introduced to arm64, this will clear the mirrored
flag used by initrd, which will lead to error log printed by
find_zone_movable_pfns_for_nodes() if the lower 4G range has some non-mirrored
memory.

To solve this problem, only MEMBLOCK_NOMAP flag will be removed via
memblock_clear_nomap().

Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ard Biesheuvel June 13, 2022, 9:42 a.m. UTC | #1
On Mon, 13 Jun 2022 at 10:00, Wupeng Ma <mawupeng1@huawei.com> wrote:
>
> From: Ma Wupeng <mawupeng1@huawei.com>
>
> Commit 177e15f0c144 ("arm64: add the initrd region to the linear mapping explicitly")
> remove all the flags of the memory used by initrd. This is fine since
> MEMBLOCK_MIRROR is not used in arm64.
>
> However with mirrored feature introduced to arm64, this will clear the mirrored
> flag used by initrd, which will lead to error log printed by
> find_zone_movable_pfns_for_nodes() if the lower 4G range has some non-mirrored
> memory.
>
> To solve this problem, only MEMBLOCK_NOMAP flag will be removed via
> memblock_clear_nomap().
>
> Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>

Reviewed-by: Ard Biesheuvel <ardb@kernel.org>

This needs and ack from the arm64 maintainers, please?
And also please fix the subject to include 'arm64'


> ---
>  arch/arm64/mm/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 339ee84e5a61..8456dbae9441 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -350,8 +350,8 @@ void __init arm64_memblock_init(void)
>                         "initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
>                         phys_initrd_size = 0;
>                 } else {
> -                       memblock_remove(base, size); /* clear MEMBLOCK_ flags */
>                         memblock_add(base, size);
> +                       memblock_clear_nomap(base, size);
>                         memblock_reserve(base, size);
>                 }
>         }
> --
> 2.25.1
>
mawupeng June 13, 2022, 10:50 a.m. UTC | #2
On 6/13/2022 5:42 PM, Ard Biesheuvel wrote:
> On Mon, 13 Jun 2022 at 10:00, Wupeng Ma <mawupeng1@huawei.com> wrote:
>>
>> From: Ma Wupeng <mawupeng1@huawei.com>
>>
>> Commit 177e15f0c144 ("arm64: add the initrd region to the linear mapping explicitly")
>> remove all the flags of the memory used by initrd. This is fine since
>> MEMBLOCK_MIRROR is not used in arm64.
>>
>> However with mirrored feature introduced to arm64, this will clear the mirrored
>> flag used by initrd, which will lead to error log printed by
>> find_zone_movable_pfns_for_nodes() if the lower 4G range has some non-mirrored
>> memory.
>>
>> To solve this problem, only MEMBLOCK_NOMAP flag will be removed via
>> memblock_clear_nomap().
>>
>> Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
> 
> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
> 
> This needs and ack from the arm64 maintainers, please?
> And also please fix the subject to include 'arm64'
> 

Ok, I will include 'arm64' in my subject in v5.

Thanks for reviewing.

> 
>> ---
>>  arch/arm64/mm/init.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
>> index 339ee84e5a61..8456dbae9441 100644
>> --- a/arch/arm64/mm/init.c
>> +++ b/arch/arm64/mm/init.c
>> @@ -350,8 +350,8 @@ void __init arm64_memblock_init(void)
>>                         "initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
>>                         phys_initrd_size = 0;
>>                 } else {
>> -                       memblock_remove(base, size); /* clear MEMBLOCK_ flags */
>>                         memblock_add(base, size);
>> +                       memblock_clear_nomap(base, size);
>>                         memblock_reserve(base, size);
>>                 }
>>         }
>> --
>> 2.25.1
>>
> .
diff mbox series

Patch

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 339ee84e5a61..8456dbae9441 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -350,8 +350,8 @@  void __init arm64_memblock_init(void)
 			"initrd not fully accessible via the linear mapping -- please check your bootloader ...\n")) {
 			phys_initrd_size = 0;
 		} else {
-			memblock_remove(base, size); /* clear MEMBLOCK_ flags */
 			memblock_add(base, size);
+			memblock_clear_nomap(base, size);
 			memblock_reserve(base, size);
 		}
 	}