Excerpts from Christophe Leroy's message of October 21, 2021 2:52 pm:
> 
> 
> Le 21/10/2021 à 05:54, Nicholas Piggin a écrit :
>> Radix never sets mmu_linear_psize so it's always 4K, which causes pcpu
>> atom_size to always be PAGE_SIZE. 64e sets it to 1GB always.
>> 
>> Make paths for these platforms to be explicit about what value they set
>> atom_size to.
>> 
>> Signed-off-by: Nicholas Piggin <npig...@gmail.com>
>> ---
>>   arch/powerpc/kernel/setup_64.c | 21 +++++++++++++++------
>>   1 file changed, 15 insertions(+), 6 deletions(-)
>> 
>> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
>> index eaa79a0996d1..7d4bcbc3124e 100644
>> --- a/arch/powerpc/kernel/setup_64.c
>> +++ b/arch/powerpc/kernel/setup_64.c
>> @@ -880,14 +880,23 @@ void __init setup_per_cpu_areas(void)
>>      int rc = -EINVAL;
>>   
>>      /*
>> -     * Linear mapping is one of 4K, 1M and 16M.  For 4K, no need
>> -     * to group units.  For larger mappings, use 1M atom which
>> -     * should be large enough to contain a number of units.
>> +     * BookE and BookS radix are historical values and should be revisited.
>>       */
>> -    if (mmu_linear_psize == MMU_PAGE_4K)
>> -            atom_size = PAGE_SIZE;
>> -    else
>> +    if (IS_ENABLED(CONFIG_PPC_BOOK3E)) {
>>              atom_size = 1 << 20;
>> +    } else if (radix_enabled()) {
>> +            atom_size = PAGE_SIZE;
>> +    } else {
> 
> You can keep a single level (and remove the brackets)
> 
>       if (IS_ENABLED(CONFIG_PPC_BOOK3E))
>               atom_size = SZ_1M;
>       else if (radix_enabled())
>               atom_size = PAGE_SIZE;
>       else if (mmu_linear_psize == MMU_PAGE_4K)
>               atom_size = PAGE_SIZE;
>       else
>               atom_size = SZ_1M;

I could but the below comment and logic applies to BookS hash so I'm 
happier to put it in its own block. Radix later might also inherit a
comment and size from x86-64.

>> +            /*
>> +             * Linear mapping is one of 4K, 1M and 16M.  For 4K, no need
>> +             * to group units.  For larger mappings, use 1M atom which
>> +             * should be large enough to contain a number of units.
>> +             */
>> +            if (mmu_linear_psize == MMU_PAGE_4K)
>> +                    atom_size = PAGE_SIZE;
>> +            else
>> +                    atom_size = 1 << 20;
> 
> Use SZ_1M instead of hardcoding.

Sure.

Thanks,
Nick

Reply via email to