From nobody Wed Feb 11 03:44:42 2026 Delivered-To: importer2@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+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1686265009; cv=none; d=zohomail.com; s=zohoarc; b=j0qdTKYhoFJeCMez7CS1QEfqAkjgkSK3n80MUYd7t6c+hWpoSPWIdvu0sGaA+Znt8kXMY8dnQFpqpxIb1BuAXwqSVHVeKt1g026WN+sUoSqcx4jCMWgmXS8dP/3Saj/KGheNPlBQM7tryqSWGg6RqaC8EQFOdBOpK8U5V6MVzHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265009; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jyurFvDURCZbEwa8AO4WSQ20OAwsMG3UWiZ1c2Nvryo=; b=VOinIdvfb3S5x2MPD/O/QMUZpSsrEAiwDIad8cBiQI3cDW7Lu78Ng8hQ00kblRCGPJKc7LszNZydHBOmvfvUuAd3cTsiGyrCslDWHPn2dz5BBWptPqSbwYkEvxbQ+WvqattsmwkdlTkshczdCr0cYc7CglkYOK4dDaJUNJIJhOY= 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+importer2=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 1686265009486763.6310131361696; Thu, 8 Jun 2023 15:56:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OTO-0005qT-Ul; Thu, 08 Jun 2023 18:51: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 1q7OTM-0005Xg-Th for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q7OTL-0005NJ-35 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:51:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-ZFHyJ0eEMlS_eSadg47ohA-1; Thu, 08 Jun 2023 18:51:11 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7BA7385556A; Thu, 8 Jun 2023 22:51:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45655492B00; Thu, 8 Jun 2023 22:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264673; 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=jyurFvDURCZbEwa8AO4WSQ20OAwsMG3UWiZ1c2Nvryo=; b=SKDjlUSzcI0z5nUszaWW5f6yhj0oTmA1J5yllxioxFvQUTnwgW8l7JTU/qiTbwPpsFYR05 SILvNi1DiZZSd72CXGVL5goL+NoL+0S923/3IVRhCMDaiFhH+Utyaeeeu8ihYaBX/Theto CTdPwOpLhMCiYUluDbnMWqzlpbVGfTA= X-MC-Unique: ZFHyJ0eEMlS_eSadg47ohA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 37/42] migration-test: Create get_event GuestState variable Date: Fri, 9 Jun 2023 00:49:38 +0200 Message-Id: <20230608224943.3877-38-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.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, DKIMWL_WL_HIGH=-0.001, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-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+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265011144100003 Content-Type: text/plain; charset="utf-8" So we don't use a global variable for events. We use one by guest. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 48 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 95b7c9ed73..a96eb3eec7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -41,8 +41,6 @@ #endif =20 static bool uffd_feature_thread_id; -static bool got_src_stop; -static bool got_dst_resume; =20 /* * Dirtylimit stop working if dirty page rate error @@ -172,6 +170,7 @@ typedef struct { gchar *uri; unsigned start_address; unsigned end_address; + bool got_event; } GuestState; =20 static GuestState *guest_create(const char *name) @@ -396,21 +395,21 @@ static void read_blocktime(QTestState *who) qobject_unref(rsp_return); } =20 -static void wait_for_migration_pass(QTestState *who) +static void wait_for_migration_pass(GuestState *who) { - uint64_t initial_pass =3D get_migration_pass(who); + uint64_t initial_pass =3D get_migration_pass(who->qs); uint64_t pass; =20 /* Wait for the 1st sync */ - while (!got_src_stop && !initial_pass) { + while (!who->got_event && !initial_pass) { usleep(1000); - initial_pass =3D get_migration_pass(who); + initial_pass =3D get_migration_pass(who->qs); } =20 do { usleep(1000); - pass =3D get_migration_pass(who); - } while (pass =3D=3D initial_pass && !got_src_stop); + pass =3D get_migration_pass(who->qs); + } while (pass =3D=3D initial_pass && !who->got_event); } =20 static void check_guests_ram(GuestState *who) @@ -657,7 +656,7 @@ static void migrate_postcopy_start(GuestState *from, Gu= estState *to) qtest_qmp_assert_success(from->qs, "{ 'execute': 'migrate-start-postcopy' }"); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } =20 @@ -759,9 +758,6 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; =20 - got_src_stop =3D false; - got_dst_resume =3D false; - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " @@ -781,7 +777,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->qs =3D qtest_init(cmd_source); qtest_qmp_set_event_callback(from->qs, migrate_watch_for_stop, - &got_src_stop); + &from->got_event); } =20 cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " @@ -803,7 +799,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, - &got_dst_resume); + &to->got_event); } =20 static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) @@ -1211,7 +1207,7 @@ static void migrate_postcopy_prepare(GuestState *from, =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } =20 static void migrate_postcopy_complete(GuestState *from, GuestState *to, @@ -1464,7 +1460,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, */ if (args->result =3D=3D MIG_TEST_SUCCEED) { qtest_qmp_assert_success(from->qs, "{ 'execute' : 'stop'}"); - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } migrate_ensure_converge(from->qs); @@ -1484,10 +1480,10 @@ static void test_precopy_common(GuestState *from, G= uestState *to, if (args->live) { if (args->iterations) { while (args->iterations--) { - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } } else { - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); } =20 migrate_ensure_converge(from->qs); @@ -1498,7 +1494,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, */ wait_for_migration_complete(from->qs); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } } else { @@ -1513,7 +1509,7 @@ static void test_precopy_common(GuestState *from, Gue= stState *to, qtest_qmp_assert_success(to->qs, "{ 'execute' : 'cont'}"); } =20 - if (!got_dst_resume) { + if (!to->got_event) { qtest_qmp_eventwait(to->qs, "RESUME"); } =20 @@ -1627,9 +1623,9 @@ static void test_ignore_shared(void) =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } =20 @@ -2062,7 +2058,7 @@ static void test_migrate_auto_converge(void) break; } usleep(20); - g_assert_false(got_src_stop); + g_assert_false(from->got_event); } while (true); /* The first percentage of throttling should be at least init_pct */ g_assert_cmpint(percentage, >=3D, init_pct); @@ -2368,7 +2364,7 @@ static void test_multifd_tcp_cancel(void) =20 do_migrate(from, to); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 migrate_cancel(from->qs); =20 @@ -2399,9 +2395,9 @@ static void test_multifd_tcp_cancel(void) =20 do_migrate(from, to2); =20 - wait_for_migration_pass(from->qs); + wait_for_migration_pass(from); =20 - if (!got_src_stop) { + if (!from->got_event) { qtest_qmp_eventwait(from->qs, "STOP"); } qtest_qmp_eventwait(to2->qs, "RESUME"); --=20 2.40.1