• KarimAllah Ahmed's avatar
    KVM: Introduce a new guest mapping API · e45adf66
    KarimAllah Ahmed authored
    In KVM, specially for nested guests, there is a dominant pattern of:
    
    	=> map guest memory -> do_something -> unmap guest memory
    
    In addition to all this unnecessarily noise in the code due to boiler plate
    code, most of the time the mapping function does not properly handle memory
    that is not backed by "struct page". This new guest mapping API encapsulate
    most of this boiler plate code and also handles guest memory that is not
    backed by "struct page".
    
    The current implementation of this API is using memremap for memory that is
    not backed by a "struct page" which would lead to a huge slow-down if it
    was used for high-frequency mapping operations. The API does not have any
    effect on current setups where guest memory is backed by a "struct page".
    Further patches are going to also introduce a pfn-cache which would
    significantly improve the performance of the memremap case.
    Signed-off-by: default avatarKarimAllah Ahmed <karahmed@amazon.de>
    Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    e45adf66
kvm_main.c 101 KB