From nobody Tue Feb 10 18:59:05 2026 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=1696249399; cv=none; d=zohomail.com; s=zohoarc; b=nq49RkouHpwniZ0dbE80isfamF48YrjKnQZN4LTsKwBECcRpVccQ/d3Uiq6aSY4ak8mVkbrzXzedH1coebLyfZvp/z9c5Jdjp7jLLjWwvFj27UG3/A6e3u5OCQE30YFn2XRcj2kL367buolv0lQuQOhu7I8kYQ7HhTSiedlA90w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249399; 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=aQykBHeOd7Cu+R+QrMssOHbrvt0RjvmjIQOkeKBgV4E=; b=A2vXQ2cBBWFligz6nGKufdeXYkN6b0jqgunv2FyTOULIW9E63nuOmBpnDeSGANKZM4HgL5LIrY+y1TWXJpoD5Qeudjdllt/QuiuU3AoPu4NvIYSQP4O16HPVoYHkt5eYeRVvlL9gS0AK9bsvUBz9H0mkHNDqlTXKiHvuHwFZUPw= 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 1696249399315261.93508720071236; Mon, 2 Oct 2023 05:23:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHul-0007Jl-3O; Mon, 02 Oct 2023 08:20:43 -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 1qnHui-0007Ig-SQ for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -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 1qnHub-0007N3-Mr for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-352-46hWiqQFOxWf1LekeJIshQ-1; Mon, 02 Oct 2023 08:20:26 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09C26801FA9; Mon, 2 Oct 2023 12:20:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E43421B20B1; Mon, 2 Oct 2023 12:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249229; 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=aQykBHeOd7Cu+R+QrMssOHbrvt0RjvmjIQOkeKBgV4E=; b=HfWnteQt17f9Csf40NRiQcr4mqsZyyIns3ejOrbUPUG2Y4DS/TBYuY81Bqn5r+BVoYOMW1 Ea/eXUu+FaBv8VSmIXDaWxQyyMBfQMxqH5dIxJNpWARzwlSYTNY3w1e2KX0+a4YjVC69+J Fz96NRfpcnscMiy/cOGE6/12IFZJRtY= X-MC-Unique: 46hWiqQFOxWf1LekeJIshQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 01/13] migration-test: Create kvm_opts Date: Mon, 2 Oct 2023 14:20:09 +0200 Message-ID: <20231002122021.231959-2-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249399567100011 Content-Type: text/plain; charset="utf-8" So arch_dirty_ring option becomes one option like the others. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-8-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 1b43df5ca7..bde553730e 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -710,6 +710,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; + const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; =20 @@ -785,13 +786,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 + if (args->use_dirty_ring) { + kvm_opts =3D ",dirty-ring-size=3D4096"; + } + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -811,8 +815,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249292; cv=none; d=zohomail.com; s=zohoarc; b=H9dV2RG9Lo9A2b7tgbUGJIXhu29r7vGd/86XhYeB5fJIYnayRzJMPRNctuOKmo4lhBuG9erFp2tQ/3xtTpfGRX25vdKsmdcQMmIsXqqOwYLB/JEtwNsOOkFaI0Hwh2UYcNvnM/OfIFXmAmrwv7Hwl2+S1kBBsOBTpYdodyAfb08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249292; 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=nsRFZx+o50WHfC4o6BG0KrKPeNBc9MjLhoGuQZT9fYU=; b=CWeR36k0F4XWyOMPLOeLcYFyxt0mmU25VQK08jWVUAVRGtR1524mLm9+19IfTMukAgRGbxmmA5iCRuHBGtCnWSm+A4I20+cK0x4TY6+nZRvYbFLedJS3v56rxlR4gmr6Pkl4QokTOG747UO7iJtKgf4wI5ABCECM0al8cxUtKTM= 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 1696249292143464.34555817559396; Mon, 2 Oct 2023 05:21:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHug-0007Gd-8h; Mon, 02 Oct 2023 08:20:38 -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 1qnHue-0007Fo-QQ for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:36 -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 1qnHub-0007N7-Gm for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-651-bTSGcmmaO322OXWPFkOrsA-1; Mon, 02 Oct 2023 08:20:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE43C97E403; Mon, 2 Oct 2023 12:20:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E8082156701; Mon, 2 Oct 2023 12:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249230; 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=nsRFZx+o50WHfC4o6BG0KrKPeNBc9MjLhoGuQZT9fYU=; b=O4DvZnnhyNf1iqBlRG6dYTvYT+1yDioabM6e30BycUwkt9EFtxjQKWocU6/7XEaa/iN30+ qNnwQfD3vlieqwRqVK7ai7CvpXtCiEbZRljkC24FaCA40doeHQBoi7tyUexZg87we+nZYk 2X9Il17IBkydCkCgbeciTgcJEqbLrO8= X-MC-Unique: bTSGcmmaO322OXWPFkOrsA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 02/13] migration-test: bootpath is the same for all tests and for all archs Date: Mon, 2 Oct 2023 14:20:10 +0200 Message-ID: <20231002122021.231959-3-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1696249292863100001 Content-Type: text/plain; charset="utf-8" So just make it a global variable. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-9-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index bde553730e..e191f66e54 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -116,6 +116,7 @@ static bool ufd_version_check(void) #endif =20 static char *tmpfs; +static char *bootpath; =20 /* The boot file modifies memory area in [start_address, end_address) * repeatedly. It outputs a 'B' at a fixed rate while it's still running. @@ -124,7 +125,7 @@ static char *tmpfs; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(const char *bootpath, void *content, size_t len) +static void init_bootfile(void *content, size_t len) { FILE *bootfile =3D fopen(bootpath, "wb"); =20 @@ -707,7 +708,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr; - g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; @@ -723,17 +723,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 got_src_stop =3D false; got_dst_resume =3D false; - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { /* the assembled x86 boot sector should be exactly one sector larg= e */ assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); + init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -748,7 +747,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); + init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); @@ -866,7 +865,6 @@ static void test_migrate_end(QTestState *from, QTestSta= te *to, bool test_dest) =20 qtest_quit(to); =20 - cleanup("bootsect"); cleanup("migsocket"); cleanup("src_serial"); cleanup("dest_serial"); @@ -2629,12 +2627,10 @@ static QTestState *dirtylimit_start_vm(void) QTestState *vm =3D NULL; g_autofree gchar *cmd =3D NULL; const char *arch =3D qtest_get_arch(); - g_autofree char *bootpath =3D NULL; =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); =20 cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " @@ -2650,7 +2646,6 @@ static QTestState *dirtylimit_start_vm(void) static void dirtylimit_stop_vm(QTestState *vm) { qtest_quit(vm); - cleanup("bootsect"); cleanup("vm_serial"); } =20 @@ -2812,6 +2807,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); + bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2959,6 +2955,8 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 + cleanup("bootsect"); + g_free(bootpath); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249300; cv=none; d=zohomail.com; s=zohoarc; b=YEvjDIS/t3ZBnVQQXe23AdCq/BFBq1vO07Yzmyz9NnFfCKUFR3xU7NFr7GnWNQAhBzslfkH6a9NxAzz+F2hTKHM8fUg1Tm4X5s4QUUgpj3M9pfDQlSCA2HD+4E2iNwPBU3JWkw2LP7q1VBSnUfpD/5U6U9INtCKz56DoO/kfnNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249300; 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=z5HAh59q63S4qYoIjS8pN9+AhfokCU+HCQcjxJ5NJ2I=; b=CUWtfHCY43g3Ynv8h97Kn9JxRy5uJwgR9BSXob/kMTyxBugdqVG6hjF+7WHYpyDQNWY3Tt0fp0IBqGra+kJNBHFZvw3t1Y5oPt4P54VEAgc8uMurxuT0fam+1on6b+eumWIx1cMfpwkpke5ASyaNkDD4KJciQgSZFScEKDnsQZM= 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 1696249300402338.0775345399537; Mon, 2 Oct 2023 05:21:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHuh-0007Hk-Dx; Mon, 02 Oct 2023 08:20:39 -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 1qnHug-0007Ge-7f for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:38 -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 1qnHud-0007Q8-OT for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:37 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-83-Ct-ooEmzMPiSEF6K8LacMQ-1; Mon, 02 Oct 2023 08:20:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 07C2429AB410; Mon, 2 Oct 2023 12:20:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DC0D2156702; Mon, 2 Oct 2023 12:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249234; 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=z5HAh59q63S4qYoIjS8pN9+AhfokCU+HCQcjxJ5NJ2I=; b=ARi64/sK/j5JKlfpDwDvHL99unaVQR3V5VC2iryJnW+czQh9I9n6Ng/cy0MkZT9MdDc/Ec 4rDTc5uR/wWpSrodXdNf9zbyGjDKwHUYUrAp+8yYpT8EDXrvWQ/beKoDJpT8EfUIzTS7Vf stT7wTFXPLMNwjlCUQS7IjbRWiWW8kM= X-MC-Unique: Ct-ooEmzMPiSEF6K8LacMQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 03/13] migration-test: Add bootfile_create/delete() functions Date: Mon, 2 Oct 2023 14:20:11 +0200 Message-ID: <20231002122021.231959-4-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249301230100003 Content-Type: text/plain; charset="utf-8" The bootsector code is read only from the guest (otherwise we are going to have problems with it being read from both source and destination). Create a single copy for all the tests. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-10-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 50 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e191f66e54..f601249391 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -125,14 +125,47 @@ static char *bootpath; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(void *content, size_t len) +static void bootfile_create(char *dir) { + const char *arch =3D qtest_get_arch(); + unsigned char *content; + size_t len; + + bootpath =3D g_strdup_printf("%s/bootsect", dir); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + /* the assembled x86 boot sector should be exactly one sector larg= e */ + g_assert(sizeof(x86_bootsect) =3D=3D 512); + content =3D x86_bootsect; + len =3D sizeof(x86_bootsect); + } else if (g_str_equal(arch, "s390x")) { + content =3D s390x_elf; + len =3D sizeof(s390x_elf); + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + /* + * sane architectures can be programmed at the boot prompt + */ + return; + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + content =3D aarch64_kernel; + len =3D sizeof(aarch64_kernel); + g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); + } else { + g_assert_not_reached(); + } + FILE *bootfile =3D fopen(bootpath, "wb"); =20 g_assert_cmpint(fwrite(content, len, 1, bootfile), =3D=3D, 1); fclose(bootfile); } =20 +static void bootfile_delete(void) +{ + unlink(bootpath); + g_free(bootpath); + bootpath =3D NULL; +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -724,15 +757,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, got_src_stop =3D false; got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - /* the assembled x86 boot sector should be exactly one sector larg= e */ - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -747,14 +776,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; - - g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); } else { g_assert_not_reached(); } @@ -2629,9 +2655,6 @@ static QTestState *dirtylimit_start_vm(void) const char *arch =3D qtest_get_arch(); =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); - cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " @@ -2807,7 +2830,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); + bootfile_create(tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2955,8 +2978,7 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 - cleanup("bootsect"); - g_free(bootpath); + bootfile_delete(); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249396; cv=none; d=zohomail.com; s=zohoarc; b=DJD1viXXAW4wSGGk1CrF0jLBvf9sUldTwufbD18/vC5ICWf8CYSFEQilX8IgwwPO0yL2S4ztI+Dsr04C9Iqf/NMc/12I0zVklS71U8MVjZyk1QgxdjXi/A86M+E8ri4dsS56TryVCdKvWem8egMmUuDJXeIQRT7SZuS3Dc3JBpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249396; 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=ayQ2jVlv2fuZqd+KFUfxa8hUSlo0D97+gKNXs27jW9A=; b=Z0oCiMv4wcYHKYaVczx0kkHDgAuTbVTEMhk5OHAO03AYa+yDBsbeWsShMo+BgY+YDLsJyeF89YlqC5e4Lv58vgO6O+BaD2la+6vveNXE+3qFWRrj61NeMeam2hiDRxS9FO4vit5vEcBFX46vJJF/Lxf1VL/2AYMVeD2PVlJBKJs= 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 1696249396935871.6965409507383; Mon, 2 Oct 2023 05:23:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHul-0007Jq-4S; Mon, 02 Oct 2023 08:20:43 -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 1qnHui-0007Ih-Sy for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -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 1qnHud-0007Ps-O8 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-3-cIzKz3fKNS2u_lHmvj5l8A-1; Mon, 02 Oct 2023 08:20:32 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EA5801C2B66A; Mon, 2 Oct 2023 12:20:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C4402156701; Mon, 2 Oct 2023 12:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249234; 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=ayQ2jVlv2fuZqd+KFUfxa8hUSlo0D97+gKNXs27jW9A=; b=K52wMXAaCf7pNFRjB7XkE0PrFATeuYSn2a6W+vbav8x+F9Absvbg8sifHjyGOoXC2iMyzN DNBdBYFFFmn/NKeFlqYiRpVJ1V7v4I83+EeNn1BNLUi1X4C8Zglk3ssrbLkAYae0f2R5EE sIjOMg/HUWSmRAbivxdkTb+9r5ilf0Y= X-MC-Unique: cIzKz3fKNS2u_lHmvj5l8A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 04/13] migration-test: dirtylimit checks for x86_64 arch before Date: Mon, 2 Oct 2023 14:20:12 +0200 Message-ID: <20231002122021.231959-5-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 16 X-Spam_score: 1.6 X-Spam_bar: + X-Spam_report: (1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249397172100005 Content-Type: text/plain; charset="utf-8" So no need to assert we are in x86_64. Once there, refactor the function to remove useless variables. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-11-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index f601249391..334648ae19 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2651,10 +2651,7 @@ static int64_t get_limit_rate(QTestState *who) static QTestState *dirtylimit_start_vm(void) { QTestState *vm =3D NULL; - g_autofree gchar *cmd =3D NULL; - const char *arch =3D qtest_get_arch(); - - assert((strcmp(arch, "x86_64") =3D=3D 0)); + g_autofree gchar * cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249327; cv=none; d=zohomail.com; s=zohoarc; b=JLimfqHH+9vptncjYdJbI0o3VN953+rerxLjxFfSsbWNwoEkrQ9cbAnB1i9W7pOXjxYnoGRJAUJOEjCE1NAZ5Dcy3avv+VY7Zm7D2wihK8qJddgZrQn0xEPo1srPg7gMutmc3TrPtTz0eobPj1xbp/Nns4rJohvj/HFVTc3AgXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249327; 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=C1/gTxf+WxfwpMD3AWW9S2xAi/6aR+TyzYDsoG9E728=; b=jtrvVYY/3TVBFke0QNOZdeA9y5DbZ2O8EbVwPKHFsK+UJF7OOVarn6bN8Ac7geGWn2RrMzd5FkR4IGJ+wKWWYS+tA4lX5yVroGwdxN9dbGZJDjC4USjI/ZIphWcgn3UcYn/6MTbewL17Ig44yfPB/fbh0f2mu2nKC5vYBrXZvlQ= 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 16962493271944.200836828853312; Mon, 2 Oct 2023 05:22:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHuj-0007J2-7p; Mon, 02 Oct 2023 08:20:41 -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 1qnHuh-0007Hn-QQ for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:39 -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 1qnHuf-0007S4-W2 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:39 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-570-bxFDPzcKN3OAefAByYs_wg-1; Mon, 02 Oct 2023 08:20:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D651B800B35; Mon, 2 Oct 2023 12:20:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3869E2156701; Mon, 2 Oct 2023 12:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249237; 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=C1/gTxf+WxfwpMD3AWW9S2xAi/6aR+TyzYDsoG9E728=; b=fWf18Wq8iCY7HwZg+j96y1RW5dTfv7PMwKT5DQO42zSVyIJTEUBoEX0Gi17UFPf5idXgsu +CXoKikGKpdtOz8G1C9Nae774O9NdM4oxT6D61W7sqc6uUWyF2qh8Syb+AGyHSeEGQiNFT M6cKf7vonuSCu1p7ieSeaQbEmpFOvc4= X-MC-Unique: bxFDPzcKN3OAefAByYs_wg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 05/13] migration-test: simplify shmem_opts handling Date: Mon, 2 Oct 2023 14:20:13 +0200 Message-ID: <20231002122021.231959-6-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.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_H3=0.001, RCVD_IN_MSPIKE_WL=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: 1696249328007100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-4-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 334648ae19..46f1c275a2 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -806,9 +806,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-object memory-backend-file,id=3Dmem0,size=3D%s" ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", memory_size, shmem_path); - } else { - shmem_path =3D NULL; - shmem_opts =3D g_strdup(""); } =20 if (args->use_dirty_ring) { @@ -824,7 +821,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", - shmem_opts, + shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { @@ -844,7 +841,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", - shmem_opts, + shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr); *to =3D qtest_init(cmd_target); --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249395; cv=none; d=zohomail.com; s=zohoarc; b=GjtXHFi8LcoeETI4G7WWzbtsZ3qO24fRYOSkopgzslmkBGqmWNhUA1jgT7qvmwloQ0EdpqPqc17BLKQl2FmdnpmBKV+qz+MqmM4fT1vrJ1ZFfXrXkxgumvE6AxWB27SFf+MXgDQZVeHkLgMWUXmMxQ6wWMeedzsQd/35OE4+y/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249395; h=Content-Type: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=1RobKDhYZxL1oy4jJItXEsMcRAc5IglHj6SZvYn0WWM=; b=Pm8VgBbBdQqCmkgX1Ae8g9+IBNhOHhOOrgTKyeMBmJQEnqq8VhUAJvjk4PVKNJ2OxV9cyoLg6Qtq015j5RyjVZ+JcYYIlM85nOFanHK9/ucFPfzGgRDUs6K/YLReVL6hxEHjiUe2z9brhx1m2MctmXb4+46M2O25YWxNDMOoCyA= 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 1696249395121514.1069883049837; Mon, 2 Oct 2023 05:23:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHul-0007Jf-25; Mon, 02 Oct 2023 08:20:43 -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 1qnHui-0007Ij-Vj for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -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 1qnHug-0007SN-JY for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:40 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-341-L52tefoDPaSxjsIcGQgx0A-1; Mon, 02 Oct 2023 08:20:36 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16BCC3C19925; Mon, 2 Oct 2023 12:20:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 249002156701; Mon, 2 Oct 2023 12:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249238; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1RobKDhYZxL1oy4jJItXEsMcRAc5IglHj6SZvYn0WWM=; b=WAFlvowyhznmvBvZRCxYQLrPwwxad1SE4bKD5kvR0ZongZrTYOayPqvBp5Upsas4nNvO0y fBI6pvYJKvM51lAK9J1ZfLc8U926xwqv0NX5jf3rRAyqZ5EAl4dJkbnpA7O2IqkVWp4NMc 2inQNdkBruwGyEBFWe/VwEaWNk25jio= X-MC-Unique: L52tefoDPaSxjsIcGQgx0A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi , Tejus GK , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 06/13] migration: Refactor repeated call of yank_unregister_instance Date: Mon, 2 Oct 2023 14:20:14 +0200 Message-ID: <20231002122021.231959-7-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249395493100001 From: Tejus GK In the function qmp_migrate(), yank_unregister_instance() gets called twice which isn't required. Hence, refactoring it so that it gets called during the local_error cleanup. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Juan Quintela Acked-by: Peter Xu Signed-off-by: Tejus GK Message-ID: <20230621130940.178659-3-tejus.gk@nutanix.com> Signed-off-by: Juan Quintela --- migration/migration.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index e2ed85b5be..6d3cf5d5cd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1703,15 +1703,11 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { - if (!resume_requested) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); - } error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); block_cleanup_parameters(); - return; } =20 if (local_err) { --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249381; cv=none; d=zohomail.com; s=zohoarc; b=eOhNDcfZN0bxf7v2WuRkbLYkgSOm7FQylmR+RdfR1ou/REnfZioianw1HmYqeulXpkDB75wNtkw133236TrzMJQbuu6JFWLsVTqMvM2cdmkPbbf9lbcjn2jJ8Bs5o2CpREtQn7MAm+iB+sYeH0wNLV4N/xObaB6f+SfSQ7llnOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249381; 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=HMJJ5ZNgxRe9ZQPNofRl4XQZBPN7BarQoQwhXCwANL8=; b=K4mggjosYCwaR5cL120EacRuTdAR8dhGhP18KB2RWrzW3oVHZ95ANBRChN4g3d2mk4xRdWYt2ZmG+rDqjjfvRUmKABG0V6YufjnthOi/FXnGg24KnPSML/EqtsEmRMbyNAaHLm7ELjwCF3Th0rKPdT13HE+PK5lx7qRn3O5mzcA= 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 1696249381484850.6962200337194; Mon, 2 Oct 2023 05:23:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHuo-0007MY-G4; Mon, 02 Oct 2023 08:20:46 -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 1qnHul-0007Kx-QN for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:43 -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 1qnHuk-0007Ui-97 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-575-3pGswhXXNsaDciBZbwRQuQ-1; Mon, 02 Oct 2023 08:20:39 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2D821811E88; Mon, 2 Oct 2023 12:20:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58DDA2156701; Mon, 2 Oct 2023 12:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249241; 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=HMJJ5ZNgxRe9ZQPNofRl4XQZBPN7BarQoQwhXCwANL8=; b=LAcjpphlF/eHSIZ4q6GkNcts+p6XeL5ULRFsEbT83aydv56b8jyXzvvV9CDQBoqVf05yZV TTfmTY3H1B5egyMl4Fa5F1KLINTjnAOCn8h3o5DV2yNo+fL3H8RKMXGI2SNfHpK7cZeU6p ttlDLK7aavmJDLAd607ljeY42fEwb8E= X-MC-Unique: 3pGswhXXNsaDciBZbwRQuQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi , Fabiano Rosas Subject: [PULL 07/13] migration: Use qemu_file_transferred_noflush() for block migration. Date: Mon, 2 Oct 2023 14:20:15 +0200 Message-ID: <20231002122021.231959-8-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: 1696249383046100001 Content-Type: text/plain; charset="utf-8" We only care about the amount of bytes transferred. Flushing is done by the system somewhere else. Reviewed-by: Fabiano Rosas Signed-off-by: Juan Quintela Message-ID: <20230530183941.7223-4-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/block.c b/migration/block.c index 86c2256a2b..26c10c0a0c 100644 --- a/migration/block.c +++ b/migration/block.c @@ -755,7 +755,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - uint64_t last_bytes =3D qemu_file_transferred(f); + uint64_t last_bytes =3D qemu_file_transferred_noflush(f); =20 trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -807,7 +807,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); - uint64_t delta_bytes =3D qemu_file_transferred(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_transferred_noflush(f) - last_bytes; return (delta_bytes > 0); } =20 --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249391; cv=none; d=zohomail.com; s=zohoarc; b=YrScG/FtO/6hv760nBg50SYlxdjVuJUOE5zzNa6EVNOHIekYMONJaiCvDGoizeRE3AW1rWi3tKRt+4GEl6O5Smp60jY/Sv28Ov/eJrCJ7gxRVcGs1gxGN2labnKN7GCnGJV0gW3YUjbGZYvmD2xQoZWPmqYX4QulggO49RFpfWg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249391; 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=ferd7TxCvB2SnRgf0fytdwG50Om2VRGJZksL23h0oFs=; b=lFyiQju6qQNLUbHK0a3+7wjTqoTed9nKyD0lDUpLEWalURealYFx15Te5tQ0t1H0OrkKMVZQ7+VwHg3bjoEnBTFEkE1+Ukwe5jBbBag6OYPczylWqiL+6ZjUttdYEkKcaALclmuFSbyJSD8QeqQ2z4m1eSyFAmkYTjmCHNx+Lw4= 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 1696249391491969.7604997990521; Mon, 2 Oct 2023 05:23:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHuo-0007MP-AH; Mon, 02 Oct 2023 08:20:46 -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 1qnHum-0007LX-AC for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:44 -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 1qnHuk-0007Um-Mp for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:44 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-651-EzVfv6VLM5SRu4d9xFB6wQ-1; Mon, 02 Oct 2023 08:20:40 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D11B3C1992B; Mon, 2 Oct 2023 12:20:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F0FC2156701; Mon, 2 Oct 2023 12:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249241; 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=ferd7TxCvB2SnRgf0fytdwG50Om2VRGJZksL23h0oFs=; b=NCfg56xBKuahXgWr3PbSxUplrQ29JxtgIuW3JDIXxHZsP1af7YKR1/g9GLeMpuH7mFslZ4 GVlfNFKToE7WuIZNyEt2fz+V19iZYkivAjdjvtOJuBmt8iZ6pqj3JAzh2v4KS7YIO3igNF DuhB7PKCSp4AOndnzU879EDTgIPb0sQ= X-MC-Unique: EzVfv6VLM5SRu4d9xFB6wQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 08/13] migration: Don't abuse qemu_file transferred for RDMA Date: Mon, 2 Oct 2023 14:20:16 +0200 Message-ID: <20231002122021.231959-9-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249392924100003 Content-Type: text/plain; charset="utf-8" Just create a variable for it, the same way that multifd does. This way it is safe to use for other thread, etc, etc. Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-11-quintela@redhat.com> --- migration/migration-stats.h | 4 ++++ migration/migration-stats.c | 5 +++-- migration/rdma.c | 22 ++++++++++++++++++++-- migration/trace-events | 2 +- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/migration/migration-stats.h b/migration/migration-stats.h index ac2260e987..2358caad63 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -89,6 +89,10 @@ typedef struct { * Maximum amount of data we can send in a cycle. */ Stat64 rate_limit_max; + /* + * Number of bytes sent through RDMA. + */ + Stat64 rdma_bytes; /* * Total number of bytes transferred. */ diff --git a/migration/migration-stats.c b/migration/migration-stats.c index 095d6d75bb..84e11e6dd8 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -61,8 +61,9 @@ void migration_rate_reset(QEMUFile *f) uint64_t migration_transferred_bytes(QEMUFile *f) { uint64_t multifd =3D stat64_get(&mig_stats.multifd_bytes); + uint64_t rdma =3D stat64_get(&mig_stats.rdma_bytes); uint64_t qemu_file =3D qemu_file_transferred(f); =20 - trace_migration_transferred_bytes(qemu_file, multifd); - return qemu_file + multifd; + trace_migration_transferred_bytes(qemu_file, multifd, rdma); + return qemu_file + multifd + rdma; } diff --git a/migration/rdma.c b/migration/rdma.c index a2a3db35b1..2a3c784328 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2122,9 +2122,18 @@ retry: return -EIO; } =20 + /* + * TODO: Here we are sending something, but we are not + * accounting for anything transferred. The following is = wrong: + * + * stat64_add(&mig_stats.rdma_bytes, sge.length); + * + * because we are using some kind of compression. I + * would think that head.len would be the more similar + * thing to a correct value. + */ stat64_add(&mig_stats.zero_pages, sge.length / qemu_target_page_size()); - return 1; } =20 @@ -2232,8 +2241,17 @@ retry: =20 set_bit(chunk, block->transit_bitmap); stat64_add(&mig_stats.normal_pages, sge.length / qemu_target_page_size= ()); + /* + * We are adding to transferred the amount of data written, but no + * overhead at all. I will asume that RDMA is magicaly and don't + * need to transfer (at least) the addresses where it wants to + * write the pages. Here it looks like it should be something + * like: + * sizeof(send_wr) + sge.length + * but this being RDMA, who knows. + */ + stat64_add(&mig_stats.rdma_bytes, sge.length); ram_transferred_add(sge.length); - qemu_file_credit_transfer(f, sge.length); rdma->total_writes++; =20 return 0; diff --git a/migration/trace-events b/migration/trace-events index 4666f19325..63483732ce 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -191,7 +191,7 @@ process_incoming_migration_co_postcopy_end_main(void) "" postcopy_preempt_enabled(bool value) "%d" =20 # migration-stats -migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd) "qemu_fi= le %" PRIu64 " multifd %" PRIu64 +migration_transferred_bytes(uint64_t qemu_file, uint64_t multifd, uint64_t= rdma) "qemu_file %" PRIu64 " multifd %" PRIu64 " RDMA %" PRIu64 =20 # channel.c migration_set_incoming_channel(void *ioc, const char *ioctype) "ioc=3D%p i= octype=3D%s" --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249368; cv=none; d=zohomail.com; s=zohoarc; b=cKe8FGkLu/Z16nlm2MrIMbB4q/dThW9py97f8SEY5qvdx9HtVUWihG5hHg28dmnU/RjAGuWojDR55eufot/Oc3X79Z73uMsqI+2kn4Qu/r/c9mS2qGuEEY6oeCKJ3a91Gb7uGEfc2E1oNsnKPbvjD8RgnBJT41o4T1RB8DLf3So= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249368; 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=2mMK3e6fhwV4pivA7TZGZcZMrSmwANOQPdsoFnv6UVU=; b=kvIcQvnDI5jvBCYLGH22ZyYeHpiXyTxVPlMNFt/vHBF97DSs+A3/GkGcgQfT10SCHr4hO+F0w/DVtSF6nSFZ2kHOaCcaTR7Ap7Ilz+YD4B2y3rhWvTjQBaKKt3rjAh6MmL/PI5vLesz7s1FlRyB8Px42jz5Ur0UivIpqSq7QFfQ= 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 1696249368309572.6841901395144; Mon, 2 Oct 2023 05:22:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHup-0007NE-S0; Mon, 02 Oct 2023 08:20:47 -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 1qnHuo-0007MQ-3G for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:46 -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 1qnHum-0007Vb-MK for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-pC6RsHk3NQabRrewNaCjUA-1; Mon, 02 Oct 2023 08:20:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 098F2811E86; Mon, 2 Oct 2023 12:20:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60D4C2156701; Mon, 2 Oct 2023 12:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249243; 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=2mMK3e6fhwV4pivA7TZGZcZMrSmwANOQPdsoFnv6UVU=; b=ErbSgh2UcPd218W8/L5dYIml44Zjpzw+2nd+nwMXIqz/FcIFdRIvhYJs8I6U0Ree+nUP6I /obD49kQgwIyNYeUjN87y2P3qrfie6QRfkMTBLrV+Ru/7ptzTQyDLJuo3/IUm+kuxsPrXC j1sD6xbY7MMzrWt6Barwz2aFW2Ix3aA= X-MC-Unique: pC6RsHk3NQabRrewNaCjUA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 09/13] migration/RDMA: It is accounting for zero/normal pages in two places Date: Mon, 2 Oct 2023 14:20:17 +0200 Message-ID: <20231002122021.231959-10-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=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_H4=0.001, RCVD_IN_MSPIKE_WL=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: 1696249370251100003 Content-Type: text/plain; charset="utf-8" Remove the one in control_save_page(). Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-12-quintela@redhat.com> --- migration/ram.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 9040d66e61..f2c5b07919 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1204,13 +1204,6 @@ static bool control_save_page(PageSearchStatus *pss,= RAMBlock *block, if (ret =3D=3D RAM_SAVE_CONTROL_DELAYED) { return true; } - - if (bytes_xmit > 0) { - stat64_add(&mig_stats.normal_pages, 1); - } else if (bytes_xmit =3D=3D 0) { - stat64_add(&mig_stats.zero_pages, 1); - } - return true; } =20 --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249340; cv=none; d=zohomail.com; s=zohoarc; b=lfw1cCY4i5FmZJ5AxAwzqQEwc7dm3ip6epLidFPYWi/sZOiWQcbJb7TmfJLh77okpgwlp/nn/Ec8GcB7ILEm9dcP5uCI8j/LL2tRf/PWmgj6pM8iBecKvED3LdX6HFSl11+veTOFJKEe1bXkEYQyXxWQlaiiA+Ddk1aBsSfigCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249340; 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=PWS5LrLcHz5R+dTNygMnoKVEUKYUzohSyNwE1tbwG3U=; b=BZ4OeGam5lGNbcAUsLF8yF2gJ3qUuC9YrbrQo5agb46/fsoRfffhs9EQSxk1nbWTqQNLItuDuyXXagDKgj2Tr4IS4Ag0Fkub2S2j4nADLXVSB7AZ2Ue7NGXRk4hiwFql1IoQfNfKTiJf4CTFiIUvCv1Tz4fqQfTQC2EgJjMlXlA= 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 1696249340573864.9753117973146; Mon, 2 Oct 2023 05:22:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHuu-0007Ot-4e; Mon, 02 Oct 2023 08:20:52 -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 1qnHus-0007O8-D4 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:50 -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 1qnHuq-0007Wc-Q5 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:50 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-138-uxP_X5jdPG-3rwa06sYi_g-1; Mon, 02 Oct 2023 08:20:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E9D6A3821340; Mon, 2 Oct 2023 12:20:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B3162156701; Mon, 2 Oct 2023 12:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249248; 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=PWS5LrLcHz5R+dTNygMnoKVEUKYUzohSyNwE1tbwG3U=; b=B9fkpPhZHV+tc4Y8mSA30qCQWepgQXFGqUyDyS6eBrzNnIIH6xIj1QBy5Q8qlUpDxrWCyf RYauEW2ZvjjT6o5gR2OC4jvBuZc7YiaZj7cvMsVr9UA4WNd1qYpxFxLpcY/WGSNSocUkxT yujNbJU9QLTbSjqAAQ+BtvTAzpXwBL0= X-MC-Unique: uxP_X5jdPG-3rwa06sYi_g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 10/13] migration/rdma: Remove QEMUFile parameter when not used Date: Mon, 2 Oct 2023 14:20:18 +0200 Message-ID: <20231002122021.231959-11-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249342364100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-13-quintela@redhat.com> --- migration/rdma.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 2a3c784328..9007261b5c 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2027,7 +2027,7 @@ static int qemu_rdma_exchange_recv(RDMAContext *rdma,= RDMAControlHeader *head, * If we're using dynamic registration on the dest-side, we have to * send a registration command first. */ -static int qemu_rdma_write_one(QEMUFile *f, RDMAContext *rdma, +static int qemu_rdma_write_one(RDMAContext *rdma, int current_index, uint64_t current_addr, uint64_t length) { @@ -2263,7 +2263,7 @@ retry: * We support sending out multiple chunks at the same time. * Not all of them need to get signaled in the completion queue. */ -static int qemu_rdma_write_flush(QEMUFile *f, RDMAContext *rdma) +static int qemu_rdma_write_flush(RDMAContext *rdma) { int ret; =20 @@ -2271,7 +2271,7 @@ static int qemu_rdma_write_flush(QEMUFile *f, RDMACon= text *rdma) return 0; } =20 - ret =3D qemu_rdma_write_one(f, rdma, + ret =3D qemu_rdma_write_one(rdma, rdma->current_index, rdma->current_addr, rdma->current_length); =20 if (ret < 0) { @@ -2344,7 +2344,7 @@ static inline int qemu_rdma_buffer_mergable(RDMAConte= xt *rdma, * and only require that a batch gets acknowledged in the completion * queue instead of each individual chunk. */ -static int qemu_rdma_write(QEMUFile *f, RDMAContext *rdma, +static int qemu_rdma_write(RDMAContext *rdma, uint64_t block_offset, uint64_t offset, uint64_t len) { @@ -2355,7 +2355,7 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext *= rdma, =20 /* If we cannot merge it, we flush the current buffer first. */ if (!qemu_rdma_buffer_mergable(rdma, current_addr, len)) { - ret =3D qemu_rdma_write_flush(f, rdma); + ret =3D qemu_rdma_write_flush(rdma); if (ret) { return ret; } @@ -2377,7 +2377,7 @@ static int qemu_rdma_write(QEMUFile *f, RDMAContext *= rdma, =20 /* flush it if buffer is too large */ if (rdma->current_length >=3D RDMA_MERGE_MAX) { - return qemu_rdma_write_flush(f, rdma); + return qemu_rdma_write_flush(rdma); } =20 return 0; @@ -2798,7 +2798,6 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, Error **errp) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(ioc); - QEMUFile *f =3D rioc->file; RDMAContext *rdma; int ret; ssize_t done =3D 0; @@ -2819,7 +2818,7 @@ static ssize_t qio_channel_rdma_writev(QIOChannel *io= c, * Push out any writes that * we're queued up for VM's ram. */ - ret =3D qemu_rdma_write_flush(f, rdma); + ret =3D qemu_rdma_write_flush(rdma); if (ret < 0) { rdma->error_state =3D ret; error_setg(errp, "qemu_rdma_write_flush returned %d", ret); @@ -2958,11 +2957,11 @@ static ssize_t qio_channel_rdma_readv(QIOChannel *i= oc, /* * Block until all the outstanding chunks have been delivered by the hardw= are. */ -static int qemu_rdma_drain_cq(QEMUFile *f, RDMAContext *rdma) +static int qemu_rdma_drain_cq(RDMAContext *rdma) { int ret; =20 - if (qemu_rdma_write_flush(f, rdma) < 0) { + if (qemu_rdma_write_flush(rdma) < 0) { return -EIO; } =20 @@ -3273,7 +3272,7 @@ static size_t qemu_rdma_save_page(QEMUFile *f, * is full, or the page doesn't belong to the current chunk, * an actual RDMA write will occur and a new chunk will be formed. */ - ret =3D qemu_rdma_write(f, rdma, block_offset, offset, size); + ret =3D qemu_rdma_write(rdma, block_offset, offset, size); if (ret < 0) { error_report("rdma migration: write error! %d", ret); goto err; @@ -3928,7 +3927,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, CHECK_ERROR_STATE(); =20 qemu_fflush(f); - ret =3D qemu_rdma_drain_cq(f, rdma); + ret =3D qemu_rdma_drain_cq(rdma); =20 if (ret < 0) { goto err; --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249347; cv=none; d=zohomail.com; s=zohoarc; b=gGF/9aZseL+a68EFpYiuaGBfzhgDENlOJ4Xsoql0dlKaSEYBb0gEgpvb2NtMoZC1xxsV1ib+Q2aQdha4HK9dK2pGGWBsfW65gQ/kgdpu7nWkrfOMOyoTJAP3eFwsqezUD/lC0gdWO7QfQ3Zj3fqk9q7VvVO/2hdJMf0exwdfg60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249347; 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=B0J+mijwmuuNWrRcnchQszr2EoxY+P4589QcyYVV0Sw=; b=UcQRtIb0h5Eb+CvRpAd1Ipqlo8pj0taJ959ZNFECsPjGz9kqFwlQdR63+LlsCVruUqBZpJV8TX4+WjfS4TsKmcbxQ7LXflwjqjgLDR2zoVBQ+mu2mlQnkMgyTSCem9Sv6N7kkiSwC5+2U5103lZOwJO10lXq3UmEt31Bee2q1ro= 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 1696249347177751.1148572364643; Mon, 2 Oct 2023 05:22:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHv5-0007UO-0J; Mon, 02 Oct 2023 08:21:03 -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 1qnHuy-0007QU-Cs for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:56 -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 1qnHuw-0007dT-G2 for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-vb3OFZVeO2OsAQS3zGa4mw-1; Mon, 02 Oct 2023 08:20:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA878811E8D; Mon, 2 Oct 2023 12:20:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 399262156702; Mon, 2 Oct 2023 12:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249253; 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=B0J+mijwmuuNWrRcnchQszr2EoxY+P4589QcyYVV0Sw=; b=EOA7V8R/1DQVBqO4WlSMPHJdZSeIKiB7xzYIY249nlQFauJ0MeOAFdo+UZMX2GD973xMsV suzTmJXycmislLFLb8bH8w96F38xETbie/tC1pmATANxE4TpEvASGlCkS5vMKeXLgYOisQ Bz7sFHStObOgLBGvNPZ8BCQ1DAVA3E4= X-MC-Unique: vb3OFZVeO2OsAQS3zGa4mw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 11/13] migration/rdma: Don't use imaginary transfers Date: Mon, 2 Oct 2023 14:20:19 +0200 Message-ID: <20231002122021.231959-12-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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=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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: 1696249348008100004 Content-Type: text/plain; charset="utf-8" RDMA protocol is completely asynchronous, so in qemu_rdma_save_page() they "invent" that a byte has been transferred. And then they call qemu_file_credit_transfer() and ram_transferred_add() with that byte. Just remove that calls as nothing has been sent. Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-14-quintela@redhat.com> --- migration/qemu-file.c | 5 +---- migration/ram.c | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 19c33c9985..e53ff2dd86 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -332,13 +332,10 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t = block_offset, =20 if (ret !=3D RAM_SAVE_CONTROL_DELAYED && ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - if (bytes_sent && *bytes_sent > 0) { - qemu_file_credit_transfer(f, *bytes_sent); - } else if (ret < 0) { + if (ret < 0) { qemu_file_set_error(f, ret); } } - return ret; } =20 diff --git a/migration/ram.c b/migration/ram.c index f2c5b07919..c6238f7a8b 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1197,7 +1197,6 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, } =20 if (bytes_xmit) { - ram_transferred_add(bytes_xmit); *pages =3D 1; } =20 --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249351; cv=none; d=zohomail.com; s=zohoarc; b=gwo9PGVU/iBa6VBSJdXNAD5KHB/VtvJe4xS/ib6aEHrWNvWYNTnILk4tvm9IqWenasYHUvqA1V6nj+ZA3r8DwUmu9DNhrjy2kZxAChki4BUDlKhCyLSLk+4YLnvZWz3llIDigGM7uKja6WvrL4Re6bA9amt0V/A2myRNUWNemZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249351; 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=1aBVwQQh/BSvVKIUO5gjWVvcpRaD7yNUL+Nu7c7CNSw=; b=XuZx+AaJ9Oa7Eqew0vvx+n0rP3QI7LWxu3SI3/dX9NFZx8ZdifdVZXkViiicCdl7kwcunL3eDIhPk9SzH8IXRmxoBXWDzWH/GcviDtvMu3witlx2gEhs0QE3XRoUY9mPSzIMlPES6ZFQ/a1oLesSASB7bO5B1rCl/7n8vJNnQi4= 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 1696249351369670.9617968640949; Mon, 2 Oct 2023 05:22:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHv0-0007SL-Kc; Mon, 02 Oct 2023 08:20:58 -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 1qnHux-0007Pq-6c for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:55 -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 1qnHuv-0007dH-NB for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:54 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-88-8yw2VVuMM1ypa16t_jKY8A-1; Mon, 02 Oct 2023 08:20:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C68BF29AB411; Mon, 2 Oct 2023 12:20:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A0872156A27; Mon, 2 Oct 2023 12:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249253; 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=1aBVwQQh/BSvVKIUO5gjWVvcpRaD7yNUL+Nu7c7CNSw=; b=Yl9lPKxrc4brwxPCtCuNhEAUkKKFx4vdik0MtFaZpiXSrD9d4fAQDAiNikbXPWnVsKxU1N Ux66tEtd9q6OEEjCtRAIXHzXkW8wTuvt1kn8npJByHXAKIR/cu2UMWbFA1ChnIZLi8UbsI Sh2Lf3NnMKOXNGZkUBUcw2IBay7gBhE= X-MC-Unique: 8yw2VVuMM1ypa16t_jKY8A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 12/13] migration: Remove unused qemu_file_credit_transfer() Date: Mon, 2 Oct 2023 14:20:20 +0200 Message-ID: <20231002122021.231959-13-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249352391100003 Content-Type: text/plain; charset="utf-8" After this change, nothing abuses QEMUFile to account for data transferrefd during migration. Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-15-quintela@redhat.com> --- migration/qemu-file.h | 8 -------- migration/qemu-file.c | 5 ----- 2 files changed, 13 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 47015f5201..57b00c8562 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -119,14 +119,6 @@ bool qemu_file_buffer_empty(QEMUFile *file); */ int coroutine_mixed_fn qemu_peek_byte(QEMUFile *f, int offset); void qemu_file_skip(QEMUFile *f, int size); -/* - * qemu_file_credit_transfer: - * - * Report on a number of bytes that have been transferred - * out of band from the main file object I/O methods. This - * accounting information tracks the total migration traffic. - */ -void qemu_file_credit_transfer(QEMUFile *f, size_t size); int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp); void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err); void qemu_file_set_error(QEMUFile *f, int ret); diff --git a/migration/qemu-file.c b/migration/qemu-file.c index e53ff2dd86..5c43fa34e7 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -397,11 +397,6 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEM= UFile *f) return len; } =20 -void qemu_file_credit_transfer(QEMUFile *f, size_t size) -{ - f->total_transferred +=3D size; -} - /** Closes the file * * Returns negative error value if any error happened on previous operatio= ns or --=20 2.41.0 From nobody Tue Feb 10 18:59:05 2026 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=1696249347; cv=none; d=zohomail.com; s=zohoarc; b=A11PeHNOBSeEKSf1GNA4HO46UCEDNBcM6PO2cXphD+M/BRtOcA7WdZq55ETgsySa9jXafcayWfXoa6v3dIvpC6qv8xMz1ZwxhNAjH225kmr1bUrBOmQc+TqrK0PTeaxRJULZKf4uIor+98q2kdzxO+B/TAyUdWjffUgaApJAc3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696249347; 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=qb+zkZpQvU5Tk7Zq0C6WCPbkDPM5+cat98QhtHWM+zI=; b=MDttpVh68DDt7eARjYqn5+cD1D3Th4+wNw3jXawlNEx/2E2gF2qu+kcZJOSIHX4A/ADt4KbHLaAWdtUkv4W2iOCqAZUfT54DYM2w5iPBtAS7GgJ/dnB4UECpQlk59/Kh5CCTrSn5OMG7G7TPPWQcXho24eLosS8H2wjjdUu+7tc= 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 1696249346746939.5633483060661; Mon, 2 Oct 2023 05:22:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qnHv0-0007Sx-SS; Mon, 02 Oct 2023 08:20:58 -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 1qnHux-0007Pz-TQ for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:56 -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 1qnHuw-0007dN-5i for qemu-devel@nongnu.org; Mon, 02 Oct 2023 08:20:55 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-192-ueEIq3G1Nfump2NSxYdVaA-1; Mon, 02 Oct 2023 08:20:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4F4829AB400; Mon, 2 Oct 2023 12:20:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16C772156701; Mon, 2 Oct 2023 12:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696249253; 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=qb+zkZpQvU5Tk7Zq0C6WCPbkDPM5+cat98QhtHWM+zI=; b=Szdb+NrOACcRvFVA1FD3Ln3f0KDRP61q08Mh0/Lgdgzh6xUGKnkvwUTvWeRSeXp1VHetrD QnWYGpralUch1fBXcbcnZpJl8NPsWHw6zJwiNVBt6xQjZtADasLgSR2FavfSvLUk8fI/Jy 29bK1axFKKaHuZ68FMs04dCzTlhzNVE= X-MC-Unique: ueEIq3G1Nfump2NSxYdVaA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Laurent Vivier , qemu-block@nongnu.org, Thomas Huth , Juan Quintela , Paolo Bonzini , Leonardo Bras , Fam Zheng , Stefan Hajnoczi Subject: [PULL 13/13] migration/rdma: Simplify the function that saves a page Date: Mon, 2 Oct 2023 14:20:21 +0200 Message-ID: <20231002122021.231959-14-quintela@redhat.com> In-Reply-To: <20231002122021.231959-1-quintela@redhat.com> References: <20231002122021.231959-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , 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: 1696249348323100007 Content-Type: text/plain; charset="utf-8" When we sent a page through QEMUFile hooks (RDMA) there are three posiblities: - We are not using RDMA. return RAM_SAVE_CONTROL_DELAYED and control_save_page() returns false to let anything else to proceed. - There is one error but we are using RDMA. Then we return a negative value, control_save_page() needs to return true. - Everything goes well and RDMA start the sent of the page asynchronously. It returns RAM_SAVE_CONTROL_DELAYED and we need to return 1 for ram_save_page_legacy. Clear? I know, I know, the interface is as bad as it gets. I think that now it is a bit clearer, but this needs to be done some other way. Reviewed-by: Leonardo Bras Signed-off-by: Juan Quintela Message-Id: <20230515195709.63843-16-quintela@redhat.com> --- migration/qemu-file.h | 14 ++++++-------- migration/qemu-file.c | 12 ++++++------ migration/ram.c | 10 +++------- migration/rdma.c | 19 +++---------------- 4 files changed, 18 insertions(+), 37 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 57b00c8562..03e718c264 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -49,11 +49,10 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t fla= gs, void *data); * This function allows override of where the RAM page * is saved (such as RDMA, for example.) */ -typedef size_t (QEMURamSaveFunc)(QEMUFile *f, - ram_addr_t block_offset, - ram_addr_t offset, - size_t size, - uint64_t *bytes_sent); +typedef int (QEMURamSaveFunc)(QEMUFile *f, + ram_addr_t block_offset, + ram_addr_t offset, + size_t size); =20 typedef struct QEMUFileHooks { QEMURamHookFunc *before_ram_iterate; @@ -142,9 +141,8 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags,= void *data); #define RAM_SAVE_CONTROL_NOT_SUPP -1000 #define RAM_SAVE_CONTROL_DELAYED -2000 =20 -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent); +int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size); QIOChannel *qemu_file_get_ioc(QEMUFile *file); =20 #endif diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 5c43fa34e7..5e8207dae4 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -322,14 +322,14 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flag= s, void *data) } } =20 -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent) +int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size) { if (f->hooks && f->hooks->save_page) { - int ret =3D f->hooks->save_page(f, block_offset, - offset, size, bytes_sent); - + int ret =3D f->hooks->save_page(f, block_offset, offset, size); + /* + * RAM_SAVE_CONTROL_* are negative values + */ if (ret !=3D RAM_SAVE_CONTROL_DELAYED && ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { if (ret < 0) { diff --git a/migration/ram.c b/migration/ram.c index c6238f7a8b..99cff591a3 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1186,23 +1186,19 @@ static int save_zero_page(PageSearchStatus *pss, QE= MUFile *f, RAMBlock *block, static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, ram_addr_t offset, int *pages) { - uint64_t bytes_xmit =3D 0; int ret; =20 - *pages =3D -1; ret =3D ram_control_save_page(pss->pss_channel, block->offset, offset, - TARGET_PAGE_SIZE, &bytes_xmit); + TARGET_PAGE_SIZE); if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { return false; } =20 - if (bytes_xmit) { - *pages =3D 1; - } - if (ret =3D=3D RAM_SAVE_CONTROL_DELAYED) { + *pages =3D 1; return true; } + *pages =3D ret; return true; } =20 diff --git a/migration/rdma.c b/migration/rdma.c index 9007261b5c..5748c9045b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3240,13 +3240,12 @@ qio_channel_rdma_shutdown(QIOChannel *ioc, * * @size : Number of bytes to transfer * - * @bytes_sent : User-specificed pointer to indicate how many bytes were + * @pages_sent : User-specificed pointer to indicate how many pages were * sent. Usually, this will not be more than a few bytes = of * the protocol because most transfers are sent asynchron= ously. */ -static size_t qemu_rdma_save_page(QEMUFile *f, - ram_addr_t block_offset, ram_addr_t offs= et, - size_t size, uint64_t *bytes_sent) +static int qemu_rdma_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; @@ -3278,18 +3277,6 @@ static size_t qemu_rdma_save_page(QEMUFile *f, goto err; } =20 - /* - * We always return 1 bytes because the RDMA - * protocol is completely asynchronous. We do not yet know - * whether an identified chunk is zero or not because we're - * waiting for other pages to potentially be merged with - * the current chunk. So, we have to call qemu_update_position() - * later on when the actual write occurs. - */ - if (bytes_sent) { - *bytes_sent =3D 1; - } - /* * Drain the Completion Queue if possible, but do not block, * just poll. --=20 2.41.0