[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <283283a2-f516-6890-ae25-101d2b1b46a2@redhat.com>
Date: Thu, 10 Sep 2020 18:31:38 +1000
From: Gavin Shan <gshan@...hat.com>
To: Anshuman Khandual <anshuman.khandual@....com>,
linux-arm-kernel@...ts.infradead.org
Cc: linux-kernel@...r.kernel.org, catalin.marinas@....com,
will@...nel.org, shan.gavin@...il.com
Subject: Re: [PATCH 2/2] arm64/mm: Use CONT_SHIFT to define CONT_PTE_SHIFT
Hi Anshuman,
On 9/10/20 4:17 PM, Anshuman Khandual wrote:
> On 09/08/2020 12:49 PM, Gavin Shan wrote:
>> The macro CONT_PTE_SHIFT actually depends on CONT_SHIFT, which has
>> been defined in page-def.h, based on CONFIG_ARM64_CONT_SHIFT. Lets
>> reflect the dependency.
>>
>> Signed-off-by: Gavin Shan <gshan@...hat.com>
>> ---
>> arch/arm64/include/asm/pgtable-hwdef.h | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/arch/arm64/include/asm/pgtable-hwdef.h b/arch/arm64/include/asm/pgtable-hwdef.h
>> index 8a399e666837..0bd9469f4323 100644
>> --- a/arch/arm64/include/asm/pgtable-hwdef.h
>> +++ b/arch/arm64/include/asm/pgtable-hwdef.h
>> @@ -81,14 +81,12 @@
>> /*
>> * Contiguous page definitions.
>> */
>> +#define CONT_PTE_SHIFT (CONT_SHIFT + PAGE_SHIFT)
>> #ifdef CONFIG_ARM64_64K_PAGES
>> -#define CONT_PTE_SHIFT (5 + PAGE_SHIFT)
>> #define CONT_PMD_SHIFT (5 + PMD_SHIFT)
>> #elif defined(CONFIG_ARM64_16K_PAGES)
>> -#define CONT_PTE_SHIFT (7 + PAGE_SHIFT)
>> #define CONT_PMD_SHIFT (5 + PMD_SHIFT)
>> #else
>> -#define CONT_PTE_SHIFT (4 + PAGE_SHIFT)
>> #define CONT_PMD_SHIFT (4 + PMD_SHIFT)
>> #endif
> Could not a similar CONT_PMD be created from a new CONFIG_ARM64_CONT_PMD
> config option, which would help unify CONT_PMD_SHIFT here as well ?
>
I was thinking of it, to have CONFIG_ARM64_CONT_PMD and defined the
following macros in arch/arm64/include/asm/page-def.h:
#define CONT_PMD_SHIFT CONFIG_ARM64_CONT_PMD_SHIFT
#define CONT_PMD_SIZE (_AC(1, UL) << (CONT_PMD_SHIFT + PMD_SHIFT)
#define CONT_PMD_MASK (~(CONT_PMD_SIZE - 1))
PMD_SHIFT is variable because PMD could be folded into PUD or PGD,
depending on the kernel configuration. PMD_SHIFT is declared
in arch/arm64/include/asm/pgtable-types.h, which isn't supposed
to be included in "page-def.h".
So the peroper way to handle this might be drop the continuous page
macros in page-def.h and introduce the following ones into pgtable-hwdef.h.
I will post v2 to do this if it sounds good to you.
#define CONT_PTE_SHIFT (CONFIG_ARM64_CONT_PTE_SHIFT + PAGE_SHIFT)
#define CONT_PMD_SHIFT (CONFIG_ARM64_CONT_PMD_SHIFT + PMD_SHIFT)
Thanks,
Gavin
Powered by blists - more mailing lists