linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Huang, Ying" <ying.huang@linux.alibaba.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Catalin Marinas <catalin.marinas@arm.com>
Subject: Re: [PATCH V2] mm/debug_vm_pgtable: Add [pte|pmd]_mkwrite_novma() tests
Date: Wed, 22 Oct 2025 22:24:06 +0200	[thread overview]
Message-ID: <0a121e1b-e238-4a75-b431-7c5a23c70f45@redhat.com> (raw)
In-Reply-To: <87o6pzbbks.fsf@DESKTOP-5N7EMDA>

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



  reply	other threads:[~2025-10-22 20:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  3:29 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 [this message]
2025-10-23  1:12         ` Huang, Ying
2025-10-23  1:17 ` Huang, Ying
2025-10-23  3:32   ` Anshuman Khandual

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0a121e1b-e238-4a75-b431-7c5a23c70f45@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ying.huang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox