Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
From: Anshuman Khandual
Date: Wed Oct 22 2025 - 03:58:49 EST
On 22/10/25 1:03 PM, Huang, Ying wrote:
> Anshuman Khandual <anshuman.khandual@xxxxxxx> writes:
>
>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>
>> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>> Cc: David Hildenbrand <david@xxxxxxxxxx>
>> Cc: Huang Ying <ying.huang@xxxxxxxxxxxxxxxxx>
>> Cc: linux-mm@xxxxxxxxx
>> Cc: linux-kernel@xxxxxxxxxxxxxxx
>> Suggested-by: Catalin Marinas <catalin.marinas@xxxxxxx>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
>> ---
>> These tests clear on arm64 platform after the following recent patch.
>>
>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@xxxxxxxxxxxxxxxxx/
>>
>> Changes in V2:
>>
>> - Added a new test combination per Huang
>>
>> Changes in V1:
>>
>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@xxxxxxx/
>>
>> mm/debug_vm_pgtable.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
>> index 830107b6dd08..def344bb4a32 100644
>> --- a/mm/debug_vm_pgtable.c
>> +++ b/mm/debug_vm_pgtable.c
>> @@ -102,6 +102,12 @@ static void __init pte_basic_tests(struct pgtable_debug_args *args, int idx)
>> WARN_ON(pte_write(pte_wrprotect(pte_mkwrite(pte, args->vma))));
>> WARN_ON(pte_dirty(pte_wrprotect(pte_mkclean(pte))));
>> WARN_ON(!pte_dirty(pte_wrprotect(pte_mkdirty(pte))));
>> +
>> + WARN_ON(!pte_dirty(pte_mkwrite_novma(pte_mkdirty(pte))));
>> + WARN_ON(pte_dirty(pte_mkwrite_novma(pte_mkclean(pte))));
>> + WARN_ON(!pte_write(pte_mkdirty(pte_mkwrite_novma(pte))));
>
> Why do you use
>
> pte_mkwrite_novma(pte)
>
> instead of
>
> pte_mkwrite(pte, args->vma)
Just wanted to have more coverage for pte_mkwrite_novma() helper which was missing
till now in this test. But just wondering is there a specific reason for replacing
this with pte_mkwrite() helper instead here ? Also we could probably add tests for
both these helper variations if that is preferred.