linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: Fix mapping_dirty_helpers with arm64
@ 2021-03-31 18:23 Zack Rusin
  2021-04-02 11:26 ` Catalin Marinas
  0 siblings, 1 reply; 3+ messages in thread
From: Zack Rusin @ 2021-03-31 18:23 UTC (permalink / raw)
  To: linux-kernel
  Cc: Catalin Marinas, Will Deacon, Peter Zijlstra, linux-arm-kernel

The pagetable walk callbacks in mm/mapping_dirty_helpers.c depend
on a set of helpers from which pud_dirty(pud) was missing. I'm
assuming mapping_dirty_helpers weren't used on ARM64 before
because the missing pud_dirty is causing a compilation error.

The drivers/gpu/drm/vmwgfx code uses mapping_dirty_helpers and
has been ported to ARM64 but it depends on this code getting in
first in order to compile/work.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Zack Rusin <zackr@vmware.com>
---
 arch/arm64/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 47027796c2f9..ecd80f87a996 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -451,6 +451,7 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
 #define pfn_pmd(pfn,prot)	__pmd(__phys_to_pmd_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
 #define mk_pmd(page,prot)	pfn_pmd(page_to_pfn(page),prot)
 
+#define pud_dirty(pud)		pte_dirty(pud_pte(pud))
 #define pud_young(pud)		pte_young(pud_pte(pud))
 #define pud_mkyoung(pud)	pte_pud(pte_mkyoung(pud_pte(pud)))
 #define pud_write(pud)		pte_write(pud_pte(pud))
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/mm: Fix mapping_dirty_helpers with arm64
  2021-03-31 18:23 [PATCH] arm64/mm: Fix mapping_dirty_helpers with arm64 Zack Rusin
@ 2021-04-02 11:26 ` Catalin Marinas
  2021-04-07 17:00   ` Zack Rusin
  0 siblings, 1 reply; 3+ messages in thread
From: Catalin Marinas @ 2021-04-02 11:26 UTC (permalink / raw)
  To: Zack Rusin; +Cc: linux-kernel, Will Deacon, Peter Zijlstra, linux-arm-kernel

On Wed, Mar 31, 2021 at 02:23:44PM -0400, Zack Rusin wrote:
> The pagetable walk callbacks in mm/mapping_dirty_helpers.c depend
> on a set of helpers from which pud_dirty(pud) was missing. I'm
> assuming mapping_dirty_helpers weren't used on ARM64 before
> because the missing pud_dirty is causing a compilation error.
> 
> The drivers/gpu/drm/vmwgfx code uses mapping_dirty_helpers and
> has been ported to ARM64 but it depends on this code getting in
> first in order to compile/work.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: linux-arm-kernel@lists.infradead.org
> Signed-off-by: Zack Rusin <zackr@vmware.com>
> ---
>  arch/arm64/include/asm/pgtable.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index 47027796c2f9..ecd80f87a996 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -451,6 +451,7 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
>  #define pfn_pmd(pfn,prot)	__pmd(__phys_to_pmd_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>  #define mk_pmd(page,prot)	pfn_pmd(page_to_pfn(page),prot)
>  
> +#define pud_dirty(pud)		pte_dirty(pud_pte(pud))
>  #define pud_young(pud)		pte_young(pud_pte(pud))
>  #define pud_mkyoung(pud)	pte_pud(pte_mkyoung(pud_pte(pud)))
>  #define pud_write(pud)		pte_write(pud_pte(pud))

I think pud_dirty() should only be defined if
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD which is not the case on
arm64. Well, the pud_young/mkyoung/write should probably also be removed
until we have pud pages on arm64.

The wp_clean_pud_entry() function bails out early since
pud_trans_unstable() returns 0 on arm64. So we either bracket this
function by some #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD or we
make some generic definitions for pud_* accessors when we don't have
this config.

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/mm: Fix mapping_dirty_helpers with arm64
  2021-04-02 11:26 ` Catalin Marinas
@ 2021-04-07 17:00   ` Zack Rusin
  0 siblings, 0 replies; 3+ messages in thread
From: Zack Rusin @ 2021-04-07 17:00 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: linux-kernel, Will Deacon, Peter Zijlstra, linux-arm-kernel

On 4/2/21 7:26 AM, Catalin Marinas wrote:
> On Wed, Mar 31, 2021 at 02:23:44PM -0400, Zack Rusin wrote:
>> The pagetable walk callbacks in mm/mapping_dirty_helpers.c depend
>> on a set of helpers from which pud_dirty(pud) was missing. I'm
>> assuming mapping_dirty_helpers weren't used on ARM64 before
>> because the missing pud_dirty is causing a compilation error.
>>
>> The drivers/gpu/drm/vmwgfx code uses mapping_dirty_helpers and
>> has been ported to ARM64 but it depends on this code getting in
>> first in order to compile/work.
>>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Cc: linux-arm-kernel@lists.infradead.org
>> Signed-off-by: Zack Rusin <zackr@vmware.com>
>> ---
>>   arch/arm64/include/asm/pgtable.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
>> index 47027796c2f9..ecd80f87a996 100644
>> --- a/arch/arm64/include/asm/pgtable.h
>> +++ b/arch/arm64/include/asm/pgtable.h
>> @@ -451,6 +451,7 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
>>   #define pfn_pmd(pfn,prot)	__pmd(__phys_to_pmd_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>>   #define mk_pmd(page,prot)	pfn_pmd(page_to_pfn(page),prot)
>>   
>> +#define pud_dirty(pud)		pte_dirty(pud_pte(pud))
>>   #define pud_young(pud)		pte_young(pud_pte(pud))
>>   #define pud_mkyoung(pud)	pte_pud(pte_mkyoung(pud_pte(pud)))
>>   #define pud_write(pud)		pte_write(pud_pte(pud))
> 
> I think pud_dirty() should only be defined if
> CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD which is not the case on
> arm64. Well, the pud_young/mkyoung/write should probably also be removed
> until we have pud pages on arm64.

Agreed. I got confused by pud_young and co being defined here even 
though they're all shielded by CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 
when they're used and incorrectly assumed the practice was to define 
them for arm64 here whether CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 
was defined or not.

I'll go ahead and shield the pud_dirty with 
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD in mapping_dirty_helpers.c 
instead.

z

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-07 17:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 18:23 [PATCH] arm64/mm: Fix mapping_dirty_helpers with arm64 Zack Rusin
2021-04-02 11:26 ` Catalin Marinas
2021-04-07 17:00   ` Zack Rusin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).