From nobody Thu May 16 09:17:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690565012004780.8860927922764; Fri, 28 Jul 2023 10:23:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR5a-0007xA-0V; Fri, 28 Jul 2023 13:17:18 -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 1qPR5Y-0007wO-4i for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:16 -0400 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR5V-0004n8-DO for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:15 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id BF0C511EF23; Fri, 28 Jul 2023 17:17:11 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~hyman Date: Thu, 08 Jun 2023 00:46:45 +0800 Subject: [PATCH QEMU 1/3] tests: Add migration dirty-limit capability test MIME-Version: 1.0 Message-ID: <169056463135.22823.13693920045521586976-1@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <169056463135.22823.13693920045521586976-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Thomas Huth , Laurent Vivier , Paolo Bonzini Content-Type: text/plain; charset="utf-8" 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=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Reply-To: ~hyman Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1690565014802100007 From: Hyman Huang(=E9=BB=84=E5=8B=87) Add migration dirty-limit capability test if kernel support dirty ring. Migration dirty-limit capability introduce dirty limit capability, two parameters: x-vcpu-dirty-limit-period and vcpu-dirty-limit are introduced to implement the live migration with dirty limit. The test case does the following things: 1. start src, dst vm and enable dirty-limit capability 2. start migrate and set cancel it to check if dirty limit stop working. 3. restart dst vm 4. start migrate and enable dirty-limit capability 5. check if migration satisfy the convergence condition during pre-switchover phase. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- tests/qtest/migration-test.c | 155 +++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 62d3f37021..52b1973afb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2739,6 +2739,159 @@ static void test_vcpu_dirty_limit(void) dirtylimit_stop_vm(vm); } =20 +static void migrate_dirty_limit_wait_showup(QTestState *from, + const int64_t period, + const int64_t value) +{ + /* Enable dirty limit capability */ + migrate_set_capability(from, "dirty-limit", true); + + /* Set dirty limit parameters */ + migrate_set_parameter_int(from, "x-vcpu-dirty-limit-period", period); + migrate_set_parameter_int(from, "vcpu-dirty-limit", value); + + /* Make sure migrate can't converge */ + migrate_ensure_non_converge(from); + + /* To check limit rate after precopy */ + migrate_set_capability(from, "pause-before-switchover", true); + + /* Wait for the serial output from the source */ + wait_for_serial("src_serial"); +} + +/* + * This test does: + * source target + * migrate_incoming + * migrate + * migrate_cancel + * restart target + * migrate + * + * And see that if dirty limit works correctly + */ +static void test_migrate_dirty_limit(void) +{ + g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + QTestState *from, *to; + int64_t remaining; + uint64_t throttle_us_per_full; + /* + * We want the test to be stable and as fast as possible. + * E.g., with 1Gb/s bandwith migration may pass without dirty limit, + * so we need to decrease a bandwidth. + */ + const int64_t dirtylimit_period =3D 1000, dirtylimit_value =3D 50; + const int64_t max_bandwidth =3D 400000000; /* ~400Mb/s */ + const int64_t downtime_limit =3D 250; /* 250ms */ + /* + * We migrate through unix-socket (> 500Mb/s). + * Thus, expected migration speed ~=3D bandwidth limit (< 500Mb/s). + * So, we can predict expected_threshold + */ + const int64_t expected_threshold =3D max_bandwidth * downtime_limit / = 1000; + int max_try_count =3D 10; + MigrateCommon args =3D { + .start =3D { + .hide_stderr =3D true, + .use_dirty_ring =3D true, + }, + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + /* Start src, dst vm */ + if (test_migrate_start(&from, &to, args.listen_uri, &args.start)) { + return; + } + + /* Prepare for dirty limit migration and wait src vm show up */ + migrate_dirty_limit_wait_showup(from, dirtylimit_period, dirtylimit_va= lue); + + /* Start migrate */ + migrate_qmp(from, uri, "{}"); + + /* Wait for dirty limit throttle begin */ + throttle_us_per_full =3D 0; + while (throttle_us_per_full =3D=3D 0) { + throttle_us_per_full =3D + read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + usleep(100); + g_assert_false(got_src_stop); + } + + /* Now cancel migrate and wait for dirty limit throttle switch off */ + migrate_cancel(from); + wait_for_migration_status(from, "cancelled", NULL); + + /* Check if dirty limit throttle switched off, set timeout 1ms */ + do { + throttle_us_per_full =3D + read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + usleep(100); + g_assert_false(got_src_stop); + } while (throttle_us_per_full !=3D 0 && --max_try_count); + + /* Assert dirty limit is not in service */ + g_assert_cmpint(throttle_us_per_full, =3D=3D, 0); + + args =3D (MigrateCommon) { + .start =3D { + .only_target =3D true, + .use_dirty_ring =3D true, + }, + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + /* Restart dst vm, src vm already show up so we needn't wait anymore */ + if (test_migrate_start(&from, &to, args.listen_uri, &args.start)) { + return; + } + + /* Start migrate */ + migrate_qmp(from, uri, "{}"); + + /* Wait for dirty limit throttle begin */ + throttle_us_per_full =3D 0; + while (throttle_us_per_full =3D=3D 0) { + throttle_us_per_full =3D + read_migrate_property_int(from, "dirty-limit-throttle-time-per-rou= nd"); + usleep(100); + g_assert_false(got_src_stop); + } + + /* + * The dirty limit rate should equals the return value of + * query-vcpu-dirty-limit if dirty limit cap set + */ + g_assert_cmpint(dirtylimit_value, =3D=3D, get_limit_rate(from)); + + /* Now, we have tested if dirty limit works, let it converge */ + migrate_set_parameter_int(from, "downtime-limit", downtime_limit); + migrate_set_parameter_int(from, "max-bandwidth", max_bandwidth); + + /* + * Wait for pre-switchover status to check if migration + * satisfy the convergence condition + */ + wait_for_migration_status(from, "pre-switchover", NULL); + + remaining =3D read_ram_property_int(from, "remaining"); + g_assert_cmpint(remaining, <, + (expected_threshold + expected_threshold / 100)); + + migrate_continue(from, "pre-switchover"); + + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + + test_migrate_end(from, to, true); +} + static bool kvm_dirty_ring_supported(void) { #if defined(__linux__) && defined(HOST_X86_64) @@ -2950,6 +3103,8 @@ int main(int argc, char **argv) test_precopy_unix_dirty_ring); qtest_add_func("/migration/vcpu_dirty_limit", test_vcpu_dirty_limit); + qtest_add_func("/migration/dirty_limit", + test_migrate_dirty_limit); } =20 ret =3D g_test_run(); --=20 2.38.5 From nobody Thu May 16 09:17:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690566884453897.5167311308404; Fri, 28 Jul 2023 10:54:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR5Z-0007wh-Fu; Fri, 28 Jul 2023 13:17: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 1qPR5X-0007w9-Cz for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:15 -0400 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR5V-0004nA-32 for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:14 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id E99B511EF7E; Fri, 28 Jul 2023 17:17:11 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~hyman Date: Thu, 27 Jul 2023 02:25:43 +0800 Subject: [PATCH QEMU 2/3] tests/migration: Introduce dirty-ring-size option into guestperf MIME-Version: 1.0 Message-ID: <169056463135.22823.13693920045521586976-2@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <169056463135.22823.13693920045521586976-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Thomas Huth , Laurent Vivier , Paolo Bonzini Content-Type: text/plain; charset="utf-8" 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=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Reply-To: ~hyman Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1690566885290100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Dirty ring size configuration is not supported by guestperf tool. Introduce dirty-ring-size (ranges in [1024, 65536]) option so developers can play with dirty-ring and dirty-limit feature easier. To set dirty ring size with 4096 during migration test: $ ./tests/migration/guestperf.py --dirty-ring-size 4096 xxx Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- tests/migration/guestperf/engine.py | 6 +++++- tests/migration/guestperf/hardware.py | 8 ++++++-- tests/migration/guestperf/shell.py | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestper= f/engine.py index e69d16a62c..29ebb5011b 100644 --- a/tests/migration/guestperf/engine.py +++ b/tests/migration/guestperf/engine.py @@ -325,7 +325,6 @@ class Engine(object): cmdline =3D "'" + cmdline + "'" =20 argv =3D [ - "-accel", "kvm", "-cpu", "host", "-kernel", self._kernel, "-initrd", self._initrd, @@ -333,6 +332,11 @@ class Engine(object): "-m", str((hardware._mem * 1024) + 512), "-smp", str(hardware._cpus), ] + if hardware._dirty_ring_size: + argv.extend(["-accel", "kvm,dirty-ring-size=3D%s" % + hardware._dirty_ring_size]) + else: + argv.extend(["-accel", "kvm"]) =20 argv.extend(self._get_qemu_serial_args()) =20 diff --git a/tests/migration/guestperf/hardware.py b/tests/migration/guestp= erf/hardware.py index 3145785ffd..f779cc050b 100644 --- a/tests/migration/guestperf/hardware.py +++ b/tests/migration/guestperf/hardware.py @@ -23,7 +23,8 @@ class Hardware(object): src_cpu_bind=3DNone, src_mem_bind=3DNone, dst_cpu_bind=3DNone, dst_mem_bind=3DNone, prealloc_pages =3D False, - huge_pages=3DFalse, locked_pages=3DFalse): + huge_pages=3DFalse, locked_pages=3DFalse, + dirty_ring_size=3D0): self._cpus =3D cpus self._mem =3D mem # GiB self._src_mem_bind =3D src_mem_bind # List of NUMA nodes @@ -33,6 +34,7 @@ class Hardware(object): self._prealloc_pages =3D prealloc_pages self._huge_pages =3D huge_pages self._locked_pages =3D locked_pages + self._dirty_ring_size =3D dirty_ring_size =20 =20 def serialize(self): @@ -46,6 +48,7 @@ class Hardware(object): "prealloc_pages": self._prealloc_pages, "huge_pages": self._huge_pages, "locked_pages": self._locked_pages, + "dirty_ring_size": self._dirty_ring_size, } =20 @classmethod @@ -59,4 +62,5 @@ class Hardware(object): data["dst_mem_bind"], data["prealloc_pages"], data["huge_pages"], - data["locked_pages"]) + data["locked_pages"], + data["dirty_ring_size"]) diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf= /shell.py index 8a809e3dda..7d6b8cd7cf 100644 --- a/tests/migration/guestperf/shell.py +++ b/tests/migration/guestperf/shell.py @@ -60,6 +60,8 @@ class BaseShell(object): parser.add_argument("--prealloc-pages", dest=3D"prealloc_pages", d= efault=3DFalse) parser.add_argument("--huge-pages", dest=3D"huge_pages", default= =3DFalse) parser.add_argument("--locked-pages", dest=3D"locked_pages", defau= lt=3DFalse) + parser.add_argument("--dirty-ring-size", dest=3D"dirty_ring_size", + default=3D0, type=3Dint) =20 self._parser =3D parser =20 @@ -89,7 +91,9 @@ class BaseShell(object): =20 locked_pages=3Dargs.locked_pages, huge_pages=3Dargs.huge_pages, - prealloc_pages=3Dargs.prealloc_pages) + prealloc_pages=3Dargs.prealloc_pages, + + dirty_ring_size=3Dargs.dirty_ring_size) =20 =20 class Shell(BaseShell): --=20 2.38.5 From nobody Thu May 16 09:17:51 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=fail(p=none dis=none) header.from=git.sr.ht Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690565297267568.1368463659508; Fri, 28 Jul 2023 10:28:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR5a-0007xB-Dt; Fri, 28 Jul 2023 13:17:18 -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 1qPR5Y-0007wP-5n for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:16 -0400 Received: from mail-b.sr.ht ([173.195.146.151]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR5V-0004nH-39 for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:17:15 -0400 Received: from git.sr.ht (unknown [173.195.146.142]) by mail-b.sr.ht (Postfix) with ESMTPSA id 1E58C11EF9B; Fri, 28 Jul 2023 17:17:12 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=none From: ~hyman Date: Thu, 27 Jul 2023 02:50:29 +0800 Subject: [PATCH QEMU 3/3] tests/migration: Introduce dirty-limit into guestperf MIME-Version: 1.0 Message-ID: <169056463135.22823.13693920045521586976-3@git.sr.ht> X-Mailer: git.sr.ht In-Reply-To: <169056463135.22823.13693920045521586976-0@git.sr.ht> To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras , Thomas Huth , Laurent Vivier , Paolo Bonzini Content-Type: text/plain; charset="utf-8" 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=173.195.146.151; envelope-from=outgoing@sr.ht; helo=mail-b.sr.ht X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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: , Reply-To: ~hyman Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1690565298036100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Currently, guestperf does not cover the dirty-limit migration, support this feature. Note that dirty-limit requires 'dirty-ring-size' set. To enable dirty-limit, setting x-vcpu-dirty-limit-period as 500ms and x-vcpu-dirty-limit as 10MB/s: $ ./tests/migration/guestperf.py \ --dirty-ring-size 4096 \ --dirty-limit --x-vcpu-dirty-limit-period 500 \ --vcpu-dirty-limit 10 --output output.json \ To run the entire standardized set of dirty-limit-enabled comparisons, with unix migration: $ ./tests/migration/guestperf-batch.py \ --dirty-ring-size 4096 \ --dst-host localhost --transport unix \ --filter compr-dirty-limit* --output outputdir Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) --- tests/migration/guestperf/comparison.py | 23 +++++++++++++++++++++++ tests/migration/guestperf/engine.py | 17 +++++++++++++++++ tests/migration/guestperf/progress.py | 16 ++++++++++++++-- tests/migration/guestperf/scenario.py | 11 ++++++++++- tests/migration/guestperf/shell.py | 18 +++++++++++++++++- 5 files changed, 81 insertions(+), 4 deletions(-) diff --git a/tests/migration/guestperf/comparison.py b/tests/migration/gues= tperf/comparison.py index c03b3f6d7e..42cc0372d1 100644 --- a/tests/migration/guestperf/comparison.py +++ b/tests/migration/guestperf/comparison.py @@ -135,4 +135,27 @@ COMPARISONS =3D [ Scenario("compr-multifd-channels-64", multifd=3DTrue, multifd_channels=3D64), ]), + + # Looking at effect of dirty-limit with + # varying x_vcpu_dirty_limit_period + Comparison("compr-dirty-limit-period", scenarios =3D [ + Scenario("compr-dirty-limit-period-500", + dirty_limit=3DTrue, x_vcpu_dirty_limit_period=3D500), + Scenario("compr-dirty-limit-period-800", + dirty_limit=3DTrue, x_vcpu_dirty_limit_period=3D800), + Scenario("compr-dirty-limit-period-1000", + dirty_limit=3DTrue, x_vcpu_dirty_limit_period=3D1000), + ]), + + + # Looking at effect of dirty-limit with + # varying vcpu_dirty_limit + Comparison("compr-dirty-limit", scenarios =3D [ + Scenario("compr-dirty-limit-10MB", + dirty_limit=3DTrue, vcpu_dirty_limit=3D10), + Scenario("compr-dirty-limit-20MB", + dirty_limit=3DTrue, vcpu_dirty_limit=3D20), + Scenario("compr-dirty-limit-50MB", + dirty_limit=3DTrue, vcpu_dirty_limit=3D50), + ]), ] diff --git a/tests/migration/guestperf/engine.py b/tests/migration/guestper= f/engine.py index 29ebb5011b..93a6f78e46 100644 --- a/tests/migration/guestperf/engine.py +++ b/tests/migration/guestperf/engine.py @@ -102,6 +102,8 @@ class Engine(object): info.get("expected-downtime", 0), info.get("setup-time", 0), info.get("cpu-throttle-percentage", 0), + info.get("dirty-limit-throttle-time-per-round", 0), + info.get("dirty-limit-ring-full-time", 0), ) =20 def _migrate(self, hardware, scenario, src, dst, connect_uri): @@ -203,6 +205,21 @@ class Engine(object): resp =3D dst.command("migrate-set-parameters", multifd_channels=3Dscenario._multifd_channe= ls) =20 + if scenario._dirty_limit: + if not hardware._dirty_ring_size: + raise Exception("dirty ring size must be configured when " + "testing dirty limit migration") + + resp =3D src.command("migrate-set-capabilities", + capabilities =3D [ + { "capability": "dirty-limit", + "state": True } + ]) + resp =3D src.command("migrate-set-parameters", + x_vcpu_dirty_limit_period=3Dscenario._x_vcpu_dirty_limit_p= eriod) + resp =3D src.command("migrate-set-parameters", + vcpu_dirty_limit=3Dscenario._vcpu_dirty_lim= it) + resp =3D src.command("migrate", uri=3Dconnect_uri) =20 post_copy =3D False diff --git a/tests/migration/guestperf/progress.py b/tests/migration/guestp= erf/progress.py index ab1ee57273..d490584217 100644 --- a/tests/migration/guestperf/progress.py +++ b/tests/migration/guestperf/progress.py @@ -81,7 +81,9 @@ class Progress(object): downtime, downtime_expected, setup_time, - throttle_pcent): + throttle_pcent, + dirty_limit_throttle_time_per_round, + dirty_limit_ring_full_time): =20 self._status =3D status self._ram =3D ram @@ -91,6 +93,10 @@ class Progress(object): self._downtime_expected =3D downtime_expected self._setup_time =3D setup_time self._throttle_pcent =3D throttle_pcent + self._dirty_limit_throttle_time_per_round =3D \ + dirty_limit_throttle_time_per_round + self._dirty_limit_ring_full_time =3D \ + dirty_limit_ring_full_time =20 def serialize(self): return { @@ -102,6 +108,10 @@ class Progress(object): "downtime_expected": self._downtime_expected, "setup_time": self._setup_time, "throttle_pcent": self._throttle_pcent, + "dirty_limit_throttle_time_per_round": + self._dirty_limit_throttle_time_per_round, + "dirty_limit_ring_full_time": + self._dirty_limit_ring_full_time, } =20 @classmethod @@ -114,4 +124,6 @@ class Progress(object): data["downtime"], data["downtime_expected"], data["setup_time"], - data["throttle_pcent"]) + data["throttle_pcent"], + data["dirty_limit_throttle_time_per_round"], + data["dirty_limit_ring_full_time"]) diff --git a/tests/migration/guestperf/scenario.py b/tests/migration/guestp= erf/scenario.py index de70d9b2f5..154c4f5d5f 100644 --- a/tests/migration/guestperf/scenario.py +++ b/tests/migration/guestperf/scenario.py @@ -30,7 +30,9 @@ class Scenario(object): auto_converge=3DFalse, auto_converge_step=3D10, compression_mt=3DFalse, compression_mt_threads=3D1, compression_xbzrle=3DFalse, compression_xbzrle_cache=3D10, - multifd=3DFalse, multifd_channels=3D2): + multifd=3DFalse, multifd_channels=3D2, + dirty_limit=3DFalse, x_vcpu_dirty_limit_period=3D500, + vcpu_dirty_limit=3D1): =20 self._name =3D name =20 @@ -60,6 +62,10 @@ class Scenario(object): self._multifd =3D multifd self._multifd_channels =3D multifd_channels =20 + self._dirty_limit =3D dirty_limit + self._x_vcpu_dirty_limit_period =3D x_vcpu_dirty_limit_period + self._vcpu_dirty_limit =3D vcpu_dirty_limit + def serialize(self): return { "name": self._name, @@ -79,6 +85,9 @@ class Scenario(object): "compression_xbzrle_cache": self._compression_xbzrle_cache, "multifd": self._multifd, "multifd_channels": self._multifd_channels, + "dirty_limit": self._dirty_limit, + "x_vcpu_dirty_limit_period": self._x_vcpu_dirty_limit_period, + "vcpu_dirty_limit": self._vcpu_dirty_limit, } =20 @classmethod diff --git a/tests/migration/guestperf/shell.py b/tests/migration/guestperf= /shell.py index 7d6b8cd7cf..c85d89efec 100644 --- a/tests/migration/guestperf/shell.py +++ b/tests/migration/guestperf/shell.py @@ -131,6 +131,17 @@ class Shell(BaseShell): parser.add_argument("--multifd-channels", dest=3D"multifd_channels= ", default=3D2, type=3Dint) =20 + parser.add_argument("--dirty-limit", dest=3D"dirty_limit", default= =3DFalse, + action=3D"store_true") + + parser.add_argument("--x-vcpu-dirty-limit-period", + dest=3D"x_vcpu_dirty_limit_period", + default=3D500, type=3Dint) + + parser.add_argument("--vcpu-dirty-limit", + dest=3D"vcpu_dirty_limit", + default=3D1, type=3Dint) + def get_scenario(self, args): return Scenario(name=3D"perfreport", downtime=3Dargs.downtime, @@ -154,7 +165,12 @@ class Shell(BaseShell): compression_xbzrle_cache=3Dargs.compression_xbzrle= _cache, =20 multifd=3Dargs.multifd, - multifd_channels=3Dargs.multifd_channels) + multifd_channels=3Dargs.multifd_channels, + + dirty_limit=3Dargs.dirty_limit, + x_vcpu_dirty_limit_period=3D\ + args.x_vcpu_dirty_limit_period, + vcpu_dirty_limit=3Dargs.vcpu_dirty_limit) =20 def run(self, argv): args =3D self._parser.parse_args(argv) --=20 2.38.5