• Ben Gardon's avatar
    KVM: x86/mmu: Ensure forward progress when yielding in TDP MMU iter · ed5e484b
    Ben Gardon authored
    In some functions the TDP iter risks not making forward progress if two
    threads livelock yielding to one another. This is possible if two threads
    are trying to execute wrprot_gfn_range. Each could write protect an entry
    and then yield. This would reset the tdp_iter's walk over the paging
    structure and the loop would end up repeating the same entry over and
    over, preventing either thread from making forward progress.
    
    Fix this issue by only yielding if the loop has made forward progress
    since the last yield.
    
    Fixes: a6a0b05d ("kvm: x86/mmu: Support dirty logging for the TDP MMU")
    Reviewed-by: default avatarPeter Feiner <pfeiner@google.com>
    Signed-off-by: default avatarBen Gardon <bgardon@google.com>
    
    Message-Id: <20210202185734.1680553-14-bgardon@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    ed5e484b
tdp_iter.h 1.93 KB