]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
KVM: selftests: Add an option to disable MANUAL_PROTECT_ENABLE and INITIALLY_SET
authorDavid Matlack <dmatlack@google.com>
Wed, 19 Jan 2022 23:07:39 +0000 (23:07 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 10 Feb 2022 18:50:44 +0000 (13:50 -0500)
Add an option to dirty_log_perf_test.c to disable
KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE and KVM_DIRTY_LOG_INITIALLY_SET so
the legacy dirty logging code path can be tested.

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20220119230739.2234394-19-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/dirty_log_perf_test.c

index 1954b964d1cf1d95efd067c9f8adc11c445f2d6c..101759ac93a487acce8383fb03c145b132baf3b5 100644 (file)
@@ -298,12 +298,18 @@ static void run_test(enum vm_guest_mode mode, void *arg)
 static void help(char *name)
 {
        puts("");
-       printf("usage: %s [-h] [-i iterations] [-p offset] "
+       printf("usage: %s [-h] [-i iterations] [-p offset] [-g]"
               "[-m mode] [-b vcpu bytes] [-v vcpus] [-o] [-s mem type]"
               "[-x memslots]\n", name);
        puts("");
        printf(" -i: specify iteration counts (default: %"PRIu64")\n",
               TEST_HOST_LOOP_N);
+       printf(" -g: Do not enable KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2. This\n"
+              "     makes KVM_GET_DIRTY_LOG clear the dirty log (i.e.\n"
+              "     KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE is not enabled)\n"
+              "     and writes will be tracked as soon as dirty logging is\n"
+              "     enabled on the memslot (i.e. KVM_DIRTY_LOG_INITIALLY_SET\n"
+              "     is not enabled).\n");
        printf(" -p: specify guest physical test memory offset\n"
               "     Warning: a low offset can conflict with the loaded test code.\n");
        guest_modes_help();
@@ -343,8 +349,11 @@ int main(int argc, char *argv[])
 
        guest_modes_append_default();
 
-       while ((opt = getopt(argc, argv, "hi:p:m:b:f:v:os:x:")) != -1) {
+       while ((opt = getopt(argc, argv, "ghi:p:m:b:f:v:os:x:")) != -1) {
                switch (opt) {
+               case 'g':
+                       dirty_log_manual_caps = 0;
+                       break;
                case 'i':
                        p.iterations = atoi(optarg);
                        break;