• Joerg Roedel's avatar
    mm: add functions to track page directory modifications · d8626138
    Joerg Roedel authored
    Patch series "mm: Get rid of vmalloc_sync_(un)mappings()", v3.
    
    After the recent issue with vmalloc and tracing code[1] on x86 and a
    long history of previous issues related to the vmalloc_sync_mappings()
    interface, I thought the time has come to remove it.  Please see [2],
    [3], and [4] for some other issues in the past.
    
    The patches add tracking of page-table directory changes to the vmalloc
    and ioremap code.  Depending on which page-table levels changes have
    been made, a new per-arch function is called:
    arch_sync_kernel_mappings().
    
    On x86-64 with 4-level paging, this function will not be called more
    than 64 times in a systems runtime (because vmalloc-space takes 64 PGD
    entries which are only populated, but never cleared).
    
    As a side effect this also allows to get rid of vmalloc faults on x86,
    making it safe to touch vmalloc'ed memory in the page-fault handler.
    Note that this potentially includes per-cpu memory.
    
    This patch (of 7):
    
    Add page-table allocation functions which will keep track of changed
    directory entries.  They are needed for new PGD, P4D, PUD, and PMD
    entries and will be used in vmalloc and ioremap code to decide whether
    any changes in the kernel mappings need to be synchronized between
    page-tables in the system.
    Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
    Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: "H . Peter Anvin" <hpa@zytor.com>
    Cc: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Christoph Hellwig <hch@lst.de>
    Link: http://lkml.kernel.org/r/20200515140023.25469-1-joro@8bytes.org
    Link: http://lkml.kernel.org/r/20200515140023.25469-2-joro@8bytes.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    d8626138
pgtable.h 34.4 KB