| From: Peter Xu <peterx@redhat.com> |
| Subject: mm/dax: dump start address in fault handler |
| Date: Mon, 12 Aug 2024 14:12:19 -0400 |
| |
| Patch series "mm/mprotect: Fix dax puds", v5. |
| |
| Dax supports pud pages for a while, but mprotect on puds was missing since |
| the start. This series tries to fix that by providing pud handling in |
| mprotect(). The goal is to add more types of pud mappings like hugetlb or |
| pfnmaps. This series paves way for it by fixing known pud entries. |
| |
| Considering nobody reported this until when I looked at those other types |
| of pud mappings, I am thinking maybe it doesn't need to be a fix for |
| stable and this may not need to be backported. I would guess whoever |
| cares about mprotect() won't care 1G dax puds yet, vice versa. I hope |
| fixing that in new kernels would be fine, but I'm open to suggestions. |
| |
| There're a few small things changed to teach mprotect work on PUDs. E.g. |
| it will need to start with dropping NUMA_HUGE_PTE_UPDATES which may stop |
| making sense when there can be more than one type of huge pte. OTOH, |
| we'll also need to push the mmu notifiers from pmd to pud layers, which |
| might need some attention but so far I think it's safe. For such details, |
| please refer to each patch's commit message. |
| |
| The mprotect() pud process should be straightforward, as I kept it as |
| simple as possible. There's no NUMA handled as dax simply doesn't support |
| that. There's also no userfault involvements as file memory (even if work |
| with userfault-wp async mode) will need to split a pud, so pud entry |
| doesn't need to yet know userfault's existance (but hugetlb entries will; |
| that's also for later). |
| |
| |
| This patch (of 7): |
| |
| Currently the dax fault handler dumps the vma range when dynamic debugging |
| enabled. That's mostly not useful. Dump the (aligned) address instead |
| with the order info. |
| |
| Link: https://lkml.kernel.org/r/20240812181225.1360970-1-peterx@redhat.com |
| Link: https://lkml.kernel.org/r/20240812181225.1360970-2-peterx@redhat.com |
| Signed-off-by: Peter Xu <peterx@redhat.com> |
| Acked-by: David Hildenbrand <david@redhat.com> |
| Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> |
| Cc: Borislav Petkov <bp@alien8.de> |
| Cc: Christophe Leroy <christophe.leroy@csgroup.eu> |
| Cc: Dan Williams <dan.j.williams@intel.com> |
| Cc: Dave Hansen <dave.hansen@linux.intel.com> |
| Cc: Dave Jiang <dave.jiang@intel.com> |
| Cc: David Rientjes <rientjes@google.com> |
| Cc: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com> |
| Cc: Hugh Dickins <hughd@google.com> |
| Cc: Ingo Molnar <mingo@redhat.com> |
| Cc: Kirill A. Shutemov <kirill@shutemov.name> |
| Cc: Matthew Wilcox <willy@infradead.org> |
| Cc: Michael Ellerman <mpe@ellerman.id.au> |
| Cc: Nicholas Piggin <npiggin@gmail.com> |
| Cc: Oscar Salvador <osalvador@suse.de> |
| Cc: Paolo Bonzini <pbonzini@redhat.com> |
| Cc: Rik van Riel <riel@surriel.com> |
| Cc: Sean Christopherson <seanjc@google.com> |
| Cc: Thomas Gleixner <tglx@linutronix.de> |
| Cc: Vlastimil Babka <vbabka@suse.cz> |
| Signed-off-by: Andrew Morton <akpm@linux-foundation.org> |
| --- |
| |
| drivers/dax/device.c | 6 +++--- |
| 1 file changed, 3 insertions(+), 3 deletions(-) |
| |
| --- a/drivers/dax/device.c~mm-dax-dump-start-address-in-fault-handler |
| +++ a/drivers/dax/device.c |
| @@ -235,9 +235,9 @@ static vm_fault_t dev_dax_huge_fault(str |
| int id; |
| struct dev_dax *dev_dax = filp->private_data; |
| |
| - dev_dbg(&dev_dax->dev, "%s: %s (%#lx - %#lx) order:%d\n", current->comm, |
| - (vmf->flags & FAULT_FLAG_WRITE) ? "write" : "read", |
| - vmf->vma->vm_start, vmf->vma->vm_end, order); |
| + dev_dbg(&dev_dax->dev, "%s: op=%s addr=%#lx order=%d\n", current->comm, |
| + (vmf->flags & FAULT_FLAG_WRITE) ? "write" : "read", |
| + vmf->address & ~((1UL << (order + PAGE_SHIFT)) - 1), order); |
| |
| id = dax_read_lock(); |
| if (order == 0) |
| _ |