From nobody Tue Feb 10 15:29:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507202549255330.71622455587715; Thu, 5 Oct 2017 04:22:29 -0700 (PDT) Received: from localhost ([::1]:39142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e04ER-0007p4-AQ for importer@patchew.org; Thu, 05 Oct 2017 07:22:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e048l-0003xh-8T for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:16:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e048i-0000IF-Hb for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:16:31 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:56940) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e048i-0000HX-8a for qemu-devel@nongnu.org; Thu, 05 Oct 2017 07:16:28 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20171005111626euoutp027d1ba95e2618cba77e7263d968c3aa46~qqGdKaIea2915929159euoutp02J; Thu, 5 Oct 2017 11:16:26 +0000 (GMT) Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171005111626eucas1p2445a346a71f424dea8c43b74950d404c~qqGckAqSs0161201612eucas1p21; Thu, 5 Oct 2017 11:16:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3.samsung.com (EUCPMTA) with SMTP id 7D.E8.12867.98416D95; Thu, 5 Oct 2017 12:16:25 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171005111625eucas1p28ad35b246e6f964ca7d642cfa60df10d~qqGb9zkiA2882328823eucas1p2n; Thu, 5 Oct 2017 11:16:25 +0000 (GMT) Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A0.B0.18832.98416D95; Thu, 5 Oct 2017 12:16:25 +0100 (BST) Received: from aperevalov-ubuntu.rnd.samsung.ru ([106.109.129.199]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OXC00M4YKN1XNA0@eusync4.samsung.com>; Thu, 05 Oct 2017 12:16:25 +0100 (BST) X-AuditID: cbfec7f2-f793b6d000003243-3b-59d61489d2fa From: Alexey Perevalov To: qemu-devel@nongnu.org Date: Thu, 05 Oct 2017 14:16:09 +0300 Message-id: <1507202170-22619-6-git-send-email-a.perevalov@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1507202170-22619-1-git-send-email-a.perevalov@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsWy7djP87qdItciDa5Pt7GYe/c8i0Xvtnvs FtM+32a3uNL+k91iy/5v7BbHe3ewWNzZ0sfkwO7x5NpmJo/3+66yefRtWcUYwBzFZZOSmpNZ llqkb5fAlfFym1NBg2LF/SuzWRsY30l0MXJySAiYSCxoaGCEsMUkLtxbz9bFyMUhJLCUUWLh 8YVsIAkhgc+MErsv2XYxcoA1rH/gC1GzjFFi15z5UA3dTBJL3r1lASliEzCQ2HfPFqRXREBS 4nfXaWaQGmaBhYwSD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QQHpiSWp2ampBahFM lomDU6qBUavgVeJ56fwK86op/9pvKDa0P9/hpdLGnK8a/7O/TnJ2pEKP+/6mqffFZttsni7A 8+amiUu9SKVtRl1si0r/tYqSq4dkLHNcP5c9VN3eXPn+os/s3WsPPlrNLvjrapJxxsaLD98t EJs92d3QMn/h83juK0m1XH5H7zmYdqpvi776cudJeT4vJZbijERDLeai4kQAdAXR0RoCAAA= X-CMS-MailID: 20171005111625eucas1p28ad35b246e6f964ca7d642cfa60df10d X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG+yCvOyEseyghOyekBtTZW5pb3IgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QWxleGV5IFBlcmV2YWxvdhtTUlItVmlydHVhbGl6YXRpb24g?= =?UTF-8?B?TGFiG1NhbXN1bmcgRWxlY3Ryb25pY3MbU2VuaW9yIEVuZ2luZWVy?= X-Sender-Code: =?UTF-8?B?QzEwG0NJU0hRG0MxMEdEMDFHRDAxMDE1NA==?= CMS-TYPE: 201P X-CMS-RootMailID: 20171005111625eucas1p28ad35b246e6f964ca7d642cfa60df10d X-RootMTR: 20171005111625eucas1p28ad35b246e6f964ca7d642cfa60df10d References: <1507202170-22619-1-git-send-email-a.perevalov@samsung.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 210.118.77.12 Subject: [Qemu-devel] [PATCH v11 5/6] migration: add blocktime calculation into postcopy-test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heetae82.ahn@samsung.com, quintela@redhat.com, Alexey Perevalov , peterx@redhat.com, dgilbert@redhat.com, i.maximets@samsung.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch just requests blocktime calculation, and check it in case when UFFD_FEATURE_THREAD_ID feature is set on the host. Signed-off-by: Alexey Perevalov Reviewed-by: Dr. David Alan Gilbert --- tests/postcopy-test.c | 63 +++++++++++++++++++++++++++++++++++++++--------= ---- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/tests/postcopy-test.c b/tests/postcopy-test.c index 8142f2a..4231cce 100644 --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -24,7 +24,8 @@ =20 const unsigned start_address =3D 1024 * 1024; const unsigned end_address =3D 100 * 1024 * 1024; -bool got_stop; +static bool got_stop; +static bool uffd_feature_thread_id; =20 #if defined(__linux__) #include @@ -54,6 +55,7 @@ static bool ufd_version_check(void) g_test_message("Skipping test: UFFDIO_API failed"); return false; } + uffd_feature_thread_id =3D api_struct.features & UFFD_FEATURE_THREAD_I= D; =20 ioctl_mask =3D (__u64)1 << _UFFDIO_REGISTER | (__u64)1 << _UFFDIO_UNREGISTER; @@ -265,22 +267,48 @@ static uint64_t get_migration_pass(void) return result; } =20 -static void wait_for_migration_complete(void) +static bool get_src_status(void) { QDict *rsp, *rsp_return; + const char *status; + bool result; + + rsp =3D return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp_return =3D qdict_get_qdict(rsp, "return"); + status =3D qdict_get_str(rsp_return, "status"); + g_assert_cmpstr(status, !=3D, "failed"); + result =3D strcmp(status, "completed") =3D=3D 0; + QDECREF(rsp); + return result; +} + +static void read_blocktime(void) +{ + QDict *rsp, *rsp_return; + + rsp =3D return_or_event(qmp("{ 'execute': 'query-migrate' }")); + rsp_return =3D qdict_get_qdict(rsp, "return"); + g_assert(qdict_haskey(rsp_return, "postcopy-blocktime")); + QDECREF(rsp); +} + +static void wait_for_migration_complete(QTestState *from, QTestState *to) +{ bool completed; =20 do { - const char *status; - - rsp =3D return_or_event(qmp("{ 'execute': 'query-migrate' }")); - rsp_return =3D qdict_get_qdict(rsp, "return"); - status =3D qdict_get_str(rsp_return, "status"); - completed =3D strcmp(status, "completed") =3D=3D 0; - g_assert_cmpstr(status, !=3D, "failed"); - QDECREF(rsp); + + /* test src state */ + global_qtest =3D from; + completed =3D get_src_status(); + usleep(1000 * 100); } while (!completed); + + if (uffd_feature_thread_id) { + global_qtest =3D to; + read_blocktime(); + } } =20 static void wait_for_migration_pass(void) @@ -364,8 +392,6 @@ static void test_migrate(void) char *bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); const char *arch =3D qtest_get_arch(); =20 - got_stop =3D false; - if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { init_bootfile_x86(bootpath); cmd_src =3D g_strdup_printf("-machine accel=3Dkvm:tcg -m 150M" @@ -425,6 +451,15 @@ static void test_migrate(void) g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); =20 + global_qtest =3D to; + rsp =3D qmp("{ 'execute': 'migrate-set-capabilities'," + "'arguments': { " + "'capabilities': [ {" + "'capability': 'postcopy-blocktime'," + "'state': true } ] } }"); + g_assert(qdict_haskey(rsp, "return")); + QDECREF(rsp); + /* We want to pick a speed slow enough that the test completes * quickly, but that it doesn't complete precopy even on a slow * machine, so also set the downtime. @@ -441,7 +476,6 @@ static void test_migrate(void) g_assert(qdict_haskey(rsp, "return")); QDECREF(rsp); =20 - /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 @@ -467,8 +501,7 @@ static void test_migrate(void) qmp_eventwait("RESUME"); =20 wait_for_serial("dest_serial"); - global_qtest =3D from; - wait_for_migration_complete(); + wait_for_migration_complete(from, to); =20 qtest_quit(from); =20 --=20 2.7.4