OSDN Git Service

KVM: selftests: Automate choosing dirty ring size in dirty_log_test
authorGavin Shan <gshan@redhat.com>
Thu, 10 Nov 2022 10:49:14 +0000 (18:49 +0800)
committerMarc Zyngier <maz@kernel.org>
Thu, 10 Nov 2022 13:11:58 +0000 (13:11 +0000)
commitdc6df7d4d0633e65850d5372ae9f1234bcc6e26e
tree6e448a68d3ffa8e3c5294c29f882440c3c577b33
parent7167190ddb863bd061c0c6b61f4cec94184b40da
KVM: selftests: Automate choosing dirty ring size in dirty_log_test

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: Gavin Shan <gshan@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221110104914.31280-8-gshan@redhat.com
tools/testing/selftests/kvm/dirty_log_test.c