[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a6f79aba-9f9f-326f-5d73-6e0175f554ab@csgroup.eu>
Date: Fri, 27 Nov 2020 09:22:24 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Anshuman Khandual <anshuman.khandual@....com>, linux-mm@...ck.org,
akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org, catalin.marinas@....com,
steven.price@....com, gerald.schaefer@...ux.ibm.com,
vgupta@...opsys.com, paul.walmsley@...ive.com
Subject: Re: [PATCH 1/2] mm/debug_vm_pgtable/basic: Add validation for
dirtiness after write protect
Le 27/11/2020 à 06:06, Anshuman Khandual a écrit :
> This adds validation tests for dirtiness after write protect conversion for
> each page table level. This is important for platforms such as arm64 that
> removes the hardware dirty bit while making it an write protected one. This
> also fixes pxx_wrprotect() related typos in the documentation file.
>
> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
> index c05d9dcf7891..a5be11210597 100644
> --- a/mm/debug_vm_pgtable.c
> +++ b/mm/debug_vm_pgtable.c
> @@ -70,6 +70,7 @@ static void __init pte_basic_tests(unsigned long pfn, pgprot_t prot)
> WARN_ON(pte_young(pte_mkold(pte_mkyoung(pte))));
> WARN_ON(pte_dirty(pte_mkclean(pte_mkdirty(pte))));
> WARN_ON(pte_write(pte_wrprotect(pte_mkwrite(pte))));
> + WARN_ON(pte_dirty(pte_wrprotect(pte)));
Wondering what you are testing here exactly.
Do you expect that if PTE has the dirty bit, it gets cleared by pte_wrprotect() ?
Powerpc doesn't do that, it only clears the RW bit but the dirty bit remains if it is set, until you
call pte_mkclean() explicitely.
> }
>
> static void __init pte_advanced_tests(struct mm_struct *mm,
> @@ -144,6 +145,7 @@ static void __init pmd_basic_tests(unsigned long pfn, pgprot_t prot)
> WARN_ON(pmd_young(pmd_mkold(pmd_mkyoung(pmd))));
> WARN_ON(pmd_dirty(pmd_mkclean(pmd_mkdirty(pmd))));
> WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd))));
> + WARN_ON(pmd_dirty(pmd_wrprotect(pmd)));
> /*
> * A huge page does not point to next level page table
> * entry. Hence this must qualify as pmd_bad().
> @@ -262,6 +264,7 @@ static void __init pud_basic_tests(unsigned long pfn, pgprot_t prot)
> WARN_ON(!pud_write(pud_mkwrite(pud_wrprotect(pud))));
> WARN_ON(pud_write(pud_wrprotect(pud_mkwrite(pud))));
> WARN_ON(pud_young(pud_mkold(pud_mkyoung(pud))));
> + WARN_ON(pud_dirty(pud_wrprotect(pud)));
>
> if (mm_pmd_folded(mm))
> return;
>
Christophe
Powered by blists - more mailing lists