• Gerald Schaefer's avatar
    s390/mm: add support for RDP (Reset DAT-Protection) · 0807b856
    Gerald Schaefer authored
    RDP instruction allows to reset DAT-protection bit in a PTE, with less
    CPU synchronization overhead than IPTE instruction. In particular, IPTE
    can cause machine-wide synchronization overhead, and excessive IPTE usage
    can negatively impact machine performance.
    
    RDP can be used instead of IPTE, if the new PTE only differs in SW bits
    and _PAGE_PROTECT HW bit, for PTE protection changes from RO to RW.
    SW PTE bit changes are allowed, e.g. for dirty and young tracking, but none
    of the other HW-defined part of the PTE must change. This is because the
    architecture forbids such changes to an active and valid PTE, which
    is why invalidation with IPTE is always used first, before writing a new
    entry.
    
    The RDP optimization helps mainly for fault-driven SW dirty-bit tracking.
    Writable PTEs are initially always mapped with HW _PAGE_PROTECT bit set,
    to allow SW dirty-bit accounting on first write protection fault, where
    the DAT-protection would then be reset. The reset is now done with RDP
    instead of IPTE, if RDP instruction is available.
    
    RDP cannot always guarantee that the DAT-protection reset is propagated
    to all CPUs immediately. This means that spurious TLB protection faults
    on other CPUs can now occur. For this, common code provides a
    flush_tlb_fix_spurious_fault() handler, which will now be used to do a
    CPU-local TLB flush. However, this will clear the whole TLB of a CPU, and
    not just the affected entry. For more fine-grained flushing, by simply
    doing a (local) RDP again, flush_tlb_fix_spurious_fault() would need to
    also provide the PTE pointer.
    
    Note that spurious TLB protection faults cannot really be distinguished
    from racing pagetable updates, where another thread already installed the
    correct PTE. In such a case, the local TLB flush would be unnecessary
    overhead, but overall reduction of CPU synchronization overhead by not
    using IPTE is still expected to be beneficial.
    Reviewed-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
    Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@linux.ibm.com>
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    0807b856
pgtable.c 30.9 KB