• Axel Rasmussen's avatar
    KVM: selftests: create alias mappings when using shared memory · 94f3f2b3
    Axel Rasmussen authored
    When a memory region is added with a src_type specifying that it should
    use some kind of shared memory, also create an alias mapping to the same
    underlying physical pages.
    
    And, add an API so tests can get access to these alias addresses.
    Basically, for a guest physical address, let us look up the analogous
    host *alias* address.
    
    In a future commit, we'll modify the demand paging test to take
    advantage of this to exercise UFFD minor faults. The idea is, we
    pre-fault the underlying pages *via the alias*. When the *guest*
    faults, it gets a "minor" fault (PTEs don't exist yet, but a page is
    already in the page cache). Then, the userfaultfd theads can handle the
    fault: they could potentially modify the underlying memory *via the
    alias* if they wanted to, and then they install the PTEs and let the
    guest carry on via a UFFDIO_CONTINUE ioctl.
    Reviewed-by: default avatarBen Gardon <bgardon@google.com>
    Signed-off-by: default avatarAxel Rasmussen <axelrasmussen@google.com>
    Message-Id: <20210519200339.829146-9-axelrasmussen@google.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    94f3f2b3
kvm_util_internal.h 2.66 KB