• Steve Capper's avatar
    arm64: hugetlb: Add break-before-make logic for contiguous entries · d8bdcff2
    Steve Capper authored
    It has become apparent that one has to take special care when modifying
    attributes of memory mappings that employ the contiguous bit.
    
    Both the requirement and the architecturally correct "Break-Before-Make"
    technique of updating contiguous entries can be found described in:
    ARM DDI 0487A.k_iss10775, "Misprogramming of the Contiguous bit",
    page D4-1762.
    
    The huge pte accessors currently replace the attributes of contiguous
    pte entries in place thus can, on certain platforms, lead to TLB
    conflict aborts or even erroneous results returned from TLB lookups.
    
    This patch adds two helper functions -
    
    * get_clear_flush(.) - clears a contiguous entry and returns the head
      pte (whilst taking care to retain dirty bit information that could
      have been modified by DBM).
    
    * clear_flush(.) that clears a contiguous entry
    
    A tlb invalidate is performed to then ensure that there is no
    possibility of multiple tlb entries being present for the same region.
    
    Cc: David Woods <dwoods@mellanox.com>
    Signed-off-by: default avatarSteve Capper <steve.capper@arm.com>
    (Added helper clear_flush(), updated commit log, and some cleanup)
    Signed-off-by: default avatarPunit Agrawal <punit.agrawal@arm.com>
    [catalin.marinas@arm.com: remove CONFIG_ARM64_HW_AFDBM check]
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    d8bdcff2
hugetlbpage.c 8.75 KB