Re: [PATCH v13 06/14] mm: HUGE_VMAP arch support cleanup

Christophe Leroy
2021-04-28T10:20:51Z

Le 28/04/2021 à 10:32, Christophe Leroy a écrit :
>
>
> Le 17/03/2021 à 07:23, Nicholas Piggin a écrit :
>> This changes the awkward approach where architectures provide init
>> functions to determine which levels they can provide large mappings for,
>> to one where the arch is queried for each call.
>>
>> This removes code and indirection, and allows constant-folding of dead
>> code for unsupported levels.
>>
>> This also adds a prot argument to the arch query. This is unused
>> currently but could help with some architectures (e.g., some powerpc
>> processors can't map uncacheable memory with large pages).
>>
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: x86@kernel.org
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Reviewed-by: Ding Tianhong <dingtianhong@huawei.com>
>> Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64]
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>>   arch/arm64/include/asm/vmalloc.h         |  8 ++
>>   arch/arm64/mm/mmu.c                      | 10 +--
>>   arch/powerpc/include/asm/vmalloc.h       |  8 ++
>>   arch/powerpc/mm/book3s64/radix_pgtable.c |  8 +-
>>   arch/x86/include/asm/vmalloc.h           |  7 ++
>>   arch/x86/mm/ioremap.c                    | 12 +--
>>   include/linux/io.h                       |  9 ---
>>   include/linux/vmalloc.h                  |  6 ++
>>   init/main.c                              |  1 -
>>   mm/debug_vm_pgtable.c                    |  4 +-
>>   mm/ioremap.c                             | 94 ++++++++++--------------
>>   11 files changed, 87 insertions(+), 80 deletions(-)
>>
>
>> diff --git a/mm/ioremap.c b/mm/ioremap.c
>> index 3f4d36f9745a..3264d0203785 100644
>> --- a/mm/ioremap.c
>> +++ b/mm/ioremap.c
>> @@ -16,49 +16,16 @@
>>   #include "pgalloc-track.h"
>>   #ifdef CONFIG_HAVE_ARCH_HUGE_VMAP
>> -static int __read_mostly ioremap_p4d_capable;
>> -static int __read_mostly ioremap_pud_capable;
>> -static int __read_mostly ioremap_pmd_capable;
>> -static int __read_mostly ioremap_huge_disabled;
>> +static bool __ro_after_init iomap_max_page_shift = PAGE_SHIFT;
>
> Must be an int, not a bool.

And the initial value seems wrong. Should be P4D_SHIFT ?

>
>>   static int __init set_nohugeiomap(char *str)
>>   {
>> -    ioremap_huge_disabled = 1;
>> +    iomap_max_page_shift = P4D_SHIFT;

And PAGE_SHIFT here when NO hugeiomap ?

>>       return 0;
>>   }
>>   early_param("nohugeiomap", set_nohugeiomap);

Christophe