From nobody Mon Nov 25 04:43:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1718889815; cv=none; d=zohomail.com; s=zohoarc; b=jsgSbOEk1iHDazcaZNuq14mSv1qnaEL+PrxP1+4VdRNM3RDGhV5vWJ3p0zpXNxKLdCWREak5wH0odVi2go0pobwa9xN+B2sZTp1f4x6L2XJKlWZCn5dyTEHmlFk9Vde8kSYkwIbVHgXWDZ4M6/4ogBb7Up/0ovekYy/20WFN+E8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1718889815; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DlQ1ZdaEW72AEw0w5wQIhPrBk0uOxMIbgXV2X0N47o0=; b=JbYwxopMC+mBGxg0MGYVWQ0C0L12QlcR6SllyH3bxNEvRSi7XNaO8deuY3Z5bULccSN6dytsPJbzeqMvPqs0OCgeyhGXp8gOvtoy0WF3A3jhMcdsr3K1i3lG6lkbJbN8VNQ1JDvhYbGfidK1WkLzs0aQpHJXC0dlpGujfYMH1Xw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1718889815350645.9641012537923; Thu, 20 Jun 2024 06:23:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKHkz-0004iE-N4; Thu, 20 Jun 2024 09:23:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKEOE-0000rL-VZ for qemu-devel@nongnu.org; Thu, 20 Jun 2024 05:47:34 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKEOC-000438-Nw for qemu-devel@nongnu.org; Thu, 20 Jun 2024 05:47:34 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1f9b52ef481so6069215ad.1 for ; Thu, 20 Jun 2024 02:47:32 -0700 (PDT) Received: from localhost.localdomain (KD175132079186.ppp-bb.dion.ne.jp. [175.132.79.186]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f993deb126sm49350585ad.219.2024.06.20.02.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 02:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718876851; x=1719481651; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DlQ1ZdaEW72AEw0w5wQIhPrBk0uOxMIbgXV2X0N47o0=; b=U/B3zb4h/hWUrhcwCiQFgjVd6+6/k02Y/fNKhqkyQX7iwrHeClSIgqayYUg8Tq0r94 /ulnAxTM5hyVYMD579o34W+G7c26zmzSvM/qmKR1YfsxG7O7pUJBg+Sc3rboBPiFMbSj 95K1kWOl+4WOXSYQMimEBEOzrBORqHCIiH2448+Cuf5/F5xuBP/t0dEOyyOI2PpL8AlW 8uGsmRsRJOaLJetSfjFUEcI2M7DkapR93S+ugjOOV7UJ3uSTY4abVWDf+BX4/ycXG1BV CrHbAmhjs8Ruz7yKB6Yu577/0ZQTabAy2/HkMVeNd2Wh4ARHQseoz8ayztD5oB1lAAxy pt3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718876851; x=1719481651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DlQ1ZdaEW72AEw0w5wQIhPrBk0uOxMIbgXV2X0N47o0=; b=nYDSdmDVEghwwcV7xr1baOv36BX4c6sMVPzYj7rlyep6n98c5UYnyAMRCwyQdRzY43 vOQzZiOw8T1b2ngxho7m9LBdeASsyvjixWKiiEKvBr1Y6hSG6znZdvUJ4LuYYdGDpEm4 ba+KpzPQppQYhTaDrJ3wzTHiO3inYql5Cr5eBZ/4Gn0lVHeXyonYag06aKw3RAAmbd6u tsmJwyFAOKV41IohCRUL6bY8dbyTDcVeoxGjPSi7wMOiNoE4GZ4Wj5xTj+8L0ls3V2AY 2EkSrIx2QA56KPmsSLRz1TJ0+4yqnjAr3OIREEYnZOkgC1CR2ZCjbgGbL4iuJkbwbXa0 xXMA== X-Gm-Message-State: AOJu0YyYVwx8RdJYI4d5xF0ymWIHkO+/a3tBw87pMLAD9FbzzN26ZXNU RE9RG2aXDUFzHHf6hICNlMoSrIq3kEDxQzieosqaZWlEnDjNZ/9Hhq1Bzkys7cI= X-Google-Smtp-Source: AGHT+IEttX9isHcwr7XQP9hkNHC6eZObyiRC6Fn4sW8L43Xb+GxiNK+81yeWaLHgAirxUZmaW8ICcA== X-Received: by 2002:a17:902:e5ca:b0:1f6:a606:539e with SMTP id d9443c01a7336-1f9aa471fefmr51850235ad.61.1718876850953; Thu, 20 Jun 2024 02:47:30 -0700 (PDT) From: Shota Imamura To: qemu-devel@nongnu.org Cc: Shota Imamura , Peter Xu , Fabiano Rosas , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PATCH 2/2] qtest/migration: Add dirty ring tests Date: Thu, 20 Jun 2024 18:47:14 +0900 Message-Id: <20240620094714.871727-3-cosocaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240620094714.871727-1-cosocaf@gmail.com> References: <20240620094714.871727-1-cosocaf@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=cosocaf@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 20 Jun 2024 09:23:11 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1718889815659100001 Content-Type: text/plain; charset="utf-8" This commit adds tests for migration using the dirty ring. To avoid confusion with KVM's dirty ring, use_dirty_ring has been changed to use_kvm_dirty_ring, and use_qemu_dirty_ring has been added. Signed-off-by: Shota Imamura --- tests/qtest/migration-test.c | 78 ++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0dccb4beff..a8151b9470 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -556,7 +556,8 @@ typedef struct { /* only launch the target process */ bool only_target; /* Use dirty ring if true; dirty logging otherwise */ - bool use_dirty_ring; + bool use_kvm_dirty_ring; + bool use_qemu_dirty_ring; const char *opts_source; const char *opts_target; /* suspend the src before migrating to dest. */ @@ -675,6 +676,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; + const char *migration_ops =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; const char *machine_alias, *machine_opts =3D ""; @@ -754,10 +756,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size, shmem_path); } =20 - if (args->use_dirty_ring) { + if (args->use_kvm_dirty_ring) { kvm_opts =3D ",dirty-ring-size=3D4096"; } =20 + if (args->use_qemu_dirty_ring) { + migration_ops =3D "dirty-logging=3Dring,dirty-ring-size=3D32768"; + } else { + migration_ops =3D "dirty-logging=3Dbitmap"; + } + if (!qtest_has_machine(machine_alias)) { g_autofree char *msg =3D g_strdup_printf("machine %s not supported= ", machine_alias); g_test_skip(msg); @@ -774,10 +782,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " + "-migration %s " "%s %s %s %s %s", kvm_opts ? kvm_opts : "", machine, machine_opts, memory_size, tmpfs, + migration_ops, arch_opts ? arch_opts : "", arch_source ? arch_source : "", shmem_opts ? shmem_opts : "", @@ -1796,12 +1806,27 @@ static void test_precopy_unix_suspend_notlive(void) test_precopy_common(&args); } =20 -static void test_precopy_unix_dirty_ring(void) +static void test_precopy_unix_qemu_dirty_ring(void) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); MigrateCommon args =3D { .start =3D { - .use_dirty_ring =3D true, + .use_qemu_dirty_ring =3D true, + }, + .listen_uri =3D uri, + .connect_uri =3D uri, + .live =3D true, + }; + + test_precopy_common(&args); +} + +static void test_precopy_unix_kvm_dirty_ring(void) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .start =3D { + .use_kvm_dirty_ring =3D true, }, .listen_uri =3D uri, .connect_uri =3D uri, @@ -1815,6 +1840,22 @@ static void test_precopy_unix_dirty_ring(void) test_precopy_common(&args); } =20 +static void test_precopy_unix_kvm_and_qemu_dirty_ring(void) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateCommon args =3D { + .start =3D { + .use_kvm_dirty_ring =3D true, + .use_qemu_dirty_ring =3D true, + }, + .listen_uri =3D uri, + .connect_uri =3D uri, + .live =3D true, + }; + + test_precopy_common(&args); +} + #ifdef CONFIG_GNUTLS static void test_precopy_unix_tls_psk(void) { @@ -1942,6 +1983,21 @@ static void test_precopy_file(void) test_file_common(&args, true); } =20 +static void test_precopy_file_dirty_ring(void) +{ + g_autofree char *uri =3D g_strdup_printf("file:%s/%s", tmpfs, + FILE_TEST_FILENAME); + MigrateCommon args =3D { + .start =3D { + .use_qemu_dirty_ring =3D true, + }, + .connect_uri =3D uri, + .listen_uri =3D "defer", + }; + + test_file_common(&args, true); +} + static void file_offset_finish_hook(QTestState *from, QTestState *to, void *opaque) { @@ -3298,7 +3354,7 @@ static void test_migrate_dirty_limit(void) MigrateCommon args =3D { .start =3D { .hide_stderr =3D true, - .use_dirty_ring =3D true, + .use_kvm_dirty_ring =3D true, }, .listen_uri =3D uri, .connect_uri =3D uri, @@ -3342,7 +3398,7 @@ static void test_migrate_dirty_limit(void) args =3D (MigrateCommon) { .start =3D { .only_target =3D true, - .use_dirty_ring =3D true, + .use_kvm_dirty_ring =3D true, }, .listen_uri =3D uri, .connect_uri =3D uri, @@ -3504,10 +3560,14 @@ int main(int argc, char **argv) =20 migration_test_add("/migration/precopy/unix/plain", test_precopy_unix_plain); + migration_test_add("/migration/precopy/unix/dirty_ring", + test_precopy_unix_qemu_dirty_ring); migration_test_add("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle); migration_test_add("/migration/precopy/file", test_precopy_file); + migration_test_add("/migration/precopy/file/dirty_ring", + test_precopy_file_dirty_ring); migration_test_add("/migration/precopy/file/offset", test_precopy_file_offset); migration_test_add("/migration/precopy/file/offset/bad", @@ -3660,8 +3720,10 @@ int main(int argc, char **argv) #endif /* CONFIG_GNUTLS */ =20 if (g_str_equal(arch, "x86_64") && has_kvm && kvm_dirty_ring_supported= ()) { - migration_test_add("/migration/dirty_ring", - test_precopy_unix_dirty_ring); + migration_test_add("/migration/precopy/unix/kvm_dirty_ring", + test_precopy_unix_kvm_dirty_ring); + migration_test_add("/migration/precopy/unix/kvm_and_qemu_dirty_rin= g", + test_precopy_unix_kvm_and_qemu_dirty_ring); migration_test_add("/migration/vcpu_dirty_limit", test_vcpu_dirty_limit); } --=20 2.34.1