• Alistair Popple's avatar
    mm: device exclusive memory access · b756a3b5
    Alistair Popple authored
    Some devices require exclusive write access to shared virtual memory (SVM)
    ranges to perform atomic operations on that memory.  This requires CPU
    page tables to be updated to deny access whilst atomic operations are
    occurring.
    
    In order to do this introduce a new swap entry type
    (SWP_DEVICE_EXCLUSIVE).  When a SVM range needs to be marked for exclusive
    access by a device all page table mappings for the particular range are
    replaced with device exclusive swap entries.  This causes any CPU access
    to the page to result in a fault.
    
    Faults are resovled by replacing the faulting entry with the original
    mapping.  This results in MMU notifiers being called which a driver uses
    to update access permissions such as revoking atomic access.  After
    notifiers have been called the device will no longer have exclusive access
    to the region.
    
    Walking of the page tables to find the target pages is handled by
    get_user_pages() rather than a direct page table walk.  A direct page
    table walk s...
    b756a3b5
page_vma_mapped.c 8.74 KB