From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6DD4C48BDF for ; Thu, 10 Jun 2021 19:03:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F8FB613B0 for ; Thu, 10 Jun 2021 19:03:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F8FB613B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:42142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrPxO-0006Hw-PU for qemu-devel@archiver.kernel.org; Thu, 10 Jun 2021 15:03:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrPwC-0005WY-Jo for qemu-devel@nongnu.org; Thu, 10 Jun 2021 15:01:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrPw7-0000zV-DB for qemu-devel@nongnu.org; Thu, 10 Jun 2021 15:01:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623351710; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=WEvcwHiG8cOZtExq0ZvLf0NGyDbJXeMV7K3JQ7WQEio=; b=eGUxytOiL8+kq8ZZxojcJeDruB9CLqIZJHFRDIArGEQsHCbIMQ6NkRz7iZWYNJFWzV6yDJ M21Xx5p5wXmBuTi6NVdewTtTRyoWZGawNbbFzfucTGHYez0yrqDARW7sKsKnQcbHpwkyHw izIBCjZ+T46l8smOQP6bVbFYvBmIBfo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-cjsaPEPYOgqXK-CRVii68g-1; Thu, 10 Jun 2021 15:01:48 -0400 X-MC-Unique: cjsaPEPYOgqXK-CRVii68g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CBD563C79 for ; Thu, 10 Jun 2021 19:01:48 +0000 (UTC) Received: from work-vm (ovpn-114-240.ams2.redhat.com [10.36.114.240]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CB2015D9E2; Thu, 10 Jun 2021 19:01:46 +0000 (UTC) Date: Thu, 10 Jun 2021 20:01:44 +0100 From: "Dr. David Alan Gilbert" To: Peter Xu Subject: Re: [PATCH 2/2] tests: migration-test: Add dirty ring test Message-ID: References: <20210610005239.265588-1-peterx@redhat.com> <20210610005239.265588-3-peterx@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210610005239.265588-3-peterx@redhat.com> User-Agent: Mutt/2.0.7 (2021-05-04) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Leonardo Bras Soares Passos , qemu-devel@nongnu.org, Juan Quintela Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" * Peter Xu (peterx@redhat.com) wrote: > Add dirty ring test if kernel supports it. Add the dirty ring parameter on > source should be mostly enough, but let's change the dest too to make them > match always. > > Signed-off-by: Peter Xu > --- > tests/qtest/migration-test.c | 51 +++++++++++++++++++++++++++++++++--- > 1 file changed, 48 insertions(+), 3 deletions(-) > > diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c > index d9225f58d4d..cc6e396d1a2 100644 > --- a/tests/qtest/migration-test.c > +++ b/tests/qtest/migration-test.c > @@ -12,6 +12,7 @@ > > #include "qemu/osdep.h" > > +#include Does that get you the system headers, which may or may not have KVM_CAP_DIRTY_LOG_RING if you're on an old host, or does it get you qemu's linux-headers which definitely does? What happens on a BSD or the like? Dave > #include "libqos/libqtest.h" > #include "qapi/error.h" > #include "qapi/qmp/qdict.h" > @@ -467,6 +468,8 @@ typedef struct { > bool use_shmem; > /* only launch the target process */ > bool only_target; > + /* Use dirty ring if true; dirty logging otherwise */ > + bool use_dirty_ring; > char *opts_source; > char *opts_target; > } MigrateStart; > @@ -573,11 +576,13 @@ static int test_migrate_start(QTestState **from, QTestState **to, > shmem_opts = g_strdup(""); > } > > - cmd_source = g_strdup_printf("-accel kvm -accel tcg%s%s " > + cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s " > "-name source,debug-threads=on " > "-m %s " > "-serial file:%s/src_serial " > "%s %s %s %s", > + args->use_dirty_ring ? > + ",dirty-ring-size=4096" : "", > machine_opts ? " -machine " : "", > machine_opts ? machine_opts : "", > memory_size, tmpfs, > @@ -587,12 +592,14 @@ static int test_migrate_start(QTestState **from, QTestState **to, > *from = qtest_init(cmd_source); > } > > - cmd_target = g_strdup_printf("-accel kvm -accel tcg%s%s " > + cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s " > "-name target,debug-threads=on " > "-m %s " > "-serial file:%s/dest_serial " > "-incoming %s " > "%s %s %s %s", > + args->use_dirty_ring ? > + ",dirty-ring-size=4096" : "", > machine_opts ? " -machine " : "", > machine_opts ? machine_opts : "", > memory_size, tmpfs, uri, > @@ -785,12 +792,14 @@ static void test_baddest(void) > test_migrate_end(from, to, false); > } > > -static void test_precopy_unix(void) > +static void test_precopy_unix_common(bool dirty_ring) > { > g_autofree char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); > MigrateStart *args = migrate_start_new(); > QTestState *from, *to; > > + args->use_dirty_ring = dirty_ring; > + > if (test_migrate_start(&from, &to, uri, args)) { > return; > } > @@ -825,6 +834,18 @@ static void test_precopy_unix(void) > test_migrate_end(from, to, true); > } > > +static void test_precopy_unix(void) > +{ > + /* Using default dirty logging */ > + test_precopy_unix_common(false); > +} > + > +static void test_precopy_unix_dirty_ring(void) > +{ > + /* Using dirty ring tracking */ > + test_precopy_unix_common(true); > +} > + > #if 0 > /* Currently upset on aarch64 TCG */ > static void test_ignore_shared(void) > @@ -1369,6 +1390,25 @@ static void test_multifd_tcp_cancel(void) > test_migrate_end(from, to2, true); > } > > +static bool kvm_dirty_ring_supported(void) > +{ > + int ret, kvm_fd = open("/dev/kvm", O_RDONLY); > + > + if (kvm_fd < 0) { > + return false; > + } > + > + ret = ioctl(kvm_fd, KVM_CHECK_EXTENSION, KVM_CAP_DIRTY_LOG_RING); > + close(kvm_fd); > + > + /* We test with 4096 slots */ > + if (ret < 4096) { > + return false; > + } > + > + return true; > +} > + > int main(int argc, char **argv) > { > char template[] = "/tmp/migration-test-XXXXXX"; > @@ -1438,6 +1478,11 @@ int main(int argc, char **argv) > qtest_add_func("/migration/multifd/tcp/zstd", test_multifd_tcp_zstd); > #endif > > + if (kvm_dirty_ring_supported()) { > + qtest_add_func("/migration/dirty_ring", > + test_precopy_unix_dirty_ring); > + } > + > ret = g_test_run(); > > g_assert_cmpint(ret, ==, 0); > -- > 2.31.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK