Re:[PATCH] mm/x86/pat: Only untrack the pfn range if unmap region

David Wang
2024-07-13T03:38:12Z

Hi,

At 2024-07-12 22:42:44, "Peter Xu" <peterx@redhat.com> wrote:
>
>NOTE: I massaged the commit message comparing to the rfc post [1], the
>patch itself is untouched. Also removed rfc tag, and added more people
>into the loop. Please kindly help test this patch if you have a reproducer,
>as I can't reproduce it myself even with the syzbot reproducer on top of
>mm-unstable. Instead of further check on the reproducer, I decided to send
>this out first as we have a bunch of reproducers on the list now..
>---
> mm/memory.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>diff --git a/mm/memory.c b/mm/memory.c
>index 4bcd79619574..f57cc304b318 100644
>--- a/mm/memory.c
>+++ b/mm/memory.c
>@@ -1827,9 +1827,6 @@ static void unmap_single_vma(struct mmu_gather *tlb,
> if (vma->vm_file)
> uprobe_munmap(vma, start, end);
>
>- if (unlikely(vma->vm_flags & VM_PFNMAP))
>- untrack_pfn(vma, 0, 0, mm_wr_locked);
>-
> if (start != end) {
> if (unlikely(is_vm_hugetlb_page(vma))) {
> /*
>@@ -1894,6 +1891,8 @@ void unmap_vmas(struct mmu_gather *tlb, struct ma_state *mas,
> unsigned long start = start_addr;
> unsigned long end = end_addr;
> hugetlb_zap_begin(vma, &start, &end);
>+ if (unlikely(vma->vm_flags & VM_PFNMAP))
>+ untrack_pfn(vma, 0, 0, mm_wr_locked);
> unmap_single_vma(tlb, vma, start, end, &details,
> mm_wr_locked);
> hugetlb_zap_end(vma, &details);
>--
>2.45.0

I apply this patch on 6.10.0-rc7, and confirmed that no kernel warning shows up when I suspend my system(with nvidia GPU),
After several round of suspend/resume cycle, no error/warning observed in kernel log.

Thanks
David