From nobody Sat Nov 23 20:23:21 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730303994; cv=none; d=zohomail.com; s=zohoarc; b=SkfLOOJRZk+H6+RCaoVQRGudeZOp9vE7/sJfqfifI+c/CQWdpwYNYPfN4JpXJOJmyjfgMf6R2YJi5s28IH6DimeC9dAL6Qu/GQodxfZjT34G3m/iBGnf58wElxjhZWjtzHIH0F6flUY8UTH/Y9bQ3zwKiZ9qljmwX9418O70b/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730303994; 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=D04sswxuA64dl9ZML7ycu/fX/0EMcgaz7cJ3EQ22hfI=; b=X/Pgusy/8xK2K+OLhaYNknXCqDGvw48OSAowPezU15Tnk4ihZlNMa8qvqyivifXkCHZAehjHb4QrjkRPRRa90yfWU4pLaziDVRsQi3oGY2JW1yX6G1XRoEtHlR0SRWQa1Ig4fXaem3NOIVGslsC+4pNg9Z9PkkN73ayIvqrfulg= 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 1730303994232660.8972493336123; Wed, 30 Oct 2024 08:59:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6B5A-0003bh-PO; Wed, 30 Oct 2024 11:58:05 -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 1t6B54-0003aS-Hz for qemu-devel@nongnu.org; Wed, 30 Oct 2024 11:57:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6B52-0007nM-Sc for qemu-devel@nongnu.org; Wed, 30 Oct 2024 11:57:58 -0400 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-199-_JZ0IR-pO1O5gxBQvdI4Fw-1; Wed, 30 Oct 2024 11:57:53 -0400 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6cbed928402so84811836d6.2 for ; Wed, 30 Oct 2024 08:57:53 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-114-190.cpe.net.cable.rogers.com. [99.254.114.190]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d19c57c1ffsm22802276d6.89.2024.10.30.08.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 08:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730303876; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=D04sswxuA64dl9ZML7ycu/fX/0EMcgaz7cJ3EQ22hfI=; b=T5eblZPkCxqLCgD/JZ28CKQhfeEFM+7N8WdxinQRRmLPLlwS9YhbxvBO2+Kv3U9YoN3MTC H8vWR17DzJahF3u1kumkow8wrm9Ul0huRq5QtPpB6sB7KonYD7f0XMydlS2mwYXptXNMGZ +sxnBZJsB1RIf9xWZQKHlof0oBTNX/Q= X-MC-Unique: _JZ0IR-pO1O5gxBQvdI4Fw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730303872; x=1730908672; 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=D04sswxuA64dl9ZML7ycu/fX/0EMcgaz7cJ3EQ22hfI=; b=ASdAciRRy7zlE1bF5ahAaUeQUA8drNN6bU9neuWDkPI2vd/WBeN78w46lmKkZsN8pZ DeyizoNwllO31UoBeRg2GDg5r6cXS34+mA4us48Mkru4UOIIB2j1iMD8U7WNl0831Dak GXgCpc16ZpNgarorcTLh7qzpC0e7MifEmuMzMTBHNnVO4HemsXdHKERoRF//143snEyz 3RnlGLOYGwX5ZIr9joGGzv7RmEbxKrrpeSR1yMBM28idzYbtuQvtgbiWowu7kJWHn7gV 1VsOiP3Xhw13082BausA8gpYN5uFrfcrBJo8z9COwWIoKyFICmCGNRln4DhxgD1at+bX C4EQ== X-Gm-Message-State: AOJu0YyuHIQOolGov3uxHKlPMXY3vpd/QeHsrSvxahey+8UvPTZzW7Yx 22oPcbtFR5UH2Bb3szavMe9inphxqwLIWflBlpJZvgbiHG5bnVulcO+FkyBmR8keQqqboyZrtgC DzMzPieqDLu7FMsuU+7upUj1UOXOZUySP28K7QHO/AyCr6IrlsMLn/vvwWRN+Fg+MjMYNszpXRH GMZpHLI1OtaHUNOy/ZjBXXhTcSyuZOjCM6Ag== X-Received: by 2002:a05:6214:2f01:b0:6cc:4136:205 with SMTP id 6a1803df08f44-6d1856f3f3cmr326332626d6.26.1730303872641; Wed, 30 Oct 2024 08:57:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZyOG+p6mdeNoMIurYOPKldNYJffEmFXjA6H0JYnamYdreGP9Rd3uz+LSqS+FZ0V8YZefCOw== X-Received: by 2002:a05:6214:2f01:b0:6cc:4136:205 with SMTP id 6a1803df08f44-6d1856f3f3cmr326332186d6.26.1730303872168; Wed, 30 Oct 2024 08:57:52 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Peter Maydell , Hyman Huang , Peter Xu Subject: [PULL 09/18] tests/migration: Add case for periodic ramblock dirty sync Date: Wed, 30 Oct 2024 11:57:25 -0400 Message-ID: <20241030155734.2141398-10-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030155734.2141398-1-peterx@redhat.com> References: <20241030155734.2141398-1-peterx@redhat.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=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.366, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.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 @redhat.com) X-ZM-MESSAGEID: 1730303994574116600 Content-Type: text/plain; charset="utf-8" From: Hyman Huang Signed-off-by: Hyman Huang Reviewed-by: Peter Xu Reviewed-by: Fabiano Rosas Link: https://lore.kernel.org/r/cb61504f1a1e9d5f2ca4dac12e518deb076ce9f3.17= 29146786.git.yong.huang@smartx.com Signed-off-by: Peter Xu --- tests/qtest/migration-test.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 95e45b5029..e6a2803e71 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2791,6 +2791,8 @@ static void test_migrate_auto_converge(void) * so we need to decrease a bandwidth. */ const int64_t init_pct =3D 5, inc_pct =3D 25, max_pct =3D 95; + uint64_t prev_dirty_sync_cnt, dirty_sync_cnt; + int max_try_count, hit =3D 0; =20 if (test_migrate_start(&from, &to, uri, &args)) { return; @@ -2827,6 +2829,36 @@ static void test_migrate_auto_converge(void) } while (true); /* The first percentage of throttling should be at least init_pct */ g_assert_cmpint(percentage, >=3D, init_pct); + + /* + * End the loop when the dirty sync count greater than 1. + */ + while ((dirty_sync_cnt =3D get_migration_pass(from)) < 2) { + usleep(1000 * 1000); + } + + prev_dirty_sync_cnt =3D dirty_sync_cnt; + + /* + * The RAMBlock dirty sync count must changes in 5 seconds, here we set + * the timeout to 10 seconds to ensure it changes. + * + * Note that migrate_ensure_non_converge set the max-bandwidth to 3MB/= s, + * while the qtest mem is >=3D 100MB, one iteration takes at least 33s= (100/3) + * to complete; this ensures that the RAMBlock dirty sync occurs. + */ + max_try_count =3D 10; + while (--max_try_count) { + dirty_sync_cnt =3D get_migration_pass(from); + if (dirty_sync_cnt !=3D prev_dirty_sync_cnt) { + hit =3D 1; + break; + } + prev_dirty_sync_cnt =3D dirty_sync_cnt; + sleep(1); + } + g_assert_cmpint(hit, =3D=3D, 1); + /* Now, when we tested that throttling works, let it converge */ migrate_ensure_converge(from); =20 --=20 2.45.0