All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <gshan@redhat.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com,
	will@kernel.org, akpm@linux-foundation.org, chuhu@redhat.com,
	shan.gavin@gmail.com
Subject: Re: [PATCH v3 07/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PTE modifying tests
Date: Fri, 23 Jul 2021 14:23:24 +1000	[thread overview]
Message-ID: <2666f07b-7a84-89a4-a738-ffb21f76ca8a@redhat.com> (raw)
In-Reply-To: <492c96ea-5f60-2720-7da8-1fc18a1f95d3@arm.com>

Hi Anshuman,

On 7/23/21 12:39 PM, Anshuman Khandual wrote:
> On 7/22/21 12:07 PM, Gavin Shan wrote:
>>
>>>>          pgdp = pgd_offset(mm, vaddr);
>>>>        p4dp = p4d_alloc(mm, pgdp, vaddr);
>>>> @@ -1272,11 +1275,11 @@ static int __init debug_vm_pgtable(void)
>>>>         * Page table modifying tests. They need to hold
>>>>         * proper page table lock.
>>>>         */
>>>> -
>>>> -    ptep = pte_offset_map_lock(mm, pmdp, vaddr, &ptl);
>>>> -    pte_clear_tests(mm, ptep, pte_aligned, vaddr, prot);
>>>> -    pte_advanced_tests(mm, vma, ptep, pte_aligned, vaddr, prot);
>>>> -    pte_unmap_unlock(ptep, ptl);
>>>> +    ptl = pte_lockptr(args.mm, args.pmdp);
>>>> +    spin_lock(ptl);
>>>> +    pte_clear_tests(&args);
>>>> +    pte_advanced_tests(&args);
>>>> +    spin_unlock(ptl);
>>>
>>> Why pte_offset_map_lock()/pte_unmap_unlock() has been dropped and
>>> spin_lock()/spin_unlock() sequence has been added ? Please dont
>>> change the tests in these patches.
>>>
>>
>> The semantics of pte_offset_map_lock() is to grab and take the lock
>> and return the PTE entry, which is mapped if needed. We already had
>> the PTE entry tracked by args->ptep in init_args(). So some of the
>> operations covered by pte_offset_map_lock() isn't needed any more
> 
> To keep the patch on purpose, please avoid this change here. But if
> required, you could send a follow up patch later.
> 

In order to use pte_offset_map_lock() and pte_unmap_unlock(), we need
a temporary variable @ptep to store the return value from pte_offset_map_lock().
The temporary variable @ptep is passed to pte_unmap_unlock(). It means
we just need the temporary variable to keep the original implementation
in this regard. I will keep pte_offset_map_lock() and pte_unmap_unlock()
in v4.

If we really want to remove the temporary variable (@ptep), we can do it
after this series gets merged.

Thanks,
Gavin


  reply	other threads:[~2021-07-23  4:23 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 13:06 [PATCH v3 00/12] mm/debug_vm_pgtable: Enhancements Gavin Shan
2021-07-19 13:06 ` [PATCH v3 01/12] mm/debug_vm_pgtable: Introduce struct pgtable_debug_args Gavin Shan
2021-07-21  5:44   ` Anshuman Khandual
2021-07-21 10:20     ` Gavin Shan
2021-07-21 10:39       ` Anshuman Khandual
2021-07-21 10:59         ` Anshuman Khandual
2021-07-21 11:59           ` Gavin Shan
2021-07-22  4:41       ` Anshuman Khandual
2021-07-22  6:23         ` Gavin Shan
2021-07-22  7:08           ` Anshuman Khandual
2021-07-23  0:43             ` Gavin Shan
2021-07-19 13:06 ` [PATCH v3 02/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in basic tests Gavin Shan
2021-07-21  5:57   ` Anshuman Khandual
2021-07-21 11:57     ` Gavin Shan
2021-07-19 13:06 ` [PATCH v3 03/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in leaf and savewrite tests Gavin Shan
2021-07-19 13:06 ` [PATCH v3 04/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in protnone and devmap tests Gavin Shan
2021-07-19 13:06 ` [PATCH v3 05/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in soft_dirty and swap tests Gavin Shan
2021-07-19 13:06 ` [PATCH v3 06/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in migration and thp tests Gavin Shan
2021-07-19 13:06 ` [PATCH v3 07/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PTE modifying tests Gavin Shan
2021-07-22  5:56   ` Anshuman Khandual
2021-07-22  6:37     ` Gavin Shan
2021-07-23  2:39       ` Anshuman Khandual
2021-07-23  4:23         ` Gavin Shan [this message]
2021-07-19 13:06 ` [PATCH v3 08/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PMD " Gavin Shan
2021-07-22  5:45   ` Anshuman Khandual
2021-07-22  6:41     ` Gavin Shan
2021-07-22  7:11       ` Anshuman Khandual
2021-07-23  1:00         ` Gavin Shan
2021-07-23  2:33           ` Anshuman Khandual
2021-07-19 13:06 ` [PATCH v3 09/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PUD " Gavin Shan
2021-07-22  5:39   ` Anshuman Khandual
2021-07-22  6:47     ` Gavin Shan
2021-07-19 13:06 ` [PATCH v3 10/12] mm/debug_vm_pgtable: Use struct pgtable_debug_args in PGD and P4D " Gavin Shan
2021-07-22  5:09   ` Anshuman Khandual
2021-07-22  6:50     ` Gavin Shan
2021-07-19 13:06 ` [PATCH v3 11/12] mm/debug_vm_pgtable: Remove unused code Gavin Shan
2021-07-22  4:51   ` Anshuman Khandual
2021-07-22  6:53     ` Gavin Shan
2021-07-19 13:06 ` [PATCH v3 12/12] mm/debug_vm_pgtable: Fix corrupted page flag Gavin Shan
2021-07-21 10:18   ` Anshuman Khandual
2021-07-21 12:03     ` Gavin Shan
2021-07-22  3:51       ` Anshuman Khandual
2021-07-22  6:54         ` Gavin Shan

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=2666f07b-7a84-89a4-a738-ffb21f76ca8a@redhat.com \
    --to=gshan@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shan.gavin@gmail.com \
    --cc=will@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.