From nobody Wed Feb 11 05:35:36 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=1686265102; cv=none; d=zohomail.com; s=zohoarc; b=GsGGk8v229nRBJqex+r8mDIkv11vt2l9ElRjFgZBXwP7iKuHrS6mbLboc7ADWReSk7Pyf1KrHXtbHxrgRt9rD+H/6awIgJjpka4bZHm0HcMoNbn+KD2gQGfLd2dKiKJ/JD0FmoaHUeIGHq1o3jhm+0rDeQId6eTMic/lDeJQ5BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686265102; 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=IpPspcELb1hx/8sTehXX9SuQS6bZnSSsN5qQL51kSA4=; b=F91qhZSm7AGnfkT+FyrqXtTvvkGBw3C7H3IAYZjhCbBJ6Vz7Yy+mAj1JxEOg3687CmX/ddHev9UBkznvbQ5RhD2No0nlPnWjsxOHBRom26AY+ct2gFO97LQUNrDWSesXeSDQ7//u5BurSINd0psFcrOeVKFdwiGPQAJwxvrpx0s= 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 168626510283676.63887146516811; Thu, 8 Jun 2023 15:58:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q7OSt-0004aj-1O; Thu, 08 Jun 2023 18:50: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 1q7OSq-0004RD-FZ for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:44 -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 1q7OSm-0005Dg-A3 for qemu-devel@nongnu.org; Thu, 08 Jun 2023 18:50:43 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-smAMUlBUMMOx8vpcP59Sdg-1; Thu, 08 Jun 2023 18:50:37 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9258B280BC58; Thu, 8 Jun 2023 22:50:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3134492B00; Thu, 8 Jun 2023 22:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686264639; 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=IpPspcELb1hx/8sTehXX9SuQS6bZnSSsN5qQL51kSA4=; b=EENOMXoKvG5q46Kt/FCz0CCDk/qWQjmBaVBwov7L8aoFujWmYve7y/4xQO0qeI8HFgeptn xNoIOf5gKSiG+whyOlek05SdaMkM7tbvUB6H4n5sDMMNFp4q/RKoobdieiZslQli5q4Vi8 /wfLrh6qNPAgy/B/P9iLmVe+0kkvgbU= X-MC-Unique: smAMUlBUMMOx8vpcP59Sdg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Laurent Vivier , Thomas Huth , Peter Xu , Peter Maydell , Juan Quintela , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Leonardo Bras Subject: [PATCH 26/42] migration-test: create guest_use_shmem() Date: Fri, 9 Jun 2023 00:49:27 +0200 Message-Id: <20230608224943.3877-27-quintela@redhat.com> In-Reply-To: <20230608224943.3877-1-quintela@redhat.com> References: <20230608224943.3877-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686265103741100001 Content-Type: text/plain; charset="utf-8" So now this is the same that everything else. Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 46 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 933000ad81..0130a00707 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -164,6 +164,8 @@ typedef struct { */ const gchar *name; gchar *serial_path; + gchar *shmem_opts; + gchar *shmem_path; unsigned start_address; unsigned end_address; } GuestState; @@ -217,6 +219,9 @@ static void guest_destroy(GuestState *vm) g_free(vm->kvm_opts); unlink(vm->serial_path); g_free(vm->serial_path); + g_free(vm->shmem_opts); + unlink(vm->shmem_path); + g_free(vm->shmem_path); g_free(vm); } =20 @@ -226,6 +231,18 @@ static void guest_use_dirty_ring(GuestState *vm) vm->kvm_opts =3D g_strdup(",dirty-ring-size=3D4096"); } =20 +static void guest_use_shmem(GuestState *vm) +{ + g_assert(vm->shmem_opts =3D=3D NULL); + g_assert(vm->shmem_path =3D=3D NULL); + + vm->shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); + vm->shmem_opts =3D g_strdup_printf( + "-object memory-backend-file,id=3Dmem0,size=3D%s" + ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", + vm->memory_size, vm->shmem_path); +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -621,7 +638,6 @@ typedef struct { * unconditionally, because it means the user would like to be verbose. */ bool hide_stderr; - bool use_shmem; /* only launch the target process */ bool only_target; const char *opts_source; @@ -720,8 +736,6 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr =3D NULL; - g_autofree char *shmem_opts =3D NULL; - g_autofree char *shmem_path =3D NULL; =20 got_src_stop =3D false; got_dst_resume =3D false; @@ -738,14 +752,6 @@ static void test_migrate_start(GuestState *from, Guest= State *to, #endif } =20 - if (args->use_shmem) { - shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); - shmem_opts =3D g_strdup_printf( - "-object memory-backend-file,id=3Dmem0,size=3D%s" - ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", - from->memory_size, shmem_path); - } - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name %s,debug-threads=3Don " "-m %s " @@ -757,7 +763,7 @@ static void test_migrate_start(GuestState *from, GuestS= tate *to, from->serial_path, from->arch_opts ? from->arch_opts : "", from->arch_source ? from->arch_source : "= ", - shmem_opts ? shmem_opts : "", + from->shmem_opts ? from->shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr ? ignore_stderr : ""); =20 @@ -781,21 +787,13 @@ static void test_migrate_start(GuestState *from, Gues= tState *to, uri, to->arch_opts ? to->arch_opts : "", to->arch_target ? to->arch_target : "", - shmem_opts ? shmem_opts : "", + to->shmem_opts ? to->shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr ? ignore_stderr : ""); to->qs =3D qtest_init(cmd_target); qtest_qmp_set_event_callback(to->qs, migrate_watch_for_resume, &got_dst_resume); - - /* - * Remove shmem file immediately to avoid memory leak in test failed c= ase. - * It's valid becase QEMU has already opened this file - */ - if (args->use_shmem) { - unlink(shmem_path); - } } =20 static void test_migrate_end(GuestState *from, GuestState *to, bool test_d= est) @@ -1637,10 +1635,10 @@ static void test_ignore_shared(void) g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); GuestState *from =3D guest_create("source"); GuestState *to =3D guest_create("target"); - MigrateStart args =3D { - .use_shmem =3D true - }; + MigrateStart args =3D { }; =20 + guest_use_shmem(from); + guest_use_shmem(to); test_migrate_start(from, to, uri, &args); =20 migrate_set_capability(from->qs, "x-ignore-shared", true); --=20 2.40.1