• Gavin Shan's avatar
    KVM: selftests: memslot_perf_test: Support variable guest page size · 8675c6f2
    Gavin Shan authored
    The test case is obviously broken on aarch64 because non-4KB guest
    page size is supported. The guest page size on aarch64 could be 4KB,
    16KB or 64KB.
    
    This supports variable guest page size, mostly for aarch64.
    
      - The host determines the guest page size when virtual machine is
        created. The value is also passed to guest through the synchronization
        area.
    
      - The number of guest pages are unknown until the virtual machine
        is to be created. So all the related macros are dropped. Instead,
        their values are dynamically calculated based on the guest page
        size.
    
      - The static checks on memory sizes and pages becomes dependent
        on guest page size, which is unknown until the virtual machine
        is about to be created. So all the static checks are converted
        to dynamic checks, done in check_memory_sizes().
    
      - As the address passed to madvise() should be aligned to host page,
        the size of page chunk is automatically selected, other than one
        page.
    
      - MEM_TEST_MOVE_SIZE has fixed and non-working 64KB. It will be
        consolidated in next patch. However, the comments about how
        it's calculated has been correct.
    
      - All other changes included in this patch are almost mechanical
        replacing '4096' with 'guest_page_size'.
    Signed-off-by: default avatarGavin Shan <gshan@redhat.com>
    Reviewed-by: default avatarMaciej S. Szmigiero <maciej.szmigiero@oracle.com>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221020071209.559062-5-gshan@redhat.com
    8675c6f2
memslot_perf_test.c 28.3 KB