• Gavin Shan's avatar
    KVM: selftests: Automate choosing dirty ring size in dirty_log_test · dc6df7d4
    Gavin Shan authored
    In the dirty ring case, we rely on vcpu exit due to full dirty ring
    state. On ARM64 system, there are 4096 host pages when the host
    page size is 64KB. In this case, the vcpu never exits due to the
    full dirty ring state. The similar case is 4KB page size on host
    and 64KB page size on guest. The vcpu corrupts same set of host
    pages, but the dirty page information isn't collected in the main
    thread. This leads to infinite loop as the following log shows.
    
      # ./dirty_log_test -M dirty-ring -c 65536 -m 5
      Setting log mode to: 'dirty-ring'
      Test iterations: 32, interval: 10 (ms)
      Testing guest mode: PA-bits:40,  VA-bits:48,  4K pages
      guest physical test memory offset: 0xffbffe0000
      vcpu stops because vcpu is kicked out...
      Notifying vcpu to continue
      vcpu continues now.
      Iteration 1 collected 576 pages
      <No more output afterwards>
    
    Fix the issue by automatically choosing the best dirty ring size,
    to ensure vcpu exit due to full dirty ring state. The option '-c'
    becomes a hint to the dirty ring count, instead of the value of it.
    Signed-off-by: default avatarGavin Shan <gshan@redhat.com>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20221110104914.31280-8-gshan@redhat.com
    dc6df7d4
dirty_log_test.c 26.6 KB