* [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
@ 2025-10-22 3:29 Anshuman Khandual
2025-10-22 7:33 ` Huang, Ying
2025-10-23 1:17 ` Huang, Ying
0 siblings, 2 replies; 8+ messages in thread
From: Anshuman Khandual @ 2025-10-22 3:29 UTC (permalink / raw)
To: linux-mm
Cc: Anshuman Khandual, Andrew Morton, David Hildenbrand, Huang Ying,
linux-kernel, Catalin Marinas
Add some [pte|pmd]_mkwrite_novma() relevant tests.
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Huang Ying <ying.huang@linux.alibaba.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
These tests clear on arm64 platform after the following recent patch.
https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
Changes in V2:
- Added a new test combination per Huang
Changes in V1:
https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
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))));
+ WARN_ON(!pte_write(pte_mkwrite_novma(pte_wrprotect(pte))));
+ WARN_ON(pte_write(pte_wrprotect(pte_mkwrite_novma(pte))));
}
static void __init pte_advanced_tests(struct pgtable_debug_args *args)
@@ -195,6 +201,12 @@ static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx)
WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma))));
WARN_ON(pmd_dirty(pmd_wrprotect(pmd_mkclean(pmd))));
WARN_ON(!pmd_dirty(pmd_wrprotect(pmd_mkdirty(pmd))));
+
+ WARN_ON(pmd_dirty(pmd_mkwrite_novma(pmd_mkclean(pmd))));
+ WARN_ON(!pmd_write(pmd_mkdirty(pmd_mkwrite_novma(pmd))));
+ WARN_ON(!pmd_write(pmd_mkwrite_novma(pmd_wrprotect(pmd))));
+ WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite_novma(pmd))));
+
/*
* A huge page does not point to next level page table
* entry. Hence this must qualify as pmd_bad().
--
2.30.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 3:29 [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests Anshuman Khandual
@ 2025-10-22 7:33 ` Huang, Ying
2025-10-22 7:58 ` Anshuman Khandual
2025-10-23 1:17 ` Huang, Ying
1 sibling, 1 reply; 8+ messages in thread
From: Huang, Ying @ 2025-10-22 7:33 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel,
Catalin Marinas
Anshuman Khandual <anshuman.khandual@arm.com> writes:
> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Huang Ying <ying.huang@linux.alibaba.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> These tests clear on arm64 platform after the following recent patch.
>
> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>
> Changes in V2:
>
> - Added a new test combination per Huang
>
> Changes in V1:
>
> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>
> 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)
?
> + WARN_ON(!pte_write(pte_mkwrite_novma(pte_wrprotect(pte))));
> + WARN_ON(pte_write(pte_wrprotect(pte_mkwrite_novma(pte))));
> }
>
> static void __init pte_advanced_tests(struct pgtable_debug_args *args)
> @@ -195,6 +201,12 @@ static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx)
> WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma))));
> WARN_ON(pmd_dirty(pmd_wrprotect(pmd_mkclean(pmd))));
> WARN_ON(!pmd_dirty(pmd_wrprotect(pmd_mkdirty(pmd))));
> +
> + WARN_ON(pmd_dirty(pmd_mkwrite_novma(pmd_mkclean(pmd))));
> + WARN_ON(!pmd_write(pmd_mkdirty(pmd_mkwrite_novma(pmd))));
> + WARN_ON(!pmd_write(pmd_mkwrite_novma(pmd_wrprotect(pmd))));
> + WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite_novma(pmd))));
> +
> /*
> * A huge page does not point to next level page table
> * entry. Hence this must qualify as pmd_bad().
---
Best Regards,
Huang, Ying
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 7:33 ` Huang, Ying
@ 2025-10-22 7:58 ` Anshuman Khandual
2025-10-22 8:11 ` Huang, Ying
0 siblings, 1 reply; 8+ messages in thread
From: Anshuman Khandual @ 2025-10-22 7:58 UTC (permalink / raw)
To: Huang, Ying
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel,
Catalin Marinas
On 22/10/25 1:03 PM, Huang, Ying wrote:
> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>
>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: David Hildenbrand <david@redhat.com>
>> Cc: Huang Ying <ying.huang@linux.alibaba.com>
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> These tests clear on arm64 platform after the following recent patch.
>>
>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>>
>> Changes in V2:
>>
>> - Added a new test combination per Huang
>>
>> Changes in V1:
>>
>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>>
>> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 7:58 ` Anshuman Khandual
@ 2025-10-22 8:11 ` Huang, Ying
2025-10-22 20:24 ` David Hildenbrand
0 siblings, 1 reply; 8+ messages in thread
From: Huang, Ying @ 2025-10-22 8:11 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel,
Catalin Marinas
Anshuman Khandual <anshuman.khandual@arm.com> writes:
> On 22/10/25 1:03 PM, Huang, Ying wrote:
>> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>>
>>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>>
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> Cc: David Hildenbrand <david@redhat.com>
>>> Cc: Huang Ying <ying.huang@linux.alibaba.com>
>>> Cc: linux-mm@kvack.org
>>> Cc: linux-kernel@vger.kernel.org
>>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>> ---
>>> These tests clear on arm64 platform after the following recent patch.
>>>
>>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>>>
>>> Changes in V2:
>>>
>>> - Added a new test combination per Huang
>>>
>>> Changes in V1:
>>>
>>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>>>
>>> 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.
IIUC, pte_mkwrite() is a more formal interface. pte_mkwrite_novma() is
used to implement pte_mkwrite(). So, IMHO, we should use the more
formal pte_mkwrite() interface if possible.
---
Best Regards,
Huang, Ying
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 8:11 ` Huang, Ying
@ 2025-10-22 20:24 ` David Hildenbrand
2025-10-23 1:12 ` Huang, Ying
0 siblings, 1 reply; 8+ messages in thread
From: David Hildenbrand @ 2025-10-22 20:24 UTC (permalink / raw)
To: Huang, Ying, Anshuman Khandual
Cc: linux-mm, Andrew Morton, linux-kernel, Catalin Marinas
On 22.10.25 10:11, Huang, Ying wrote:
> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>
>> On 22/10/25 1:03 PM, Huang, Ying wrote:
>>> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>>>
>>>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>>>
>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>> Cc: David Hildenbrand <david@redhat.com>
>>>> Cc: Huang Ying <ying.huang@linux.alibaba.com>
>>>> Cc: linux-mm@kvack.org
>>>> Cc: linux-kernel@vger.kernel.org
>>>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>>> ---
>>>> These tests clear on arm64 platform after the following recent patch.
>>>>
>>>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>>>>
>>>> Changes in V2:
>>>>
>>>> - Added a new test combination per Huang
>>>>
>>>> Changes in V1:
>>>>
>>>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>>>>
>>>> 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.
>
> IIUC, pte_mkwrite() is a more formal interface. pte_mkwrite_novma() is
> used to implement pte_mkwrite(). So, IMHO, we should use the more
> formal pte_mkwrite() interface if possible.
pte_mkwrite() does different things based on VMA flags on some archs
(e.g., x86). So to test the "interesting" stuff one would have to craft
a special VMA.
Without any special flags pte_mkwrite() really is just pte_mkwrite_novma().
--
Cheers
David / dhildenb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 20:24 ` David Hildenbrand
@ 2025-10-23 1:12 ` Huang, Ying
0 siblings, 0 replies; 8+ messages in thread
From: Huang, Ying @ 2025-10-23 1:12 UTC (permalink / raw)
To: David Hildenbrand, Anshuman Khandual
Cc: Anshuman Khandual, linux-mm, Andrew Morton, linux-kernel,
Catalin Marinas
David Hildenbrand <david@redhat.com> writes:
> On 22.10.25 10:11, Huang, Ying wrote:
>> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>>
>>> On 22/10/25 1:03 PM, Huang, Ying wrote:
>>>> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>>>>
>>>>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>>>>
>>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>>> Cc: David Hildenbrand <david@redhat.com>
>>>>> Cc: Huang Ying <ying.huang@linux.alibaba.com>
>>>>> Cc: linux-mm@kvack.org
>>>>> Cc: linux-kernel@vger.kernel.org
>>>>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>>>>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>>>>> ---
>>>>> These tests clear on arm64 platform after the following recent patch.
>>>>>
>>>>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>>>>>
>>>>> Changes in V2:
>>>>>
>>>>> - Added a new test combination per Huang
>>>>>
>>>>> Changes in V1:
>>>>>
>>>>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>>>>>
>>>>> 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.
>> IIUC, pte_mkwrite() is a more formal interface. pte_mkwrite_novma()
>> is
>> used to implement pte_mkwrite(). So, IMHO, we should use the more
>> formal pte_mkwrite() interface if possible.
>
> pte_mkwrite() does different things based on VMA flags on some archs
> (e.g., x86). So to test the "interesting" stuff one would have to
> craft a special VMA.
>
> Without any special flags pte_mkwrite() really is just pte_mkwrite_novma().
Thanks for explanation. If so, I'm fine to use pte_mkwrite_novma() in
the tests.
---
Best Regards,
Huang, Ying
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-22 3:29 [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests Anshuman Khandual
2025-10-22 7:33 ` Huang, Ying
@ 2025-10-23 1:17 ` Huang, Ying
2025-10-23 3:32 ` Anshuman Khandual
1 sibling, 1 reply; 8+ messages in thread
From: Huang, Ying @ 2025-10-23 1:17 UTC (permalink / raw)
To: Anshuman Khandual
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel,
Catalin Marinas
Anshuman Khandual <anshuman.khandual@arm.com> writes:
> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: David Hildenbrand <david@redhat.com>
> Cc: Huang Ying <ying.huang@linux.alibaba.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> These tests clear on arm64 platform after the following recent patch.
>
> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>
> Changes in V2:
>
> - Added a new test combination per Huang
>
> Changes in V1:
>
> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>
> 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))));
> + WARN_ON(!pte_write(pte_mkwrite_novma(pte_wrprotect(pte))));
> + WARN_ON(pte_write(pte_wrprotect(pte_mkwrite_novma(pte))));
> }
>
> static void __init pte_advanced_tests(struct pgtable_debug_args *args)
> @@ -195,6 +201,12 @@ static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx)
> WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma))));
> WARN_ON(pmd_dirty(pmd_wrprotect(pmd_mkclean(pmd))));
> WARN_ON(!pmd_dirty(pmd_wrprotect(pmd_mkdirty(pmd))));
> +
> + WARN_ON(pmd_dirty(pmd_mkwrite_novma(pmd_mkclean(pmd))));
> + WARN_ON(!pmd_write(pmd_mkdirty(pmd_mkwrite_novma(pmd))));
> + WARN_ON(!pmd_write(pmd_mkwrite_novma(pmd_wrprotect(pmd))));
> + WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite_novma(pmd))));
Why not add
WARN_ON(!pmd_dirty(pmd_mkwrite_novma(pmd_mkdirty(pte))));
too?
---
Best Regards,
Huang, Ying
> +
> /*
> * A huge page does not point to next level page table
> * entry. Hence this must qualify as pmd_bad().
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
2025-10-23 1:17 ` Huang, Ying
@ 2025-10-23 3:32 ` Anshuman Khandual
0 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2025-10-23 3:32 UTC (permalink / raw)
To: Huang, Ying
Cc: linux-mm, Andrew Morton, David Hildenbrand, linux-kernel,
Catalin Marinas
On 23/10/25 6:47 AM, Huang, Ying wrote:
> Anshuman Khandual <anshuman.khandual@arm.com> writes:
>
>> Add some [pte|pmd]_mkwrite_novma() relevant tests.
>>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: David Hildenbrand <david@redhat.com>
>> Cc: Huang Ying <ying.huang@linux.alibaba.com>
>> Cc: linux-mm@kvack.org
>> Cc: linux-kernel@vger.kernel.org
>> Suggested-by: Catalin Marinas <catalin.marinas@arm.com>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> These tests clear on arm64 platform after the following recent patch.
>>
>> https://lore.kernel.org/all/20251015023712.46598-1-ying.huang@linux.alibaba.com/
>>
>> Changes in V2:
>>
>> - Added a new test combination per Huang
>>
>> Changes in V1:
>>
>> https://lore.kernel.org/all/20251021024424.2390325-1-anshuman.khandual@arm.com/
>>
>> 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))));
>> + WARN_ON(!pte_write(pte_mkwrite_novma(pte_wrprotect(pte))));
>> + WARN_ON(pte_write(pte_wrprotect(pte_mkwrite_novma(pte))));
>> }
>>
>> static void __init pte_advanced_tests(struct pgtable_debug_args *args)
>> @@ -195,6 +201,12 @@ static void __init pmd_basic_tests(struct pgtable_debug_args *args, int idx)
>> WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite(pmd, args->vma))));
>> WARN_ON(pmd_dirty(pmd_wrprotect(pmd_mkclean(pmd))));
>> WARN_ON(!pmd_dirty(pmd_wrprotect(pmd_mkdirty(pmd))));
>> +
>> + WARN_ON(pmd_dirty(pmd_mkwrite_novma(pmd_mkclean(pmd))));
>> + WARN_ON(!pmd_write(pmd_mkdirty(pmd_mkwrite_novma(pmd))));
>> + WARN_ON(!pmd_write(pmd_mkwrite_novma(pmd_wrprotect(pmd))));
>> + WARN_ON(pmd_write(pmd_wrprotect(pmd_mkwrite_novma(pmd))));
>
> Why not add
>
> WARN_ON(!pmd_dirty(pmd_mkwrite_novma(pmd_mkdirty(pte))));
>
> too?
Sure will add the above test which will also be symmetrical with a
similar PTE test being proposed here.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-10-23 3:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-22 3:29 [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests Anshuman Khandual
2025-10-22 7:33 ` Huang, Ying
2025-10-22 7:58 ` Anshuman Khandual
2025-10-22 8:11 ` Huang, Ying
2025-10-22 20:24 ` David Hildenbrand
2025-10-23 1:12 ` Huang, Ying
2025-10-23 1:17 ` Huang, Ying
2025-10-23 3:32 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox