From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453148; cv=none; d=zohomail.com; s=zohoarc; b=RFPvJTx0tRCJgQdXVyMxnxjvNSG1NT+4ZUlwVTsrqb34r6ioTN6af3z0STQPI7gIBqRpQ6S7fnOBfVgGOP/Mjx0ewY+IJb4Y/fNBLw0Vz0zOuWlBFarVaUbC/kLeroW83KGgRoxLJ14pJBD68yYenzEfrasWGOV+Ht2C4cie8Yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453148; 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=86HMKLzBPnMyNMxPJsg/OhLOiHcaCIfAHsYhpv8Xq0Y=; b=Osv7jI47dPjZSHWgcaqGixdLYvMkP/2NLdHmQPws42Cmq14JljeoV0IFfDgfYHe45Vxp/PeoIRQLYZE3yWdQcPBzX3IrywBIURTIEmSJGBzjK9crnaYlIdHxRREXAs27z0XCAnC8cT8Iux2l7Hj77SZwG74ls7ryLNojSIhoWaU= 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 1687453148120806.1365518063292; Thu, 22 Jun 2023 09:59:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNb2-0006hx-Ls; Thu, 22 Jun 2023 12:55:48 -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 1qCNb1-0006he-KT for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:47 -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 1qCNb0-0008K3-1w for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:47 -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-13-1TNh00tGOL2zrYosaaWmTw-1; Thu, 22 Jun 2023 12:55:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 079E0384CC43; Thu, 22 Jun 2023 16:55:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B5AAC00049; Thu, 22 Jun 2023 16:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452945; 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=86HMKLzBPnMyNMxPJsg/OhLOiHcaCIfAHsYhpv8Xq0Y=; b=ZXySeJeWdsRmTt5pD2WHqYGvS3MtTbONmBk7astsrLW/+zxjId7L/soUD/nbHQjIk03P+G 9meJuLY3KpWjuMl5IfqCnOnExw1FChx/afIKFbrVQQyN7EqlRbpVsXYHg5D15IwJfvss/j 224lxaBe7RJBR6+jl8Hjzjh59J3FnvA= X-MC-Unique: 1TNh00tGOL2zrYosaaWmTw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Fabiano Rosas , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/30] migration/multifd: Rename threadinfo.c functions Date: Thu, 22 Jun 2023 18:54:58 +0200 Message-Id: <20230622165527.2417-2-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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=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: 1687453149871100005 From: Fabiano Rosas We're about to add more functions to this file so make it use the same coding style as the rest of the code. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu Message-Id: <20230607161306.31425-2-farosas@suse.de> Signed-off-by: Juan Quintela --- migration/threadinfo.h | 5 ++--- migration/migration.c | 4 ++-- migration/multifd.c | 4 ++-- migration/threadinfo.c | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/migration/threadinfo.h b/migration/threadinfo.h index 4d69423c0a..8aa6999d58 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -23,6 +23,5 @@ struct MigrationThread { QLIST_ENTRY(MigrationThread) node; }; =20 -MigrationThread *MigrationThreadAdd(const char *name, int thread_id); - -void MigrationThreadDel(MigrationThread *info); +MigrationThread *migration_threads_add(const char *name, int thread_id); +void migration_threads_remove(MigrationThread *info); diff --git a/migration/migration.c b/migration/migration.c index dc05c6f6ea..3a001dd042 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2922,7 +2922,7 @@ static void *migration_thread(void *opaque) MigThrError thr_error; bool urgent =3D false; =20 - thread =3D MigrationThreadAdd("live_migration", qemu_get_thread_id()); + thread =3D migration_threads_add("live_migration", qemu_get_thread_id(= )); =20 rcu_register_thread(); =20 @@ -3000,7 +3000,7 @@ static void *migration_thread(void *opaque) migration_iteration_finish(s); object_unref(OBJECT(s)); rcu_unregister_thread(); - MigrationThreadDel(thread); + migration_threads_remove(thread); return NULL; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index 3387d8277f..4c6cee6547 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -651,7 +651,7 @@ static void *multifd_send_thread(void *opaque) int ret =3D 0; bool use_zero_copy_send =3D migrate_zero_copy_send(); =20 - thread =3D MigrationThreadAdd(p->name, qemu_get_thread_id()); + thread =3D migration_threads_add(p->name, qemu_get_thread_id()); =20 trace_multifd_send_thread_start(p->id); rcu_register_thread(); @@ -767,7 +767,7 @@ out: qemu_mutex_unlock(&p->mutex); =20 rcu_unregister_thread(); - MigrationThreadDel(thread); + migration_threads_remove(thread); trace_multifd_send_thread_end(p->id, p->num_packets, p->total_normal_p= ages); =20 return NULL; diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 1de8b31855..3dd9b14ae6 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -14,7 +14,7 @@ =20 static QLIST_HEAD(, MigrationThread) migration_threads; =20 -MigrationThread *MigrationThreadAdd(const char *name, int thread_id) +MigrationThread *migration_threads_add(const char *name, int thread_id) { MigrationThread *thread =3D g_new0(MigrationThread, 1); thread->name =3D name; @@ -25,7 +25,7 @@ MigrationThread *MigrationThreadAdd(const char *name, int= thread_id) return thread; } =20 -void MigrationThreadDel(MigrationThread *thread) +void migration_threads_remove(MigrationThread *thread) { if (thread) { QLIST_REMOVE(thread, node); --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453055; cv=none; d=zohomail.com; s=zohoarc; b=JgVXg4AaNM6GtuSq457Z/0K4SWFYUJg+QTgYoNG3U9/cjNMsrnlBuiq/pyLTxJOflAFERaWt+CNGwnP40oX/7CIYTvo5w85N81JLaBo31mWgk2hs2Mjfk/1hYBmEiK+Hiod6RNzkpA4oIu+ZivHLcfnZVvoQ7rxvJoc2rVgQPUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453055; 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=jBYn87bb9I1f9KUD77mIUek71xIJdcNhfmFCCVLtKX8=; b=m+7qyKIX1US8iE04n9RP0qJUkq6zJeUDLPlAE7qdPih44frfNcTcQAyNeWeVy2JVAVEYsuPAxCyWKnCVPzxfjngDXCThH3l9eTg4tt31sElX7eUs9O/4jSmeMTMEhDDWSBdNh4q77Qj8aqrhsQPVtUvamYKLh4VkRPp2TO8IIBA= 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 1687453055130379.38662351360813; Thu, 22 Jun 2023 09:57:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNb2-0006hq-4u; Thu, 22 Jun 2023 12:55:48 -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 1qCNb0-0006h8-Sr for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:46 -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 1qCNay-0008Jk-Tx for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:46 -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-328-PL9Ge4drNBy9-erVImooSw-1; Thu, 22 Jun 2023 12:55:40 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CC003C3466F; Thu, 22 Jun 2023 16:55:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50E1DC00049; Thu, 22 Jun 2023 16:55:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452943; 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=jBYn87bb9I1f9KUD77mIUek71xIJdcNhfmFCCVLtKX8=; b=eneJ7VS1Tfa6ssHUQw/2wV/xWpeBz7RLti7RYInawkrUxflNosW5qj7KEhftrwwnwnanfS aBX95xqSNV/ot/XabBkvbS5B10hUSrpM+FhBBPnZ23n5yfE1xSadNp2EzfwzShn9jgHZaq kCbCQxiexTzuRnDFaZ3cDLiJk1e7iv8= X-MC-Unique: PL9Ge4drNBy9-erVImooSw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Fabiano Rosas Subject: [PULL 02/30] migration/multifd: Protect accesses to migration_threads Date: Thu, 22 Jun 2023 18:54:59 +0200 Message-Id: <20230622165527.2417-3-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453055468100001 Content-Type: text/plain; charset="utf-8" From: Fabiano Rosas This doubly linked list is common for all the multifd and migration threads so we need to avoid concurrent access. Add a mutex to protect the data from concurrent access. This fixes a crash when removing two MigrationThread objects from the list at the same time during cleanup of multifd threads. Fixes: 671326201d ("migration: Introduce interface query-migrationthreads") Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <20230607161306.31425-3-farosas@suse.de> Signed-off-by: Juan Quintela --- migration/threadinfo.h | 2 -- migration/threadinfo.c | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/migration/threadinfo.h b/migration/threadinfo.h index 8aa6999d58..2f356ff312 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -10,8 +10,6 @@ * See the COPYING file in the top-level directory. */ =20 -#include "qemu/queue.h" -#include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/qapi-commands-migration.h" =20 diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 3dd9b14ae6..262990dd75 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -10,23 +10,35 @@ * See the COPYING file in the top-level directory. */ =20 +#include "qemu/osdep.h" +#include "qemu/queue.h" +#include "qemu/lockable.h" #include "threadinfo.h" =20 +QemuMutex migration_threads_lock; static QLIST_HEAD(, MigrationThread) migration_threads; =20 +static void __attribute__((constructor)) migration_threads_init(void) +{ + qemu_mutex_init(&migration_threads_lock); +} + MigrationThread *migration_threads_add(const char *name, int thread_id) { MigrationThread *thread =3D g_new0(MigrationThread, 1); thread->name =3D name; thread->thread_id =3D thread_id; =20 - QLIST_INSERT_HEAD(&migration_threads, thread, node); + WITH_QEMU_LOCK_GUARD(&migration_threads_lock) { + QLIST_INSERT_HEAD(&migration_threads, thread, node); + } =20 return thread; } =20 void migration_threads_remove(MigrationThread *thread) { + QEMU_LOCK_GUARD(&migration_threads_lock); if (thread) { QLIST_REMOVE(thread, node); g_free(thread); @@ -39,6 +51,7 @@ MigrationThreadInfoList *qmp_query_migrationthreads(Error= **errp) MigrationThreadInfoList **tail =3D &head; MigrationThread *thread =3D NULL; =20 + QEMU_LOCK_GUARD(&migration_threads_lock); QLIST_FOREACH(thread, &migration_threads, node) { MigrationThreadInfo *info =3D g_new0(MigrationThreadInfo, 1); info->name =3D g_strdup(thread->name); --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687452997; cv=none; d=zohomail.com; s=zohoarc; b=XJ+L9rV3ss5YQ2fhatRZ9xpNGbcxmlFlQZU4AT4caGDsqW80Ep1OGefO3yL9KcIkbn9kjwqupsXB9a/t7JgIgAhF0OPbltG56uridmW5VGAZlQPmb7P1Xz15OraQiBy0f6c7S0l5DDPQsexrswUSrZJB6wLD7u+znfQmVxmkNvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687452997; 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=HG4qFamXiC/igNA1ujuSMBpaMOPN+6MrLExnJSf2DMU=; b=IqrhGVA2/h7hwN/XvjcBJESpr0hax+n/OzvsN5GxYewPouP5+XyOe/AmpdahwYrcUmNe5DxGLxgbEVRGwwYhtalW3r+JDbDpOsZS6pw2XA4q1CTL4sSeB8aR4fEBGJJqgBeb1ojMaoZdCGm9ch6FCMmbF1hBCqogBI4lynAJnuQ= 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 168745299722911.486629367301475; Thu, 22 Jun 2023 09:56:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbE-0006o4-Pg; Thu, 22 Jun 2023 12:56:00 -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 1qCNbC-0006nI-MW for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:58 -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 1qCNbB-0008MA-9X for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:58 -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-282-4IogEFTSNHu-WoLZz9gyxQ-1; Thu, 22 Jun 2023 12:55:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C4E697DE50; Thu, 22 Jun 2023 16:55:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id B68E6C00049; Thu, 22 Jun 2023 16:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452956; 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=HG4qFamXiC/igNA1ujuSMBpaMOPN+6MrLExnJSf2DMU=; b=Z+qrGgpG8H3iEfjN5jEFLBOkunHok1/hFYhtwdI/igmwbVneEd9TP/IBgHVws5NBxUWAdP 0jraIwG/zAqgXGWETYyPRzebKqINOPDtMP1RwrNbRRU2Vqgr/EJ6cJmKev9YfGlD/Xm9ud IFMr+r9X5uWhR+AaSY3Q+MrQf5TGofg= X-MC-Unique: 4IogEFTSNHu-WoLZz9gyxQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 03/30] softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" Date: Thu, 22 Jun 2023 18:55:00 +0200 Message-Id: <20230622165527.2417-4-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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: 1687452999446100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) dirty_rate paraemter of hmp command "set_vcpu_dirty_limit" is invalid if less than 0, so add parameter check for it. Note that this patch also delete the unsolicited help message and clean up the code. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-1@git.sr.ht> Signed-off-by: Juan Quintela --- softmmu/dirtylimit.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 015a9038d1..e80201097a 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -515,14 +515,15 @@ void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDi= ct *qdict) int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); Error *err =3D NULL; =20 + if (dirty_rate < 0) { + error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate); + goto out; + } + qmp_set_vcpu_dirty_limit(!!(cpu_index !=3D -1), cpu_index, dirty_rate,= &err); - if (err) { - hmp_handle_error(mon, err); - return; - } =20 - monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query " - "dirty limit for virtual CPU]\n"); +out: + hmp_handle_error(mon, err); } =20 static struct DirtyLimitInfo *dirtylimit_query_vcpu(int cpu_index) --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453270; cv=none; d=zohomail.com; s=zohoarc; b=FSiVSax6AJzFtvC3YY8xzm/34c0KfwMIJihIx07vu3Axp8IU115twhocShYJQ0c9s5z6Q8Bphngnl/xdWxPIRGbL5nSIMQneqEemRH+mYIbMaW8G2LlktO2xd7jDP+gQm3ZWY+5D2mar5L32g0H5fJZtbxNDAJqmiOlxdvHM3sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453270; 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=SFhrjM7lUKDquypfaK4yDGZL8ex0kV3B/YXIxLQaoVU=; b=mzB0K2M9EhDaGYAX5mGS3h16sNSIcCfBMcPtmRoCWsQLndzLW9kIIOETCvQQRFixq0vX3dHeZs1lPLm8yoXFkQBtflPvJ8kW353tcl0XR/1EqyqB72i4M/2wyeLj+Th35k2Z127B1fIXTFXLd1OlNOVWBYc6TWgJL2fP94hXdzA= 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 1687453268131400.94016679710626; Thu, 22 Jun 2023 10:01:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNb8-0006jU-LZ; Thu, 22 Jun 2023 12:55:54 -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 1qCNb7-0006j4-9G for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:53 -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 1qCNb5-0008Kp-E0 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:53 -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-462-FQ04DkEENiO-qZar7Jb3fw-1; Thu, 22 Jun 2023 12:55:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4195185A7A8; Thu, 22 Jun 2023 16:55:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91BD5C00049; Thu, 22 Jun 2023 16:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452950; 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=SFhrjM7lUKDquypfaK4yDGZL8ex0kV3B/YXIxLQaoVU=; b=Nz5N2IGWhLTJt6MkGuTXs3WSxWxCaCwlsIxBqIpkrj5vtdFlHcWwbHgCT1yvDMAnwYrsFq II5ep94uMHeAhRQwPXdee+oG4gY5Xl0GxC9ZvvdaQizrvwEqSTbN8lVBbm1k4yz8afQyC/ qPuvAbNw+jiezTKk1fLIMcOjOd4duGU= X-MC-Unique: FQ04DkEENiO-qZar7Jb3fw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 04/30] qapi/migration: Introduce x-vcpu-dirty-limit-period parameter Date: Thu, 22 Jun 2023 18:55:01 +0200 Message-Id: <20230622165527.2417-5-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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: 1687453272787100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce "x-vcpu-dirty-limit-period" migration experimental parameter, which is in the range of 1 to 1000ms and used to make dirtyrate calculation period configurable. Currently with the "x-vcpu-dirty-limit-period" varies, the total time of live migration changes, test results show the optimal value of "x-vcpu-dirty-limit-period" ranges from 500ms to 1000 ms. "x-vcpu-dirty-limit-period" should be made stable once it proves best value can not be determined with developer's experiments. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-2@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 34 +++++++++++++++++++++++++++------- migration/migration-hmp-cmds.c | 8 ++++++++ migration/options.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 5bb5ab82a0..67c26d9dea 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -779,9 +779,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # Since: 2.4 ## @@ -799,8 +804,9 @@ 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle', 'multifd-compression', - 'multifd-zlib-level' ,'multifd-zstd-level', - 'block-bitmap-mapping' ] } + 'multifd-zlib-level', 'multifd-zstd-level', + 'block-bitmap-mapping', + { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= } ] } =20 ## # @MigrateSetParameters: @@ -935,9 +941,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # TODO: either fuse back into MigrationParameters, or make # MigrationParameters members mandatory @@ -972,7 +983,9 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*x-vcpu-dirty-limit-period': { 'type': 'uint64', + 'features': [ 'unstable' ] } }= } =20 ## # @migrate-set-parameters: @@ -1127,9 +1140,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # Since: 2.4 ## @@ -1161,7 +1179,9 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*x-vcpu-dirty-limit-period': { 'type': 'uint64', + 'features': [ 'unstable' ] } }= } =20 ## # @query-migrate-parameters: diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9885d7c9f7..352e9ec716 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -364,6 +364,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) } } } + + monitor_printf(mon, "%s: %" PRIu64 " ms\n", + MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), + params->x_vcpu_dirty_limit_period); } =20 qapi_free_MigrationParameters(params); @@ -620,6 +624,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) error_setg(&err, "The block-bitmap-mapping parameter can only be s= et " "through QMP"); break; + case MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD: + p->has_x_vcpu_dirty_limit_period =3D true; + visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index b62ab30cd5..9743dea3ab 100644 --- a/migration/options.c +++ b/migration/options.c @@ -80,6 +80,8 @@ #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 +#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ + Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), @@ -163,6 +165,9 @@ Property migration_properties[] =3D { DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, + parameters.x_vcpu_dirty_limit_period, + DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -891,6 +896,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) s->parameters.block_bitmap_mapping); } =20 + params->has_x_vcpu_dirty_limit_period =3D true; + params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; + return params; } =20 @@ -923,6 +931,7 @@ void migrate_params_init(MigrationParameters *params) params->has_announce_max =3D true; params->has_announce_rounds =3D true; params->has_announce_step =3D true; + params->has_x_vcpu_dirty_limit_period =3D true; } =20 /* @@ -1083,6 +1092,15 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) } #endif =20 + if (params->has_x_vcpu_dirty_limit_period && + (params->x_vcpu_dirty_limit_period < 1 || + params->x_vcpu_dirty_limit_period > 1000)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "x-vcpu-dirty-limit-period", + "a value between 1 and 1000"); + return false; + } + return true; } =20 @@ -1182,6 +1200,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, dest->has_block_bitmap_mapping =3D true; dest->block_bitmap_mapping =3D params->block_bitmap_mapping; } + + if (params->has_x_vcpu_dirty_limit_period) { + dest->x_vcpu_dirty_limit_period =3D + params->x_vcpu_dirty_limit_period; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1300,6 +1323,11 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); } + + if (params->has_x_vcpu_dirty_limit_period) { + s->parameters.x_vcpu_dirty_limit_period =3D + params->x_vcpu_dirty_limit_period; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453028; cv=none; d=zohomail.com; s=zohoarc; b=JhHS7S4KHIT8YMCswJXxwy/t07FpD/YvW8j2vRnbbb5PJ7PdzvqsTvQi1G+EJhePC3QSmZjjQDLhJskXVnHovl7Eu2+r0y5jQJHyQFqgXfOstmo+njs1gxsiTt43EZJIvnraBBe8siXjeCtlMX1JxtnD4w7fqAKeGdYF0aa4TGE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453028; 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=/St81kdkZQJj4V+hE6fkLQyP9wya7SS1yQmgWrwVEkY=; b=JAX9ae+qEzim7S7x0lMwvagwf+c6f6FpZweS0/vZmVrb3d/uOe82BIow46hc+7b24+q3i/z1/2pFU32+zdGW28GuGns7LzZPZZo/uU8IdyP4oM8EgjfWu/CiPJfpCMMOjk82eCkGFjW17+dl0PYmsrr31gvNmzH5V15kVX0+A54= 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 168745302860685.62856000198144; Thu, 22 Jun 2023 09:57:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbG-0006qB-Qb; Thu, 22 Jun 2023 12:56:02 -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 1qCNbE-0006o7-SC for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:00 -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 1qCNbD-0008Mc-78 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:00 -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-263-1Vja24SJOsSaBR_cXmmPwQ-1; Thu, 22 Jun 2023 12:55:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 47DED102D002; Thu, 22 Jun 2023 16:55:43 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29C6FC00049; Thu, 22 Jun 2023 16:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452958; 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=/St81kdkZQJj4V+hE6fkLQyP9wya7SS1yQmgWrwVEkY=; b=g4/oblAUeQiZjR02RqoSZ5Zjfap7PXRbecM4EVUJ8nRuLiW0MwHToJED42NGGGWaDNKTs6 DwRhsrf6f5zZuQcw9/rT7No+Jf8XfdjJIbqQoD7FQIJXnJvi86StKvexEb3CMXkmNLTwI9 kfwu2k3xr27wJwtQwepQ6GdcF629JPk= X-MC-Unique: 1Vja24SJOsSaBR_cXmmPwQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 05/30] qapi/migration: Introduce vcpu-dirty-limit parameters Date: Thu, 22 Jun 2023 18:55:02 +0200 Message-Id: <20230622165527.2417-6-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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=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: 1687453029327100002 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce "vcpu-dirty-limit" migration parameter used to limit dirty page rate during live migration. "vcpu-dirty-limit" and "x-vcpu-dirty-limit-period" are two dirty-limit-related migration parameters, which can be set before and during live migration by qmp migrate-set-parameters. This two parameters are used to help implement the dirty page rate limit algo of migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-3@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 18 +++++++++++++++--- migration/migration-hmp-cmds.c | 8 ++++++++ migration/options.c | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 67c26d9dea..e7243c0c0d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -783,6 +783,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -806,7 +809,8 @@ 'max-cpu-throttle', 'multifd-compression', 'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', - { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= } ] } + { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, + 'vcpu-dirty-limit'] } =20 ## # @MigrateSetParameters: @@ -945,6 +949,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -985,7 +992,8 @@ '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] } }= } + 'features': [ 'unstable' ] }, + '*vcpu-dirty-limit': 'uint64'} } =20 ## # @migrate-set-parameters: @@ -1144,6 +1152,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -1181,7 +1192,8 @@ '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] } }= } + 'features': [ 'unstable' ] }, + '*vcpu-dirty-limit': 'uint64'} } =20 ## # @query-migrate-parameters: diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 352e9ec716..35e8020bbf 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -368,6 +368,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), params->x_vcpu_dirty_limit_period); + + monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", + MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), + params->vcpu_dirty_limit); } =20 qapi_free_MigrationParameters(params); @@ -628,6 +632,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_x_vcpu_dirty_limit_period =3D true; visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); break; + case MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT: + p->has_vcpu_dirty_limit =3D true; + visit_type_size(v, param, &p->vcpu_dirty_limit, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index 9743dea3ab..8acf5f1d2c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -81,6 +81,7 @@ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ +#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, @@ -168,6 +169,9 @@ Property migration_properties[] =3D { DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), + DEFINE_PROP_UINT64("vcpu-dirty-limit", MigrationState, + parameters.vcpu_dirty_limit, + DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -898,6 +902,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) =20 params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; + params->has_vcpu_dirty_limit =3D true; + params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; =20 return params; } @@ -932,6 +938,7 @@ void migrate_params_init(MigrationParameters *params) params->has_announce_rounds =3D true; params->has_announce_step =3D true; params->has_x_vcpu_dirty_limit_period =3D true; + params->has_vcpu_dirty_limit =3D true; } =20 /* @@ -1101,6 +1108,14 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (params->has_vcpu_dirty_limit && + (params->vcpu_dirty_limit < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "vcpu_dirty_limit", + "is invalid, it must greater then 1 MB/s"); + return false; + } + return true; } =20 @@ -1205,6 +1220,9 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, dest->x_vcpu_dirty_limit_period =3D params->x_vcpu_dirty_limit_period; } + if (params->has_vcpu_dirty_limit) { + dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1328,6 +1346,9 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) s->parameters.x_vcpu_dirty_limit_period =3D params->x_vcpu_dirty_limit_period; } + if (params->has_vcpu_dirty_limit) { + s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453035; cv=none; d=zohomail.com; s=zohoarc; b=Fr4OHzRLdssiJ7POzabDJw/GZYUzZyoTr7k/DJ4tcvSsEzFQ+DXjvDdS7VqOwQH4xJKZH9dl0KovaW/XkXXBTz5pCw4AyH+tSEBGX84N8JbVuhacqhvpq2ek9E3F4pSEvuZ67ZOKHb8ULxJUVdxMhCQ8C6V+7euv5fG/asTfwZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453035; 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=z59/a82Bfa6WMX6rUmg5X576HpdoipzIEroF6/VlrP4=; b=iwMVxaiv1IoBNdTDM+ybB/WULJ4dAmK6Fe9uTn1ChLCK01R38M1bIDS0NYajmizUlH4MixvZrAObg//+BywRDwxrArjI6TKYmZ3GTxA1ocIP2Jp7cUiWaV2HNIeYgO914tGfFHM2d0DPSECsl7a+VGY9o0UpGe/XMXymGVzD7Xk= 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 1687453035597104.81585226233597; Thu, 22 Jun 2023 09:57:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbB-0006mo-7J; Thu, 22 Jun 2023 12:55:57 -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 1qCNb9-0006kM-Es for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:55 -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 1qCNb7-0008LR-FE for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:55 -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-619-KATsDF7_M5SBKX1eTDv5AQ-1; Thu, 22 Jun 2023 12:55:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEAEF384CC54; Thu, 22 Jun 2023 16:55:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E22BC00049; Thu, 22 Jun 2023 16:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452952; 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=z59/a82Bfa6WMX6rUmg5X576HpdoipzIEroF6/VlrP4=; b=SR7gv/qwy6aPnH35Qkkqa2H7xY6jLKfCul1X/pvUDwjG718X3z5TIca9sJl/tG8O0kDT3v YbV+/VcfViVzHiwH40NqGb1WGOXJy9g+NwbQG5xhQyOmyKjFDAWGq+elvKqtZTxNPZPxBJ oaDmEasmxjFYCkmyThy5seWfRK7wY6w= X-MC-Unique: KATsDF7_M5SBKX1eTDv5AQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 06/30] migration: Introduce dirty-limit capability Date: Thu, 22 Jun 2023 18:55:03 +0200 Message-Id: <20230622165527.2417-7-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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=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: 1687453037338100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce migration dirty-limit capability, which can be turned on before live migration and limit dirty page rate durty live migration. Introduce migrate_dirty_limit function to help check if dirty-limit capability enabled during live migration. Meanwhile, refactor vcpu_dirty_rate_stat_collect so that period can be configured instead of hardcoded. dirty-limit capability is kind of like auto-converge but using dirty limit instead of traditional cpu-throttle to throttle guest down. To enable this feature, turn on the dirty-limit capability before live migration using migrate-set-capabilities, and set the parameters "x-vcpu-dirty-limit-period", "vcpu-dirty-limit" suitably to speed up convergence. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-4@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 12 +++++++++++- migration/options.h | 1 + migration/options.c | 23 +++++++++++++++++++++++ softmmu/dirtylimit.c | 18 ++++++++++++++---- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index e7243c0c0d..621e6604c6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -487,6 +487,16 @@ # and should not affect the correctness of postcopy migration. # (since 7.1) # +# @dirty-limit: If enabled, migration will use the dirty-limit algo to +# throttle down guest instead of auto-converge algo. +# Throttle algo only works when vCPU's dirtyrate greater +# than 'vcpu-dirty-limit', read processes in guest os +# aren't penalized any more, so this algo can improve +# performance of vCPU during live migration. This is an +# optional performance feature and should not affect the +# correctness of the existing auto-converge algo. +# (since 8.1) +# # Features: # # @unstable: Members @x-colo and @x-ignore-shared are experimental. @@ -502,7 +512,7 @@ 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] }, 'validate-uuid', 'background-snapshot', - 'zero-copy-send', 'postcopy-preempt'] } + 'zero-copy-send', 'postcopy-preempt', 'dirty-limit'] } =20 ## # @MigrationCapabilityStatus: diff --git a/migration/options.h b/migration/options.h index 45991af3c2..51964eff29 100644 --- a/migration/options.h +++ b/migration/options.h @@ -29,6 +29,7 @@ bool migrate_block(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); +bool migrate_dirty_limit(void); bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); diff --git a/migration/options.c b/migration/options.c index 8acf5f1d2c..ba1010e08b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -27,6 +27,7 @@ #include "qemu-file.h" #include "ram.h" #include "options.h" +#include "sysemu/kvm.h" =20 /* Maximum migrate downtime set to 2000 seconds */ #define MAX_MIGRATE_DOWNTIME_SECONDS 2000 @@ -194,6 +195,7 @@ Property migration_properties[] =3D { DEFINE_PROP_MIG_CAP("x-zero-copy-send", MIGRATION_CAPABILITY_ZERO_COPY_SEND), #endif + DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT), =20 DEFINE_PROP_END_OF_LIST(), }; @@ -240,6 +242,13 @@ bool migrate_dirty_bitmaps(void) return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 +bool migrate_dirty_limit(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT]; +} + bool migrate_events(void) { MigrationState *s =3D migrate_get_current(); @@ -556,6 +565,20 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) { + if (new_caps[MIGRATION_CAPABILITY_AUTO_CONVERGE]) { + error_setg(errp, "dirty-limit conflicts with auto-converge" + " either of then available currently"); + return false; + } + + if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { + error_setg(errp, "dirty-limit requires KVM with accelerator" + " property 'dirty-ring-size' set"); + return false; + } + } + return true; } =20 diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index e80201097a..942d876523 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -24,6 +24,9 @@ #include "hw/boards.h" #include "sysemu/kvm.h" #include "trace.h" +#include "migration/misc.h" +#include "migration/migration.h" +#include "migration/options.h" =20 /* * Dirtylimit stop working if dirty page rate error @@ -75,14 +78,21 @@ static bool dirtylimit_quit; =20 static void vcpu_dirty_rate_stat_collect(void) { + MigrationState *s =3D migrate_get_current(); VcpuStat stat; int i =3D 0; + int64_t period =3D DIRTYLIMIT_CALC_TIME_MS; + + if (migrate_dirty_limit() && + migration_is_active(s)) { + period =3D s->parameters.x_vcpu_dirty_limit_period; + } =20 /* calculate vcpu dirtyrate */ - vcpu_calculate_dirtyrate(DIRTYLIMIT_CALC_TIME_MS, - &stat, - GLOBAL_DIRTY_LIMIT, - false); + vcpu_calculate_dirtyrate(period, + &stat, + GLOBAL_DIRTY_LIMIT, + false); =20 for (i =3D 0; i < stat.nvcpu; i++) { vcpu_dirty_rate_stat->stat.rates[i].id =3D i; --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453088; cv=none; d=zohomail.com; s=zohoarc; b=ScEGMklTz0/yZxzUzeALrBy95FJXxR+7zPsFyNrquJUXMwPH8gJUFasHqI6KEGF/+/98ksyEpkcgAeYsI9wPu0JWSrxo+gf70V0yKZrAvu5GRfEEl27rO5M9HN7S1yYjajAriLV4qgWNOvDvTSdghl1u6D/MJyT3ksLqymXn8Wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453088; 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=fyGp5tlDuMU4pJ2uo8I+uUxA4U7xysFjVKjI1S8HWyk=; b=KKI737lwivN57EMEOXdtBks3SQwCSrcPnZQGjtaAkc2psRfClihCiH56wEMfB+vHrKmSci6xPK8C5jVMFM0FuazhC0dms6/tR4ENhIlzFO1NoLacoo8K5uB6sDwFUGYKud6Tw/n+RVLMevsnhD9W+YfgL7I/18h4+igcejwAMj4= 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 1687453087941101.07013558451467; Thu, 22 Jun 2023 09:58:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbC-0006nG-4u; Thu, 22 Jun 2023 12:55: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 1qCNbB-0006md-2D for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55:57 -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 1qCNb9-0008Lv-Kd for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:55: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-658-ij1VNqi8MqiHutNvcFFnmQ-1; Thu, 22 Jun 2023 12:55:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25D0D92CAE2; Thu, 22 Jun 2023 16:55:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03B5EC00049; Thu, 22 Jun 2023 16:55:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452955; 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=fyGp5tlDuMU4pJ2uo8I+uUxA4U7xysFjVKjI1S8HWyk=; b=Lfi7L39SN46wHvBBvHxDQ95/kaFVG2h4yvb9GlH1qvw7lm1jfXhAeYtBTSQ8P7v1tYkeIb rdEvY6YXLpyTP+7U+nmVk4PAEKBuwVxKFFx0xpK3gcKrOphehp7Tj/cZJvOezPufdzsysH l474J77w6doHbe2DCav3ZFbaDyyyIpc= X-MC-Unique: ij1VNqi8MqiHutNvcFFnmQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 07/30] migration: Refactor auto-converge capability logic Date: Thu, 22 Jun 2023 18:55:04 +0200 Message-Id: <20230622165527.2417-8-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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: 1687453089778100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) Check if block migration is running before throttling guest down in auto-converge way. Note that this modification is kind of like code clean, because block migration does not depend on auto-converge capability, so the order of checks can be adjusted. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-5@git.sr.ht> Signed-off-by: Juan Quintela --- migration/ram.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 5283a75f02..78746849b5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -995,7 +995,11 @@ static void migration_trigger_throttle(RAMState *rs) /* During block migration the auto-converge logic incorrectly detects * that ram migration makes no progress. Avoid this by disabling the * throttling logic during the bulk phase of block migration. */ - if (migrate_auto_converge() && !blk_mig_bulk_active()) { + if (blk_mig_bulk_active()) { + return; + } + + if (migrate_auto_converge()) { /* The following detection logic can be refined later. For now: Check to see if the ratio between dirtied bytes and the approx. amount of bytes that just got transferred since the last time --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453125; cv=none; d=zohomail.com; s=zohoarc; b=JA5J3jIdeOvRfhKAcK3h68OVKoMMZ6Tq8d8hRgEsOTKlrC+ZSNeysOvQsB6qHmDQg3VRBJYLBrgAbyLUMezISj9UC1dVZi72Hl+aD6CwiHiSK9vVYHU2k8Xcs8P5u92ZNsRv+hgblhJe27S2XX4RqnhpOQwzeaWPY4KZjrOct5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453125; 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=RyrBR3BrwHNOq+0v7TNtPuGcKpCABMgy95OqYLF5fYM=; b=YxVKBJyYJ/DSqlxrKSldeNObNvDBUGxKi7VNyYVeWjNp3ppbGcHkWZkvmS3olczCsC8QBmK5RNuU8sJMMXogYP+ayxkjfaV9E7kgBjTwBuvQ+obmZ6oxqOorrPmcudJLkWRjWdBViVIcWhj0Y5IbrB6Gc9l/PBL3Ii9UtBGkBgc= 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 1687453125752192.80173163908205; Thu, 22 Jun 2023 09:58:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbM-0006xT-Ed; Thu, 22 Jun 2023 12:56:08 -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 1qCNbK-0006ui-1T for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:06 -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 1qCNbI-0008OA-37 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:05 -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-417-FX-P6etcPWuway65CufAUg-1; Thu, 22 Jun 2023 12:55:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 88F7592CAE6; Thu, 22 Jun 2023 16:55:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B2F7C00049; Thu, 22 Jun 2023 16:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452963; 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=RyrBR3BrwHNOq+0v7TNtPuGcKpCABMgy95OqYLF5fYM=; b=Da29nzTHz/U+tgjElbqtIR4cO5deETy8aZOBde0XdZPql1peMOa4l7fbz1rYRzFPJEoer1 J/iJrzMXofGz1f1LnKhIJ9wUMB5ofjX2J709nKk3mxWHD+oaxSexCK4dzQdkJ05ht79rvz gx8yfiqQGFrSgogrH8v17kQ3ALUGtaQ= X-MC-Unique: FX-P6etcPWuway65CufAUg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 08/30] migration: Put the detection logic before auto-converge checking Date: Thu, 22 Jun 2023 18:55:05 +0200 Message-Id: <20230622165527.2417-9-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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=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: 1687453127767100007 From: Hyman Huang(=E9=BB=84=E5=8B=87) This commit is prepared for the implementation of dirty-limit convergence algo. The detection logic of throttling condition can apply to both auto-converge and dirty-limit algo, putting it's position before the checking logic for auto-converge feature. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Juan Quintela Message-ID: <168733225273.5845.15871826788879741674-6@git.sr.ht> Signed-off-by: Juan Quintela --- migration/ram.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 78746849b5..b6559f9312 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -999,17 +999,18 @@ static void migration_trigger_throttle(RAMState *rs) return; } =20 - if (migrate_auto_converge()) { - /* The following detection logic can be refined later. For now: - Check to see if the ratio between dirtied bytes and the approx. - amount of bytes that just got transferred since the last time - we were in this routine reaches the threshold. If that happens - twice, start or increase throttling. */ - - if ((bytes_dirty_period > bytes_dirty_threshold) && - (++rs->dirty_rate_high_cnt >=3D 2)) { + /* + * The following detection logic can be refined later. For now: + * Check to see if the ratio between dirtied bytes and the approx. + * amount of bytes that just got transferred since the last time + * we were in this routine reaches the threshold. If that happens + * twice, start or increase throttling. + */ + if ((bytes_dirty_period > bytes_dirty_threshold) && + (++rs->dirty_rate_high_cnt >=3D 2)) { + rs->dirty_rate_high_cnt =3D 0; + if (migrate_auto_converge()) { trace_migration_throttle(); - rs->dirty_rate_high_cnt =3D 0; mig_throttle_guest_down(bytes_dirty_period, bytes_dirty_threshold); } --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687452981; cv=none; d=zohomail.com; s=zohoarc; b=m7p62C/98HWvInoHufW6w6KesRkLCNeq8pVeEA4rrGbor7AY+i2lwYZOmrNAFmgJ3qw2Y+MNE91uflb8keqxUrumrfwqsBRDjhbBMLMswRXyDPZNkOXV4ayG6je5fTGbefsbqbekEnXBcglurYOvpycxQdLCKkj7lQeRpIAXFgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687452981; 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=sAl6CGYlK5QbshW2YIG60eMeK03wS4wFRYbi+G4BEtk=; b=gM+sFmuosizl5dbR0efnG1uNJCtjfbUOHlaXmz0/zgFPgZA6baI1CKWAwLIXwkWxGC0t8grHEuoAoCgezSIsB2+1jpXhQQOdX4xpw+wSTn88iKje3PsFcIMHe4YNnjXkJQdXY16B4YHiXbgzgrWQcjk0fHwxmzwpWpzDuNSOrE0= 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 1687452981517463.7737667868604; Thu, 22 Jun 2023 09:56:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbR-00070r-2O; Thu, 22 Jun 2023 12:56:13 -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 1qCNbP-0006zn-6g for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:11 -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 1qCNbN-0008Ov-4k for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:10 -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-573-zWn52uNbNNqtugqy_6vW1A-1; Thu, 22 Jun 2023 12:56:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1B5FF8A2E29; Thu, 22 Jun 2023 16:55:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE467C00049; Thu, 22 Jun 2023 16:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452967; 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=sAl6CGYlK5QbshW2YIG60eMeK03wS4wFRYbi+G4BEtk=; b=TLPRd6U43JgHYqWOxyn3I7Ji9jpyWwcJA2du/t0FdBL8BYaRQIYqy4EDz7D1rM7ao9tNS9 qJsIri4+Crr4UOswYdssEwElf8qqxt0vqNxeOyXCgAFwRyooa9HWKyyr5c23VrHplKFc0X kA+hioyvzQzFf5Zsyq1FJE3fJl8wcCw= X-MC-Unique: zWn52uNbNNqtugqy_6vW1A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 09/30] migration: Implement dirty-limit convergence algo Date: Thu, 22 Jun 2023 18:55:06 +0200 Message-Id: <20230622165527.2417-10-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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: 1687452983281100007 From: Hyman Huang(=E9=BB=84=E5=8B=87) Implement dirty-limit convergence algo for live migration, which is kind of like auto-converge algo but using dirty-limit instead of cpu throttle to make migration convergent. Enable dirty page limit if dirty_rate_high_cnt greater than 2 when dirty-limit capability enabled, Disable dirty-limit if migration be canceled. Note that "set_vcpu_dirty_limit", "cancel_vcpu_dirty_limit" commands are not allowed during dirty-limit live migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Message-ID: <168733225273.5845.15871826788879741674-7@git.sr.ht> Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 3 +++ migration/ram.c | 36 ++++++++++++++++++++++++++++++++++++ softmmu/dirtylimit.c | 29 +++++++++++++++++++++++++++++ migration/trace-events | 1 + 4 files changed, 69 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 3a001dd042..c101784dfa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -165,6 +165,9 @@ void migration_cancel(const Error *error) if (error) { migrate_set_error(current_migration, error); } + if (migrate_dirty_limit()) { + qmp_cancel_vcpu_dirty_limit(false, -1, NULL); + } migrate_fd_cancel(current_migration); } =20 diff --git a/migration/ram.c b/migration/ram.c index b6559f9312..8a86363216 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -46,6 +46,7 @@ #include "qapi/error.h" #include "qapi/qapi-types-migration.h" #include "qapi/qapi-events-migration.h" +#include "qapi/qapi-commands-migration.h" #include "qapi/qmp/qerror.h" #include "trace.h" #include "exec/ram_addr.h" @@ -59,6 +60,8 @@ #include "multifd.h" #include "sysemu/runstate.h" #include "options.h" +#include "sysemu/dirtylimit.h" +#include "sysemu/kvm.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ =20 @@ -984,6 +987,37 @@ static void migration_update_rates(RAMState *rs, int64= _t end_time) } } =20 +/* + * Enable dirty-limit to throttle down the guest + */ +static void migration_dirty_limit_guest(void) +{ + /* + * dirty page rate quota for all vCPUs fetched from + * migration parameter 'vcpu_dirty_limit' + */ + static int64_t quota_dirtyrate; + MigrationState *s =3D migrate_get_current(); + + /* + * If dirty limit already enabled and migration parameter + * vcpu-dirty-limit untouched. + */ + if (dirtylimit_in_service() && + quota_dirtyrate =3D=3D s->parameters.vcpu_dirty_limit) { + return; + } + + quota_dirtyrate =3D s->parameters.vcpu_dirty_limit; + + /* + * Set all vCPU a quota dirtyrate, note that the second + * parameter will be ignored if setting all vCPU for the vm + */ + qmp_set_vcpu_dirty_limit(false, -1, quota_dirtyrate, NULL); + trace_migration_dirty_limit_guest(quota_dirtyrate); +} + static void migration_trigger_throttle(RAMState *rs) { uint64_t threshold =3D migrate_throttle_trigger_threshold(); @@ -1013,6 +1047,8 @@ static void migration_trigger_throttle(RAMState *rs) trace_migration_throttle(); mig_throttle_guest_down(bytes_dirty_period, bytes_dirty_threshold); + } else if (migrate_dirty_limit()) { + migration_dirty_limit_guest(); } } } diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 942d876523..a6d854d161 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -436,6 +436,23 @@ static void dirtylimit_cleanup(void) dirtylimit_state_finalize(); } =20 +/* + * dirty page rate limit is not allowed to set if migration + * is running with dirty-limit capability enabled. + */ +static bool dirtylimit_is_allowed(void) +{ + MigrationState *ms =3D migrate_get_current(); + + if (migration_is_running(ms->state) && + (!qemu_thread_is_self(&ms->thread)) && + migrate_dirty_limit() && + dirtylimit_in_service()) { + return false; + } + return true; +} + void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index, int64_t cpu_index, Error **errp) @@ -449,6 +466,12 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index, return; } =20 + if (!dirtylimit_is_allowed()) { + error_setg(errp, "can't cancel dirty page rate limit while" + " migration is running"); + return; + } + if (!dirtylimit_in_service()) { return; } @@ -499,6 +522,12 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index, return; } =20 + if (!dirtylimit_is_allowed()) { + error_setg(errp, "can't set dirty page rate limit while" + " migration is running"); + return; + } + if (!dirty_rate) { qmp_cancel_vcpu_dirty_limit(has_cpu_index, cpu_index, errp); return; diff --git a/migration/trace-events b/migration/trace-events index cdaef7a1ea..c5cb280d95 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -91,6 +91,7 @@ migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, uns= igned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx" migration_throttle(void) "" +migration_dirty_limit_guest(int64_t dirtyrate) "guest dirty page rate limi= t %" PRIi64 " MB/s" ram_discard_range(const char *rbname, uint64_t start, size_t len) "%s: sta= rt: %" PRIx64 " %zx" ram_load_loop(const char *rbname, uint64_t addr, int flags, void *host) "%= s: addr: 0x%" PRIx64 " flags: 0x%x host: %p" ram_load_postcopy_loop(int channel, uint64_t addr, int flags) "chan=3D%d a= ddr=3D0x%" PRIx64 " flags=3D0x%x" --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453176; cv=none; d=zohomail.com; s=zohoarc; b=FVeD/Y/s3x5tM/sXEplHWLPMr8plDXko+4wmcc3bfRpdrgvMMU3cmBzil5ammNKxulDwmwlVQPh+C9TOscCMQHldPbjebiZgjrfTjdttY6cE1zUStAX5fg2rJATbKx8Fvhv4uXkHb23LWGXFAfln8vu1XikuUAOmB5wo5L9zLX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453176; 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=xLPFvVguyYCfE93p3FgpWBNVDhsA1lMk9JyYPcG1t7Y=; b=KtaN0SKYiFnMehqleZg/lIZhj1gNBh2LSlVU7FvxpNN/T6z7pqbKFfSIGgvFbu0t1Aj3M/gxjCiSwMNpXmlSWS6sQkvNYR8FNqFwjThSfjctDO5pL2Ocudk94CpBn48N6T6z0GqsvisULlIGba4ZR2CoSNs5EL8DMyKShysX5jM= 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 1687453176077632.6547809961717; Thu, 22 Jun 2023 09:59:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbo-0007wR-Uw; Thu, 22 Jun 2023 12:56:36 -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 1qCNbV-00071s-5J for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:24 -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 1qCNbS-0008SW-KM for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:16 -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-247-DVlsfEFFMJKbgHZHw5ZONQ-1; Thu, 22 Jun 2023 12:56:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 83BD9102D017; Thu, 22 Jun 2023 16:55:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6553DC00049; Thu, 22 Jun 2023 16:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452973; 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=xLPFvVguyYCfE93p3FgpWBNVDhsA1lMk9JyYPcG1t7Y=; b=Bowv0pweXt50xzm3fb1wgDDq4EnuQUJpsZjHes74TKTResOOYi1VFJ4WP3wfvoESv/4BVG GZ22eZt4dii53Vhc6G1HPzpxedz5GeEmdni8QWtV25xq4JEr4AQxQJmjuypkDNox6SnxJ9 5JRXv7qpFUEY1HQ490RpzRa6f5uWfbU= X-MC-Unique: DVlsfEFFMJKbgHZHw5ZONQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 10/30] migration: Extend query-migrate to provide dirty page limit info Date: Thu, 22 Jun 2023 18:55:07 +0200 Message-Id: <20230622165527.2417-11-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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_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=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: 1687453178128100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) Extend query-migrate to provide throttle time and estimated ring full time with dirty-limit capability enabled, through which we can observe if dirty limit take effect during live migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Reviewed-by: Juan Quintela Message-ID: <168733225273.5845.15871826788879741674-8@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 16 +++++++++++++- include/sysemu/dirtylimit.h | 2 ++ migration/migration-hmp-cmds.c | 10 +++++++++ migration/migration.c | 10 +++++++++ softmmu/dirtylimit.c | 39 ++++++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index 621e6604c6..e9b24fc410 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -250,6 +250,18 @@ # blocked. Present and non-empty when migration is blocked. # (since 6.0) # +# @dirty-limit-throttle-time-per-round: Maximum throttle time (in microsec= onds) of virtual +# CPUs each dirty ring full round, w= hich shows how +# MigrationCapability dirty-limit af= fects the guest +# during live migration. (since 8.1) +# +# @dirty-limit-ring-full-time: Estimated average dirty ring full time (in = microseconds) +# each dirty ring full round, note that the v= alue equals +# dirty ring memory size divided by average d= irty page rate +# of virtual CPU, which can be used to observ= e the average +# memory load of virtual CPU indirectly. Note= that zero +# means guest doesn't dirty memory (since 8.1) +# # Since: 0.14 ## { 'struct': 'MigrationInfo', @@ -267,7 +279,9 @@ '*postcopy-blocktime' : 'uint32', '*postcopy-vcpu-blocktime': ['uint32'], '*compression': 'CompressionStats', - '*socket-address': ['SocketAddress'] } } + '*socket-address': ['SocketAddress'], + '*dirty-limit-throttle-time-per-round': 'uint64', + '*dirty-limit-ring-full-time': 'uint64'} } =20 ## # @query-migrate: diff --git a/include/sysemu/dirtylimit.h b/include/sysemu/dirtylimit.h index 8d2c1f3a6b..d11ebbbbdb 100644 --- a/include/sysemu/dirtylimit.h +++ b/include/sysemu/dirtylimit.h @@ -34,4 +34,6 @@ void dirtylimit_set_vcpu(int cpu_index, void dirtylimit_set_all(uint64_t quota, bool enable); void dirtylimit_vcpu_execute(CPUState *cpu); +uint64_t dirtylimit_throttle_time_per_round(void); +uint64_t dirtylimit_ring_full_time(void); #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 35e8020bbf..c115ef2d23 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -190,6 +190,16 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) info->cpu_throttle_percentage); } =20 + if (info->has_dirty_limit_throttle_time_per_round) { + monitor_printf(mon, "dirty-limit throttle time: %" PRIu64 " us\n", + info->dirty_limit_throttle_time_per_round); + } + + if (info->has_dirty_limit_ring_full_time) { + monitor_printf(mon, "dirty-limit ring full time: %" PRIu64 " us\n", + info->dirty_limit_ring_full_time); + } + if (info->has_postcopy_blocktime) { monitor_printf(mon, "postcopy blocktime: %u\n", info->postcopy_blocktime); diff --git a/migration/migration.c b/migration/migration.c index c101784dfa..719f91573f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -64,6 +64,7 @@ #include "yank_functions.h" #include "sysemu/qtest.h" #include "options.h" +#include "sysemu/dirtylimit.h" =20 static NotifierList migration_state_notifiers =3D NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); @@ -968,6 +969,15 @@ static void populate_ram_info(MigrationInfo *info, Mig= rationState *s) info->ram->dirty_pages_rate =3D stat64_get(&mig_stats.dirty_pages_rate); } + + if (migrate_dirty_limit() && dirtylimit_in_service()) { + info->has_dirty_limit_throttle_time_per_round =3D true; + info->dirty_limit_throttle_time_per_round =3D + dirtylimit_throttle_time_per_round(); + + info->has_dirty_limit_ring_full_time =3D true; + info->dirty_limit_ring_full_time =3D dirtylimit_ring_full_time(); + } } =20 static void populate_disk_info(MigrationInfo *info) diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index a6d854d161..3c275ee55b 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -565,6 +565,45 @@ out: hmp_handle_error(mon, err); } =20 +/* Return the max throttle time of each virtual CPU */ +uint64_t dirtylimit_throttle_time_per_round(void) +{ + CPUState *cpu; + int64_t max =3D 0; + + CPU_FOREACH(cpu) { + if (cpu->throttle_us_per_full > max) { + max =3D cpu->throttle_us_per_full; + } + } + + return max; +} + +/* + * Estimate average dirty ring full time of each virtaul CPU. + * Return 0 if guest doesn't dirty memory. + */ +uint64_t dirtylimit_ring_full_time(void) +{ + CPUState *cpu; + uint64_t curr_rate =3D 0; + int nvcpus =3D 0; + + CPU_FOREACH(cpu) { + if (cpu->running) { + nvcpus++; + curr_rate +=3D vcpu_dirty_rate_get(cpu->cpu_index); + } + } + + if (!curr_rate || !nvcpus) { + return 0; + } + + return dirtylimit_dirty_ring_full_time(curr_rate / nvcpus); +} + static struct DirtyLimitInfo *dirtylimit_query_vcpu(int cpu_index) { DirtyLimitInfo *info =3D NULL; --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453148; cv=none; d=zohomail.com; s=zohoarc; b=l1xfwDaX/ycZ/QyZufvFWGvaoWNQ0G07e4N8fn1oMiL3PMFEgDm96rYbOH/tgM2b4vmL/cWoqhtvXphmZB9myCDdHIDUBBOe+QWiN1awqT37G73dLrtTHcGBzr9NKjMHske7GKxm54Tlzm1QJ9Cvy4cC0/Q8uYLwgKiYXvi95d8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453148; 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=aN5p6skIIBhg7piCxOmYKQra9+UkFG8YnJMzg4pOE2E=; b=f4k6GQltV7D+nUwa1R3MkFE7TAXwLGZNC/jku7AkelooyxcUK3r2jIFtZgEHHLSQeu0d0V7rd9+fYlCZNcy0WaaTTIzcMeRhUbO1uTTrOmScnR5SOl0OpBsylampBa++TXsjiDj/aQYbgG7liv/oJraISzJEZk6RyRaxvAOleeI= 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 1687453148173269.65408529148874; Thu, 22 Jun 2023 09:59:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbn-0007mG-MP; Thu, 22 Jun 2023 12:56:35 -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 1qCNbR-00071Y-TC for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:17 -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 1qCNbQ-0008RG-FH for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:13 -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-452-MW4OE9RJOB-BPy3XNrDTLQ-1; Thu, 22 Jun 2023 12:56:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C7611102D008; Thu, 22 Jun 2023 16:55:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC0EBC00049; Thu, 22 Jun 2023 16:55:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452971; 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=aN5p6skIIBhg7piCxOmYKQra9+UkFG8YnJMzg4pOE2E=; b=cwyEAoYpBY+9lZ5eDoskSAsl3EjX5vMOdDgr0JA7VyJXl/8RaAYqhSUmwqYUwV651Beqnx 8U3pyi60mOqa9pF1w8I+SGdKgZX5R3e+iEY7GD8mlwGHKtXsJSstRosyWo78X3EXS65Pg4 M1qe0kD2UmJvLI6fme8ml2XS3QzSWW0= X-MC-Unique: MW4OE9RJOB-BPy3XNrDTLQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 11/30] migration-test: Be consistent for ppc Date: Thu, 22 Jun 2023 18:55:08 +0200 Message-Id: <20230622165527.2417-12-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453150104100007 Content-Type: text/plain; charset="utf-8" It makes no sense that we don't have the same configuration on both sides. Reviewed-by: Laurent Vivier Message-ID: <20230608224943.3877-2-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b0c355bbd9..c5e0c69c6b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -646,7 +646,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup(""); + arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "virt,gic-version=3Dmax"; --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453082; cv=none; d=zohomail.com; s=zohoarc; b=DDOsxac+k7EVJ4UNjF3Iubj8YMygm3B2sG8iz7LHozSHQU7ZQ6fDZkQBfEFhtGxylT/pK4tl64TTieVhI/MF1i2S+lqzHbAXGqkVRZKCojDRd1ZaJ3G3yL8vDYqTXO0NL2r0abATy2MwEY4LWWne/3yh94712oV9Y2Z/yq9hDqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453082; 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=/rFBgHJ4D0rnee2hOZE5ZKRJbpKxVo1csNBW02wMzHA=; b=lG8QxwjUfGxWF55X/ksXPRzWhSkdMUbkXeJRHYP37pLWHBkGFN1NG1yTLeTZ9EWZNEvknq/SFmTVqsNCFwBfFunqdiF8Ka/+qideuhMpQcEHf6k5ncb0aSP68Z+8hv5mnAbjCeje0GphWPBXN8PdpMyUVAk435u7EUR8oveep2c= 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 1687453082484904.5034701854179; Thu, 22 Jun 2023 09:58:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbd-0007Cb-KN; Thu, 22 Jun 2023 12:56:25 -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 1qCNbQ-00070Z-Mo for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:12 -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 1qCNbO-0008Qq-VA for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:12 -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-446-zAcXwVBxMAyUUGCP30EiDg-1; Thu, 22 Jun 2023 12:56:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1616C1C07259; Thu, 22 Jun 2023 16:56:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C622C00049; Thu, 22 Jun 2023 16:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452970; 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=/rFBgHJ4D0rnee2hOZE5ZKRJbpKxVo1csNBW02wMzHA=; b=dZ7HeW7RwY3vIttEWcHfqFkRJTBgabc1npScKdTUfsycQ0OtfOfHD+pgSMmTKEYkLHXmll ajFbzhR3M8ZhIhmILXsTJ81eVoevc9j0Yz6aRBvPg0+I56nDyrZiYYztBEp0txEo2eqHAV TRtl6T0pRqe7uiSUv2HXB2kvvcr0gF0= X-MC-Unique: zAcXwVBxMAyUUGCP30EiDg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 12/30] migration-test: Make machine_opts regular with other options Date: Thu, 22 Jun 2023 18:55:09 +0200 Message-Id: <20230622165527.2417-13-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453083598100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Signed-off-by: Juan Quintela Message-ID: <20230608224943.3877-5-quintela@redhat.com> --- tests/qtest/migration-test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index c5e0c69c6b..79157d600b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -637,7 +637,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "vsmt=3D8"; + machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -649,7 +649,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_opts =3D "virt,gic-version=3Dmax"; + machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; arch_source =3D g_strdup_printf("-cpu max " "-kernel %s", @@ -689,14 +689,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, arch_source, shmem_opts, @@ -709,7 +708,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -717,7 +716,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_target, shmem_opts, --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453194; cv=none; d=zohomail.com; s=zohoarc; b=Tie0thDWfjdVrbhHp4TktS5zCU8uBwBL61PC7PWxJxZljEcEE+efTNO+8Eh7ffA6MwNo5ZcLAD0rmynDidVIrFpaCek0rh5UDrtl2MI+hTlACauym0d+XOeggCoeiC/EFGDqlPqkypzNwdcJA6/ILzHpEdudrdyOK5K/UeEaFnY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453194; 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=feGe41Lqr8pFN4/LkM2/RlPwQoWrtkla/6guXH2f0IA=; b=Pir1WpWcxooghRETI1Qg0I2phpAza25/6VciAjCvfz1RdJU2ah72wOQVarbys3xGgX/Wxv0Xl4K38cpekYmBF4yTB4SOv2k5dd/vN9UvLVLs+Wf/CB7L4MuHBpSLDiwXHeLuj4CvTddaSwB+cZYyQVBSZu5pgjkm3tSwAVXaFJQ= 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 1687453194873492.1354870776812; Thu, 22 Jun 2023 09:59:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbo-0007uo-OL; Thu, 22 Jun 2023 12:56:36 -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 1qCNbV-00071r-4i for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:24 -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 1qCNbS-0008SR-KH for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-385-CztxM3pdMPeL5_uFpzt2jw-1; Thu, 22 Jun 2023 12:56:10 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE354385557B; Thu, 22 Jun 2023 16:56:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A53EC478C6; Thu, 22 Jun 2023 16:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452973; 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=feGe41Lqr8pFN4/LkM2/RlPwQoWrtkla/6guXH2f0IA=; b=GQOdjlM2ftcO5GKgs6Bukodjaz0b9C6BO0NqNMAaOTSMhyTbqMP1KlvoZuHzI9QsxLBor+ QhJOAvOtm91ej9DpU1O6xOQgo6yZDl8DFH/o9AQusiSzDK5DkMFXXx5dR72j9cz05w7jdB 8Sfq+wjq8AD79aPbhiwmuFEdvGerwxo= X-MC-Unique: CztxM3pdMPeL5_uFpzt2jw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 13/30] migration-test: Create arch_opts Date: Thu, 22 Jun 2023 18:55:10 +0200 Message-Id: <20230622165527.2417-14-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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=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: 1687453196448100003 Content-Type: text/plain; charset="utf-8" This will contain the options needed for both source and target. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-6-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 79157d600b..4d8542f5c7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -600,6 +600,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, { g_autofree gchar *arch_source =3D NULL; g_autofree gchar *arch_target =3D NULL; + /* options for source and target */ + g_autofree gchar *arch_opts =3D NULL; g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr; @@ -625,15 +627,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, assert(sizeof(x86_bootsect) =3D=3D 512); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-drive file=3D%s,format=3Draw", b= ootpath); - arch_target =3D g_strdup(arch_source); + 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)); memory_size =3D "128M"; - arch_source =3D g_strdup_printf("-bios %s", bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { @@ -641,20 +641,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; - arch_source =3D g_strdup_printf("-nodefaults " - "-prom-env 'use-nvramrc?=3Dtrue' -pr= om-env " + arch_source =3D g_strdup_printf("-prom-env 'use-nvramrc?=3Dtrue' -= prom-env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup("-nodefaults"); + arch_opts =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-cpu max " - "-kernel %s", - bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -693,12 +689,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, - arch_source, shmem_opts, + arch_opts ? arch_opts : "", + arch_source ? arch_source : "", + shmem_opts, args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { @@ -713,12 +711,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-m %s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, - arch_target, shmem_opts, + arch_opts ? arch_opts : "", + arch_target ? arch_target : "", + shmem_opts, args->opts_target ? args->opts_target : "= ", ignore_stderr); *to =3D qtest_init(cmd_target); --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453121; cv=none; d=zohomail.com; s=zohoarc; b=lSNc8nkntvvneYFvnkyTtiFJB7j1yjsUGFP3MgUJo120WOef9E6jNLvTxHiP5cM3hpMHRt17MVcWmYhscMojz6rR3YSUfBg1+rz/F3anLKg2cVnLaustv+F57ezfyFv2YW3TISVPEjrvw95R4Lmf3c94W8auGgteMOjSoriFAOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453121; 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=iYb2bfBZQLdDFilPwdrDveJpKsXXGmfNbdXXcf46b9s=; b=KxMpTsmGS5SQZJXpdFbonaieyGrhGWaEksfyxBQQdqqDBa/V+nieO3TQUFE4jg0DAuZueSJOsp2GMWDlM1S1YpWht8J7X0AMpWQgToF5RXaTKO90sUj+7x2UpMElpFo0PLDI46ylVAR2k/vKIqsEAg7GESU8djOwJgdZA4S8aq0= 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 1687453121949824.4479226335565; Thu, 22 Jun 2023 09:58:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbm-0007dv-Pz; Thu, 22 Jun 2023 12:56:34 -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 1qCNbZ-00076u-5Z for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:24 -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 1qCNbV-00006O-AI for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:19 -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-552-KvVqjwr1OhC59yRTeoo6Sg-1; Thu, 22 Jun 2023 12:56:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E3551C0725C; Thu, 22 Jun 2023 16:56:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F3EAC1ED97; Thu, 22 Jun 2023 16:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452976; 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=iYb2bfBZQLdDFilPwdrDveJpKsXXGmfNbdXXcf46b9s=; b=QE40XaO8QBkF7HDKHnJdxKECvsXWjbqlJjGsiWTVTkAU3ywHBJauXBbk/DWeyr2vbT3mQk gnbl3XQyT5gTUQ8+sey2SgSm1ALvfV9zbESAMeOVEvZwu4xqV0ANWZFHWM66eTboboq83F txogdTpodtP7dZUMBX5TqrJPOqwK8Cw= X-MC-Unique: KvVqjwr1OhC59yRTeoo6Sg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 14/30] migration-test: machine_opts is really arch specific Date: Thu, 22 Jun 2023 18:55:11 +0200 Message-Id: <20230622165527.2417-15-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453124016100003 Content-Type: text/plain; charset="utf-8" And it needs to be in both source and target, so put it on arch_opts. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-7-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 4d8542f5c7..fc3337b7bb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -609,7 +609,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *arch =3D qtest_get_arch(); - const char *machine_opts =3D NULL; const char *memory_size; =20 if (args->use_shmem) { @@ -637,7 +636,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -645,12 +643,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_opts =3D g_strdup("-nodefaults"); + 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)); - machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); + 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; =20 @@ -685,14 +683,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + 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" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -706,7 +703,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -714,7 +711,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453285; cv=none; d=zohomail.com; s=zohoarc; b=mBplysdiyWMYZff+zNzIi6paxcp9ffsQ8UWrT9Hen5dH3BVDkeRHspdfPGGxFaYU2xXIDG+p7F2xEl/BF4/U3labmlooCurYkc6Ry+sCqi3iQ7kk1gHgNqH0LxLnYUdvfzggdyJW6u23XdPoxjwABnZeOidak53sWeP1p1PyZok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453285; 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=th20gtdJz46Y/hIxKBOSCv22ZBhWyLLDoPcKqHvRxik=; b=QEm38a/VzsBGhSBnGMcpGiEPiZTEHXZfNHigd8RVEw5oPcnOt/prBhZ1KryIQNuc3Vp20Jk8LqxZweM73HNlo0gLqKOEUO9yBblfpGhpbNgG8eBYCXKwL/rQDMkE7hvjJSu3EOi3m4LYt2erKaRbfvQ9Bwdbp1KiaWs/S9dzfaw= 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 168745328538398.95411457378714; Thu, 22 Jun 2023 10:01:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbr-0008Ck-71; Thu, 22 Jun 2023 12:56: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 1qCNbZ-00076v-5x for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:24 -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 1qCNbV-00006R-VK for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:19 -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-353-ZdczKNW8Pmu0aGO8-AyU7Q-1; Thu, 22 Jun 2023 12:56:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8241F80123E; Thu, 22 Jun 2023 16:56:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8698EC00049; Thu, 22 Jun 2023 16:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452976; 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=th20gtdJz46Y/hIxKBOSCv22ZBhWyLLDoPcKqHvRxik=; b=P8t7F6PYXitzc4ADijcXPOQg6PKaOhVZ6oJ4hyCLo5KhOkp3pKIlwN1mcI+nr/pR7o4EQ9 EfSau/JzwZ7SVm6Xkv1jJ/HsiRNBdqJnlVp62cetvTtAABeDRTPGZomHowrKs+NGZ2hYl3 nDNSA0XnNCxQZ4129y/MjN8/2w0ZpnU= X-MC-Unique: ZdczKNW8Pmu0aGO8-AyU7Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 15/30] migration-test: Create kvm_opts Date: Thu, 22 Jun 2023 18:55:12 +0200 Message-Id: <20230622165527.2417-16-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1687453287474100007 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 fc3337b7bb..40967fdffc 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -608,6 +608,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 @@ -683,13 +684,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 : "", @@ -709,8 +713,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453165; cv=none; d=zohomail.com; s=zohoarc; b=UuigP9FAItwInSmmE7Ito0/XCSeLp06K3m/H3GGw0MPPA2S2XuWRV/oieCOSeF7HHtzKFgYI1TtuDPPYU/1B0utfASlQqU6Sh/a6vr2oKBASySKvk8vmuC7EPKKJgTtePTTPfI7YGLLOJALNAMvrq6FUh/H2AnAVtIP6b8v+v0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453165; 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=YK9i97oj+2hte8T79ySuooH4bjMECzrsr80F+WOLqQw=; b=mtIXemGj3Ima6ygnXWiLaFoBfHuSRqHlVM1rCgokkFIc5fr7B1xjnKhX7XTrP2EkUOJaE5gX58nVDG05S93Y0I1RDLpzB/zUD+OrRLFsp/kxPi9i4dt5b5x3fsjvgrQYOadKpQbKhw/CXtabfpJ3N8e7l1rDQQcL528zqjekQuo= 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 168745316582495.21690030122181; Thu, 22 Jun 2023 09:59:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbm-0007aa-II; Thu, 22 Jun 2023 12:56:34 -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 1qCNbW-00073g-Pr for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:24 -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 1qCNbU-00005k-T4 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:18 -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-549-4u1AMr0BNCOP-46Ed05kFw-1; Thu, 22 Jun 2023 12:56:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2EDE1C07259; Thu, 22 Jun 2023 16:56:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id C747DC00049; Thu, 22 Jun 2023 16:56:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452976; 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=YK9i97oj+2hte8T79ySuooH4bjMECzrsr80F+WOLqQw=; b=hasat683RbFu2gLsFIlov9jC7Nu2nFRB7lGXyWK6+Ceeai4wyVBGPa1vdok9NN/aTQgcC4 UPG9mnMrwKWIRleKnoWHO6eyEdMs0Cwh3MMMZy7a0O2bKBh1PQCdo8txTmZ12Gx/7eZXOP RF85uUW0n1/3Yw9UQwblI6SraHMmzR0= X-MC-Unique: 4u1AMr0BNCOP-46Ed05kFw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 16/30] migration-test: bootpath is the same for all tests and for all archs Date: Thu, 22 Jun 2023 18:55:13 +0200 Message-Id: <20230622165527.2417-17-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1687453166190100001 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 40967fdffc..0f80dbfe80 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -102,6 +102,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. @@ -110,7 +111,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 @@ -605,7 +606,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; @@ -621,17 +621,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; @@ -646,7 +645,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); @@ -764,7 +763,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"); @@ -2493,12 +2491,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 " @@ -2514,7 +2510,6 @@ static QTestState *dirtylimit_start_vm(void) static void dirtylimit_stop_vm(QTestState *vm) { qtest_quit(vm); - cleanup("bootsect"); cleanup("vm_serial"); } =20 @@ -2676,6 +2671,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 @@ -2819,6 +2815,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453020; cv=none; d=zohomail.com; s=zohoarc; b=aWPLFui4sGdJLCOyUkpkCKpWC9Up7fSGaIJX9UzazoLGwTSh6sMLvZnoXJgGZpxK73qI2jUkkFb7QZYuiIOa33D9XUIzwTOnwEfrtSr3qxBWIlbEYpEiWEdPF1Pdz2MSzA9CgPK0P0VZ0V3oTncrHeJD07vYvscyQeMVZOCpGh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453020; 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=n9TdMXOS+qjL+W5lDCLJHlY6rS6mQChhMxpnTbMZipM=; b=iEob4zeha+64MG4uQObL/jn1SebleEEdPtUEgh775RfUncE6D89nwTpqEFEHmLvk78xcA4uBj4uwL4C8S+lKNBaGB8RmpOvI+BIso+qpwLTv8KP7PpOB1I5wrpF9YuGwAwmrSwy6Tgzwfze/skBohc9+8b7OSZcvOCgGYIw3mQE= 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 1687453020950318.8566185931136; Thu, 22 Jun 2023 09:57:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbq-00086H-8A; Thu, 22 Jun 2023 12:56: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 1qCNbd-0007EA-Of for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:25 -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 1qCNba-0000Fg-Ul for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:25 -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-672-jH5AR_XRPTCKCCrGuGYPEg-1; Thu, 22 Jun 2023 12:56:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A5C197DE40; Thu, 22 Jun 2023 16:56:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34F06C00049; Thu, 22 Jun 2023 16:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452981; 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=n9TdMXOS+qjL+W5lDCLJHlY6rS6mQChhMxpnTbMZipM=; b=YyvOaBnaM7gtTai64qGhZxr/1MbU2KANi6lEL+HPUVJ677ER7pNFRV/fa/aLdVXv6c0gGH N3UzcOJDisItm/Z3KmpirEJkFiZd7JDpksjLCDj7P5KbEqJZH+4/iOd4lKp2LqawNKh3J0 J+FBxiy8ERrIQvcf3gogVUfu9wP3Z48= X-MC-Unique: jH5AR_XRPTCKCCrGuGYPEg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 17/30] migration-test: Add bootfile_create/delete() functions Date: Thu, 22 Jun 2023 18:55:14 +0200 Message-Id: <20230622165527.2417-18-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453021260100001 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 0f80dbfe80..eb6a11e758 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -111,14 +111,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 @@ -622,15 +655,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; @@ -645,14 +674,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(); } @@ -2493,9 +2519,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 " @@ -2671,7 +2694,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 @@ -2815,8 +2838,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453285; cv=none; d=zohomail.com; s=zohoarc; b=NRORncG/C43c4UIjZracYZ5vL9n1NovLc95XluWW4C6MYGna6hTD5rSdUotu+x4au+sd9t0O06RYdwXEUKAyHLLGJhk1+eeCt2/dB45PV3mLWXC2HBZCMkXSf7SaAUeBaL9/ygSs71NrqJPL5sh2CzA/kTnx7SLvFUZLr93xMwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453285; 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=7C3D7iNM38aBqhdSOuDcDrLT+thUiibV5CBvo7gXvFw=; b=IGfq/FiOR/nqTr4mb7ougWGLmaW8IXfhw0w8+gjAog3KUoGiT+NFz0FCSDRjQ+e47k31Kpal5Qh/U1IhgAOSSOTJXY4j7lm5o0cqzeWI+kD3TwZ0QBYaeDoss9pDCEdO5cQAUmPcSTO+hn8KenrtKcY7B5lpTsb8On5C1od02t0= 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 1687453285385962.0826055117645; Thu, 22 Jun 2023 10:01:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbs-0008Hm-Hn; Thu, 22 Jun 2023 12:56:40 -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 1qCNbn-0007jF-7D for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:35 -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 1qCNbl-0000Oa-OW for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:34 -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-3-TW97NzHePjKFYi9ABMCGEw-1; Thu, 22 Jun 2023 12:56:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DFAD3858F1E; Thu, 22 Jun 2023 16:56:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA2DDC00049; Thu, 22 Jun 2023 16:56:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452990; 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=7C3D7iNM38aBqhdSOuDcDrLT+thUiibV5CBvo7gXvFw=; b=LBftldKkjARjRHLckAJPf/rGpNu7iW9knAfWByqeb7fMY32h8uIJPAZFKCbo2mdVbV18x9 n0AlSp5ncSAH6CAGdmrSSpMBKkODYppaFY8g9NzS5J8kEpQkfDdZRV+k2RHQBl68T/pAB9 HwzyTL0mT5X/Fgz1PYTQWMRtWIF/WE4= X-MC-Unique: TW97NzHePjKFYi9ABMCGEw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 18/30] migration-test: dirtylimit checks for x86_64 arch before Date: Thu, 22 Jun 2023 18:55:15 +0200 Message-Id: <20230622165527.2417-19-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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=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: 1687453286844100001 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 eb6a11e758..fbe9db23cf 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2515,10 +2515,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453286; cv=none; d=zohomail.com; s=zohoarc; b=imr1X37wl1SNnGCfErBa28B4KGD3AkZNMiBl1KhTEpaDifCrJQn6EP6Epy2ZB/BbSgY6Aao3nljTiRRm1WkTFlvBFCMajNk9P807qFw+TYJ4hun7qOwydZ9+UYH51jhrutvYgAB1s2uHhA3LYdKqlLGh2Z5s1rh7FNuwivpzfCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453286; 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=MmcLRgrHOXaQzZw9raGtmDm+zXG9T1TLit/qoCr/HQ4=; b=nbHqgGiAG8UAxz0slDN5x/ivosUXFxP9i8V63VXLrQj60cVnOtDBkXKnk/LjoNNsQ7ycUDnq6AOwkrPsBTlK6z+6xQTafKjssXhG+iptsNK94fYywPhgPucOc5tQw+F6xwfsMHm5uAgCTWVYalbfKZA0LuUHokhZzDPs0XBswp8= 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 1687453286083813.7874126749787; Thu, 22 Jun 2023 10:01:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbr-000869-6p; Thu, 22 Jun 2023 12:56: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 1qCNbf-0007MV-0Y for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:27 -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 1qCNbd-0000Li-Gz for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:26 -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-220-FAC7wJhqMdqvU35nwG7YGg-1; Thu, 22 Jun 2023 12:56:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2A58C3C34673; Thu, 22 Jun 2023 16:56:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31098C478C6; Thu, 22 Jun 2023 16:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452984; 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=MmcLRgrHOXaQzZw9raGtmDm+zXG9T1TLit/qoCr/HQ4=; b=Wf9e8W+xQ5hwXDMrd33XPIuuZHcNrLP6kL3F2wZvHO/qYnfcbbe4PAygW4wcLPTUKmZj6e cZL979DOn+ARfZroM93uAkvgMKYGXoH/gNfcVJtqQ/Gz6sXgwQy+wXNrBhQGrh4nLFC+E0 qlVOFYgIpFxz6vt0v4Y1bGx8h0+04Aw= X-MC-Unique: FAC7wJhqMdqvU35nwG7YGg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 19/30] migration-test: simplify shmem_opts handling Date: Thu, 22 Jun 2023 18:55:16 +0200 Message-Id: <20230622165527.2417-20-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1687453287825100009 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 fbe9db23cf..e3e7d54216 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -704,9 +704,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) { @@ -722,7 +719,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) { @@ -742,7 +739,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453212; cv=none; d=zohomail.com; s=zohoarc; b=X2BWzZS4xx7XpGRYh3V65khrBMMcnM+fg3OgWKxYoIFy8SG1EOkR7qRmM8T3XucISCyYujGqNsxmU0ql6jVDALA7xVKrmHsFnbTkeIKjEI6M8EK42ZVM8KQYoccsLOr4RJd1PqfQ0RZ4xgsIXYazx4jES/ZqQvZI8tNSdOHaTIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453212; 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=xjS5IFyqEQRzXQMIiiaiZNodUT68pKhyOYOrJhA5FC4=; b=RxWJTd5FKtAd/agXQ/BoHyrkbiyzSrRlQAEys1+iH5qSiDwwGacCMemuQPX7qs53O9glBLJPZ4tCwn+c5Dxii9j3/5fkXRHaMjbW4REfcuJFBp5VE7qFjhrNpIMRDFZSMzCbhCkGDg8fpGKT4IZg9n6KY5GBNZt8VhRP4/n14PI= 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 1687453212573720.5067470132809; Thu, 22 Jun 2023 10:00:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbv-0008PD-Rg; Thu, 22 Jun 2023 12:56: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 1qCNbu-0008L5-0g for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:42 -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 1qCNbs-00011e-FP for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:41 -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-452-u6rf5DTqP0eiKvSVNmJQxA-1; Thu, 22 Jun 2023 12:56:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5784185A7A7; Thu, 22 Jun 2023 16:56:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F61CC00049; Thu, 22 Jun 2023 16:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452999; 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=xjS5IFyqEQRzXQMIiiaiZNodUT68pKhyOYOrJhA5FC4=; b=RPKJ1zdod6gRs2jP3NhhebF+iFGPwO7U1wX6htPh+WHvDrS7gDShXWwHzqp0yACWAiz8CS YF9yjvtfrxGujebFYo6vEq6ec0FLsOnyL9kLFrEuCD1IKwwZ5vd/f2CzPCj4wTrvuUlacg mDuRdiAqWS890wENslGI3NtqT7FQJkc= X-MC-Unique: u6rf5DTqP0eiKvSVNmJQxA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Tejus GK Subject: [PULL 20/30] migration: Update error description whenever migration fails Date: Thu, 22 Jun 2023 18:55:17 +0200 Message-Id: <20230622165527.2417-21-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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=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: 1687453214630100007 From: Tejus GK There are places in migration.c where the migration is marked failed with MIGRATION_STATUS_FAILED, but the failure reason is never updated. Hence libvirt doesn't know why the migration failed when it queries for it. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Tejus GK Message-ID: <20230621130940.178659-2-tejus.gk@nutanix.com> Signed-off-by: Juan Quintela --- migration/migration.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 719f91573f..e6bff2e848 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1679,7 +1679,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); } - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", + error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); @@ -2066,7 +2066,7 @@ migration_wait_main_channel(MigrationState *ms) * Switch from normal iteration to postcopy * Returns non-0 on error */ -static int postcopy_start(MigrationState *ms) +static int postcopy_start(MigrationState *ms, Error **errp) { int ret; QIOChannelBuffer *bioc; @@ -2176,7 +2176,7 @@ static int postcopy_start(MigrationState *ms) */ ret =3D qemu_file_get_error(ms->to_dst_file); if (ret) { - error_report("postcopy_start: Migration stream errored (pre packag= e)"); + error_setg(errp, "postcopy_start: Migration stream errored (pre pa= ckage)"); goto fail_closefb; } =20 @@ -2213,7 +2213,7 @@ static int postcopy_start(MigrationState *ms) =20 ret =3D qemu_file_get_error(ms->to_dst_file); if (ret) { - error_report("postcopy_start: Migration stream errored"); + error_setg(errp, "postcopy_start: Migration stream errored"); migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, MIGRATION_STATUS_FAILED); } @@ -2720,6 +2720,7 @@ typedef enum { static MigIterateState migration_iteration_run(MigrationState *s) { uint64_t must_precopy, can_postcopy; + Error *local_err =3D NULL; bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; =20 qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy); @@ -2742,8 +2743,9 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) /* Still a significant amount to transfer */ if (!in_postcopy && must_precopy <=3D s->threshold_size && qatomic_read(&s->start_postcopy)) { - if (postcopy_start(s)) { - error_report("%s: postcopy failed to start", __func__); + if (postcopy_start(s, &local_err)) { + migrate_set_error(s, local_err); + error_report_err(local_err); } return MIG_ITERATE_SKIP; } @@ -3234,8 +3236,10 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) */ if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s, !resume)) { - error_report("Unable to open return-path for postcopy"); + error_setg(&local_err, "Unable to open return-path for postcop= y"); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); + migrate_set_error(s, local_err); + error_report_err(local_err); migrate_fd_cleanup(s); return; } @@ -3259,6 +3263,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) } =20 if (multifd_save_setup(&local_err) !=3D 0) { + migrate_set_error(s, local_err); error_report_err(local_err); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453286; cv=none; d=zohomail.com; s=zohoarc; b=MBJXuIVPbqyymMqaQT5SBvGKCJWAEPqtbkGH9wSdPRHc+kjMNFZmOQVvvEPxU7WmJvzee2jWbIKGXEv7O1CtP60cHqWw/ybcriHE6HtSuGn9d31DGeXtAos1/vy8T0eXX+CkFwSHUqwTUZac0cVk4AIL5Ldbvp0G8qHRSP+sIcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453286; 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=+awb8Ji3T505TOieoRQAmSUv6J3qZyUkjLapOert/H8=; b=a8iMcjEpf9jmmfs9eDhP88OPcuH9x1OyjeQcohXW10ClUSVTMFZqB/UvI2De70fSEK3FwF5c853nqeYKOefSQtyTgYHDCfPjoBzYV5QlNvp94+79dxIiHMJpEoE+IPkQK3U+YsT9Xazq5aEjX+kyGyE5gNI/4mcsOzU2YDm1w9s= 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 1687453286173252.15701434750645; Thu, 22 Jun 2023 10:01:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbs-0008Fs-1L; Thu, 22 Jun 2023 12:56:40 -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 1qCNbi-0007Uk-Bx for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:33 -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 1qCNbg-0000No-PS for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:30 -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-494-Lu5zQ-yUPgqvM6rysQHcaQ-1; Thu, 22 Jun 2023 12:56:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F2C82834771; Thu, 22 Jun 2023 16:56:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEC83C00049; Thu, 22 Jun 2023 16:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452988; 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=+awb8Ji3T505TOieoRQAmSUv6J3qZyUkjLapOert/H8=; b=b2XuLjulsK7QtwVv6C94oB9HPmUWAJ53uSyIWREN7JwarXU6URyHGjxsyhTEmEKgeyVUEf JSq6VJGWX6/KyuZl5xWK/6EU/FiUZWcB0DrK6JkDkRT/R6ivKffKrskAGdJHHM+Ua1MEBM EJ2cTX+MBGSMThyZn65hKewscpWCt0U= X-MC-Unique: Lu5zQ-yUPgqvM6rysQHcaQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Tejus GK , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 21/30] migration: Refactor repeated call of yank_unregister_instance Date: Thu, 22 Jun 2023 18:55:18 +0200 Message-Id: <20230622165527.2417-22-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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: 1687453287837100010 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 e6bff2e848..7a4ba2e846 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1676,15 +1676,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 (!(has_resume && resume)) { - 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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453037; cv=none; d=zohomail.com; s=zohoarc; b=nYFrcEqr0RFCQ5VnzxWDkCbJj7NHAaEE1D+Ryv9LqaPvhCGJmlJ4r2WZuFMK1YTCpQNCpyHjAaxBqToY4x7+aKkTemLYdEZuNmrWre3q8owkFJLqHfk5gi49PxE2DkAzvFy8loIpC0j4JdTFUZOQ0ub3ehUg1fTKu/W8xDcZAnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453037; 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=0gMyyCvbpsUehX6Zf+T7AT27ZzZCy47tR02v1S53cos=; b=LRlxSu7yjmNLgtVYExqjv7teJV+KSzvq0ZJttBZA5Q/RCPl/4o2WoAmjBFmygqMFldpfPGR5/Z7Gi+XAt+dT3SO/Rhf735sOgcanv1Fsnmwjz9dcFwCnPf4/Q97sO2gKOjxNc8h9TpDFU2jXuqvzy1FMyH7JZipsD1i8sN32Q8o= 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 1687453037809828.6299608655761; Thu, 22 Jun 2023 09:57:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbx-0008Vx-Gn; Thu, 22 Jun 2023 12:56:45 -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 1qCNbw-0008Ru-Hb for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56: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 1qCNbu-00013w-Uy for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:44 -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-537-8B9k0geFN16RE5wQzpKDeA-1; Thu, 22 Jun 2023 12:56:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5AC18A2E28; Thu, 22 Jun 2023 16:56:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 847D6C478C6; Thu, 22 Jun 2023 16:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453002; 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=0gMyyCvbpsUehX6Zf+T7AT27ZzZCy47tR02v1S53cos=; b=BTZSEciD231xvx+G3FxejT/uetpGM/HqUXzCiDE3T4cSy25p/LXRABF5Gycyu3XpuCfHcP nw6jxoSOFrF9V2KBieripmc3+EKwBDAGRttSPJH2GKpKXrKicm0M4eIipItTDNbeNcizhT B4T3HZel4Lo0BNP9r/+SmIcorgllYJw= X-MC-Unique: 8B9k0geFN16RE5wQzpKDeA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Wei Wang Subject: [PULL 22/30] migration: enforce multifd and postcopy preempt to be set before incoming Date: Thu, 22 Jun 2023 18:55:19 +0200 Message-Id: <20230622165527.2417-23-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1687453039334100005 Content-Type: text/plain; charset="utf-8" From: Wei Wang qemu_start_incoming_migration needs to check the number of multifd channels or postcopy ram channels to configure the backlog parameter (i.e. the maximum length to which the queue of pending connections for sockfd may grow) of listen(). So enforce the usage of postcopy-preempt and multifd as below: - need to use "-incoming defer" on the destination; and - set_capability and set_parameter need to be done before migrate_incoming Otherwise, disable the use of the features and report error messages to remind users to adjust the commands. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-ID: <20230606101910.20456-2-wei.w.wang@intel.com> Signed-off-by: Juan Quintela Acked-by: Juan Quintela --- migration/options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/migration/options.c b/migration/options.c index ba1010e08b..c072c2fab7 100644 --- a/migration/options.c +++ b/migration/options.c @@ -433,6 +433,11 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snap= shot, MIGRATION_CAPABILITY_VALIDATE_UUID, MIGRATION_CAPABILITY_ZERO_COPY_SEND); =20 +static bool migrate_incoming_started(void) +{ + return !!migration_incoming_get_current()->transport_data; +} + /** * @migration_caps_check - check capability compatibility * @@ -556,6 +561,12 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Postcopy preempt not compatible with compres= s"); return false; } + + if (migrate_incoming_started()) { + error_setg(errp, + "Postcopy preempt must be set before incoming start= s"); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { @@ -563,6 +574,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Multifd is not compatible with compress"); return false; } + if (migrate_incoming_started()) { + error_setg(errp, "Multifd must be set before incoming starts"); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) { --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453043; cv=none; d=zohomail.com; s=zohoarc; b=WyzA5ZevVTtK/0c3jsqlS8ueyl0t9IKnfl9ebsFNB8fkt2AzlMdmxx2gtp0l8AcyFQ6P+s5EtmJCppEAKbKbvx8p2k+BCz8zSHX1eaxQvjzF2AlBOeIpc/w6j5rG4HMzkM8wfQoCPLi87Q6HIkgrztuKZE6tJlXyGPyG+/obsjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453043; 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=v7DDKZ7/PjEB7antlRml4N9xhWEjy/6LhCVbjHExS7o=; b=WvddATce4+jqhm6mTnphbf2pPE7+oUsrr3R6A87yvOW3GShGAYgkonH/ZOLDKAgQGiHsWtuZVbSI1+7GltLtz/UKn0L/ULigvHFE5oKEizkLRidupmA/oMyGPhGflRVvclB6cicdeJk0z0v5fK1tOgtc9FZkR4fuqe3RtXyBYuU= 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 1687453043464597.1223356063389; Thu, 22 Jun 2023 09:57:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNbt-0008Jz-5i; Thu, 22 Jun 2023 12:56: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 1qCNbn-0007nV-O3 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:35 -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 1qCNbm-0000f6-2R for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:35 -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-367-UFJZf_aqMlKACkjINUjV7g-1; Thu, 22 Jun 2023 12:56:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E37B3385556C; Thu, 22 Jun 2023 16:56:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5D6C00049; Thu, 22 Jun 2023 16:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687452993; 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=v7DDKZ7/PjEB7antlRml4N9xhWEjy/6LhCVbjHExS7o=; b=di6tQINHWSKMmXuzHmm7c3Qt75smGHndfmtKeKQF03A3WLxgOuFbqlEQo4WDKVBmhgQ4b4 M5KoIfWkevz/EclaqXNBpGeThW4w14AlPbRvMTNmUlsxk4skcdXFKgUQCAuYT0HaycFUPU 9lCj8NSnQe8VqlcjjXDpx8Q98Q1oXi0= X-MC-Unique: UFJZf_aqMlKACkjINUjV7g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Wei Wang Subject: [PULL 23/30] qtest/migration-tests.c: use "-incoming defer" for postcopy tests Date: Thu, 22 Jun 2023 18:55:20 +0200 Message-Id: <20230622165527.2417-24-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1687453045386100005 Content-Type: text/plain; charset="utf-8" From: Wei Wang The Postcopy preempt capability is expected to be set before incoming starts, so change the postcopy tests to start with deferred incoming and call migrate-incoming after the cap has been set. Why the existing tests (without this patch) didn't fail? There could be two reasons: 1) "backlog" specifies the number of pending connections. As long as the server accepts the connections faster than the clients side connecting, connection will succeed. For the preempt test, it uses only 2 channels, so very likely to not have pending connections. 2) per my tests (on kernel 6.2), the number of pending connections allowed is actually "backlog + 1", which is 2 in this case. That said, the implementation of socket_start_incoming_migration_internal expects "migrate defer" to be used, and for safety, change the test to work with the expected usage. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-ID: <20230606101910.20456-3-wei.w.wang@intel.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e3e7d54216..c694685923 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1161,10 +1161,10 @@ static int migrate_postcopy_prepare(QTestState **fr= om_ptr, QTestState **to_ptr, MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + g_autofree char *uri =3D NULL; QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args->start)) { + if (test_migrate_start(&from, &to, "defer", &args->start)) { return -1; } =20 @@ -1183,9 +1183,13 @@ static int migrate_postcopy_prepare(QTestState **fro= m_ptr, =20 migrate_ensure_non_converge(from); =20 + qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 + uri =3D migrate_get_socket_address(to, "socket-address"); migrate_qmp(from, uri, "{}"); =20 wait_for_migration_pass(from); --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453209; cv=none; d=zohomail.com; s=zohoarc; b=KzxMCbc3VR4xagD+anDhWyjxi28mHusV607tlFXat/6sdL3KTyDn0hmAWpyp/I2CBTL37dmVUpQ42I38h0k3Yll/X1/R+7O3KF8ZXVWB+hiw3Qx1DSl41RTnGbjedhY04/UGRC68amzLNd3qeyZCpM7HQGR5E9/Y79Nee/yFqNU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453209; 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=hNhr+lvk0UfSlnFL6IyrepvjcA76XDl1n6kDTflTNL8=; b=dLwUn4LC9we/yeyMD1fxr3igQnpmold++kGMenAra4Fo3agM+2R1ZND8PYe3NSdz3dcpYXXrYHaTZCcPbah05nMEXZGXSBvCWi3WLtDjTnhQdwadVhAC/PrKAcd29TM3r/fJolg7h5R9+K5wtYpoN8E+BrjzCmjFiKIXP8c/EM0= 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 1687453209226410.92420354915396; Thu, 22 Jun 2023 10:00:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNcF-0001Zf-Md; Thu, 22 Jun 2023 12:57: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 1qCNc8-00015E-Ll for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56: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 1qCNc6-0001bW-WA for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56: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-280-iUHUQddYOEK3sH7szMIHKg-1; Thu, 22 Jun 2023 12:56:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55E59102D00A; Thu, 22 Jun 2023 16:56:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37FF2C478C7; Thu, 22 Jun 2023 16:56:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453014; 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=hNhr+lvk0UfSlnFL6IyrepvjcA76XDl1n6kDTflTNL8=; b=fOL8MM71d/pOzTOvWWAiQJTOPd3dh5NQEK++pq2dQnP3XI4xgMhBm4KszB0LNcFn0Qcvko PaGOXY8j5HdqMWM5MCrwLG4KL2Mw53qk4VameDX454JkC4ezsjnqfI23hw18rqQQeSYmyD czaI/gpC0zGddGtFVbxFbigH06/6AHs= X-MC-Unique: iUHUQddYOEK3sH7szMIHKg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 24/30] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Thu, 22 Jun 2023 18:55:21 +0200 Message-Id: <20230622165527.2417-25-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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: 1687453210554100003 Fast don't say much. Noflush indicates more clearly that it is like qemu_file_transferred but without the flush. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20230530183941.7223-2-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 11 +++++------ migration/qemu-file.c | 2 +- migration/savevm.c | 4 ++-- migration/vmstate.c | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index e649718492..aa6eee66da 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -86,16 +86,15 @@ int qemu_fclose(QEMUFile *f); uint64_t qemu_file_transferred(QEMUFile *f); =20 /* - * qemu_file_transferred_fast: + * qemu_file_transferred_noflush: * - * As qemu_file_transferred except for writable - * files, where no flush is performed and the reported - * amount will include the size of any queued buffers, - * on top of the amount actually transferred. + * As qemu_file_transferred except for writable files, where no flush + * is performed and the reported amount will include the size of any + * queued buffers, on top of the amount actually transferred. * * Returns: the total bytes transferred and queued */ -uint64_t qemu_file_transferred_fast(QEMUFile *f); +uint64_t qemu_file_transferred_noflush(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/qemu-file.c b/migration/qemu-file.c index acc282654a..fdf115b5da 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -694,7 +694,7 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -uint64_t qemu_file_transferred_fast(QEMUFile *f) +uint64_t qemu_file_transferred_noflush(QEMUFile *f) { uint64_t ret =3D f->total_transferred; int i; diff --git a/migration/savevm.c b/migration/savevm.c index bc284087f9..f26b455764 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,9 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - uint64_t old_offset =3D qemu_file_transferred_fast(f); + uint64_t old_offset =3D qemu_file_transferred_noflush(f); se->ops->save_state(f, se->opaque); - uint64_t size =3D qemu_file_transferred_fast(f) - old_offset; + uint64_t size =3D qemu_file_transferred_noflush(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); diff --git a/migration/vmstate.c b/migration/vmstate.c index af01d54b6f..31842c3afb 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -361,7 +361,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, void *curr_elem =3D first_elem + size * i; =20 vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems= ); - old_offset =3D qemu_file_transferred_fast(f); + old_offset =3D qemu_file_transferred_noflush(f); if (field->flags & VMS_ARRAY_OF_POINTER) { assert(curr_elem); curr_elem =3D *(void **)curr_elem; @@ -391,7 +391,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, return ret; } =20 - written_bytes =3D qemu_file_transferred_fast(f) - old_offs= et; + written_bytes =3D qemu_file_transferred_noflush(f) - old_o= ffset; vmsd_desc_field_end(vmsd, vmdesc_loop, field, written_byte= s, i); =20 /* Compressed arrays only care about the first element */ --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453041; cv=none; d=zohomail.com; s=zohoarc; b=b3ulp8aoyX0ztPmJC74Y2nm2w9oqAtgTj1bLP0jKBouyWt0rkil/OJz2ghSUVvdygJgJzI24dW330Rm/pFmOJWoTdf7RbLEbqjVRZL/jygBX8hadLswAcQvK9hAsJ6xXXCn+/QrThFUTylyi/88K10H9nX+I/q+IO6aYn8Pwke0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453041; 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=SGM9oDrMA/Qp+v4phUutbR6uhjgyVuEbgqQHcYuNgHY=; b=mg5lg0lewaaSeeoOa6S6+lugyQX8g5qCjuVpp9mNke8K6dV8GIqnMTfBtdRMwTt5/cnqTcycif+peLEn+avhjJDtlNaRGNogLzxP8qipoAPge37biWUiXiIamZEWxpcGOVnSfXKeSIbxsIszFRbLuaQ2+1jhjAvXjsrizNncpUs= 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 1687453041846137.0916831085832; Thu, 22 Jun 2023 09:57:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNc9-00017S-LR; Thu, 22 Jun 2023 12:56:57 -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 1qCNc6-0000rS-6o for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:54 -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 1qCNc4-0001Uv-JJ for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:53 -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-520-8cVBt-IUPeC7ZDMUFhz3oQ-1; Thu, 22 Jun 2023 12:56:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8C5C92CAE4; Thu, 22 Jun 2023 16:56:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9AE72C00049; Thu, 22 Jun 2023 16:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453011; 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=SGM9oDrMA/Qp+v4phUutbR6uhjgyVuEbgqQHcYuNgHY=; b=eXQI2TfVUoueFc+QHhh1kOF3KTAAB0qOuXBsZJtna7nHAMJk5ff69k8uaHTWIB3eRrZK8X d9nCdaK/beHNENuIIX01AQBu7L4YB0KZxY+hhY1qMHeuecmY8Gc3HmhyXruoXO/ZCGuic2 ycXO4OYHu+C24prS20qfKf+xRd1rMO0= X-MC-Unique: 8cVBt-IUPeC7ZDMUFhz3oQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/30] migration: Change qemu_file_transferred to noflush Date: Thu, 22 Jun 2023 18:55:22 +0200 Message-Id: <20230622165527.2417-26-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-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.8 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=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: 1687453043384100001 We do a qemu_fclose() just after that, that also does a qemu_fflush(), so remove one qemu_fflush(). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20230530183941.7223-3-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/savevm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index f26b455764..b2199d1039 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2952,7 +2952,7 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, goto the_end; } ret =3D qemu_savevm_state(f, errp); - vm_state_size =3D qemu_file_transferred(f); + vm_state_size =3D qemu_file_transferred_noflush(f); ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453213; cv=none; d=zohomail.com; s=zohoarc; b=UfdqevwbCSSz0KaImTte5aE8flDt1R3F+1GQGMdF2xvYKzwavaeV+B4ripFIjyhPHm8+X70XSNnsR+SkX2UKEu1xxuoDM3rto2Ccxg/hVjTW/ra611AyMgwYlf4wqstQQdAtGYEGbiPgIS1df9iOj2qb1kP6iHM2wmaCSFnKkB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453213; 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=ZbmZd/0GUxBNkX2GKrDTd/Dukt5lTkWbqA7HJxboR+k=; b=fOMqiA11ONojQ7yY+zQKqfHkLKEP0UEosOclpABEikTZy9Js8FSKbPPdCRdyM2xagwNsxn71VFupXh/2jaaYOxS2rhbVgGNEF5YQgIGWoRTDtNPFHbsTsX8+50F2qf8fBIe+EWlLZ9poBLpSZkSaFAXOlRXg5uGNKz5j3dq/dSU= 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 1687453213192754.4018288761587; Thu, 22 Jun 2023 10:00:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNcF-0001Rt-0M; Thu, 22 Jun 2023 12:57: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 1qCNc7-0000z9-Tb for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:55 -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 1qCNc6-0001bI-Ec for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:55 -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-57-WRYDQQI6PIKlAGBjWycddA-1; Thu, 22 Jun 2023 12:56:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 29DE71C07250; Thu, 22 Jun 2023 16:56:36 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A91EC00049; Thu, 22 Jun 2023 16:56:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453013; 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=ZbmZd/0GUxBNkX2GKrDTd/Dukt5lTkWbqA7HJxboR+k=; b=acGL+bcIK9Gn7ls8RWc01HlBuoeCXicnW9k4yl9coVCjphIInlTznGz9BOWTU9ssW1zuV/ TzO9Lu4ljjrXl7rcW/fOPhyH4BbewuxjbP6U/+wn+Nzpo25OudK7hegR9lX9F34Ye0Zrzi WEJPughSFnmZbFG6m+z+gh/BwDZrjDo= X-MC-Unique: WRYDQQI6PIKlAGBjWycddA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org, Fabiano Rosas Subject: [PULL 26/30] migration: Use qemu_file_transferred_noflush() for block migration. Date: Thu, 22 Jun 2023 18:55:23 +0200 Message-Id: <20230622165527.2417-27-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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=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: 1687453214360100001 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 b9580a6c7e..b29e80bdc4 100644 --- a/migration/block.c +++ b/migration/block.c @@ -748,7 +748,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); @@ -800,7 +800,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.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453135; cv=none; d=zohomail.com; s=zohoarc; b=fZxUB/bjrI6rvavDJWNodJX7FCY+mfj5xxkTr0//aYdfe9Q3Wszu98KncpyMbqcct9tkK9iUxxxTlvomaHB6vkpt2k8HGT+VU/0m9czR1DjaUOkTXxGHy8ytROhpjLRwaj7Kp4eZiQxcYEkIm92hbbKLSvwJdNNNc3s5ulQJhlg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453135; 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=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=PzfFBx5F20JNE9U2P4B+GghIs53GK0mAWSuDIll6HFGVxz7Ou2QHqh48x5GBh9BLMxghm/8cJrlUZKuv0ZCxG0WS+kXIt7K6hWxHojQ79vu6PhsLZf97mAUqJUjyotkrD3D5J50TOXv/ccYOQYDO1xQ5spBHrDxXnavkjuhB6Jc= 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 1687453135641947.0940241649788; Thu, 22 Jun 2023 09:58:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNcG-0001c9-5G; Thu, 22 Jun 2023 12:57:04 -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 1qCNc7-0000zI-U4 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56: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 1qCNc6-0001bG-EQ for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:55 -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-624-cLhuGbSIP8W9SphvMwYqlQ-1; Thu, 22 Jun 2023 12:56:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6AEAF1C0514A; Thu, 22 Jun 2023 16:56:38 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 700D0C00049; Thu, 22 Jun 2023 16:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453013; 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=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=W+fVF1qvuaLufpraXSUa1f7deIGDF38gqrvXHwVl/YJUknXUfFPCRiANbsBS/iMBUeVEEm 3CuP+3YwBTSDQkUZh5KcJCC+ODXHkgKRciz485bWgn2hDB2HRupsKR7NGxfbgjnss+r5na gSOr/pEQIGhFm4V33KEcDawp2R0uJ9o= X-MC-Unique: cLhuGbSIP8W9SphvMwYqlQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 27/30] qemu_file: Make qemu_file_is_writable() static Date: Thu, 22 Jun 2023 18:55:24 +0200 Message-Id: <20230622165527.2417-28-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453137808100003 Content-Type: text/plain; charset="utf-8" It is not used outside of qemu_file, and it shouldn't. Signed-off-by: Juan Quintela Message-ID: <20230530183941.7223-19-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/qemu-file.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index aa6eee66da..a081ef6c3f 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -103,7 +103,6 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f); void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, bool may_free); bool qemu_file_mode_is_not_valid(const char *mode); -bool qemu_file_is_writable(QEMUFile *f); =20 #include "migration/qemu-file-types.h" =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index fdf115b5da..9a89e17924 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -228,7 +228,7 @@ void qemu_file_set_error(QEMUFile *f, int ret) qemu_file_set_error_obj(f, ret, NULL); } =20 -bool qemu_file_is_writable(QEMUFile *f) +static bool qemu_file_is_writable(QEMUFile *f) { return f->is_writable; } --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453057; cv=none; d=zohomail.com; s=zohoarc; b=Zsba9P/hiC5n72lDWaZL2ofrLutE4y0fuuvJDtXtf3OUdgYUcEIaW2Oo7y0mhUrEmfdB2Dy1PTntNxpvniMaGKRBDpRv6AT3pLVjfFnfLhsz1OkuPYhTwdjT09s5AByJjL+PvOWCKrrfvH0gyYYU35PezE3+Wgtw8YSAZTNlN5M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453057; 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=RC26ZXvpIri6vHXLfG4jnz3zBcpECA8/T8I9HfCGWhY=; b=edqunQzDZFxx6dTRmdlG7yykdFd9S1h7ON4btr1ywz3SIjyWxArQn667lJr05S7XLjwwgCmKYIt/9vLbd/NCl9jtgwuN2YHU7kcOBr8puWE6Cz98ixtk0ybvkaEFCljSQ3cHw9E63OsswGaquKPv3HH9aYgyjYNan96szq2ksnA= 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 1687453057114512.7149107458316; Thu, 22 Jun 2023 09:57:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNc4-0000hM-QD; Thu, 22 Jun 2023 12:56: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 1qCNc3-0000aw-TK for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:51 -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 1qCNc2-0001KZ-AC for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:51 -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-650-FHu7E3RoMoyFvpxSjAD5-g-1; Thu, 22 Jun 2023 12:56:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD1D797DE50; Thu, 22 Jun 2023 16:56:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0DD2C00049; Thu, 22 Jun 2023 16:56:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453009; 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=RC26ZXvpIri6vHXLfG4jnz3zBcpECA8/T8I9HfCGWhY=; b=dbiraHi3W+0i6eNIA7ERn7PHVivtaK8LDcWC6ujtuJ7Yp8My+DIULsyhkwDMnlWPGS57VL RG87fw+HYUeUL5eHqOxBBb+KhiZL/YJoldBk4+hNI2+Mbjnn1RJXzHAHJKHL5YEpgue6nm 4bVO/DkEL90EpWeTWrKBwjaxZwwFNf0= X-MC-Unique: FHu7E3RoMoyFvpxSjAD5-g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 28/30] qemu-file: Simplify qemu_file_shutdown() Date: Thu, 22 Jun 2023 18:55:25 +0200 Message-Id: <20230622165527.2417-29-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=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: 1687453057502100005 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Message-ID: <20230530183941.7223-20-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9a89e17924..4c577bdff8 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -65,8 +65,6 @@ struct QEMUFile { */ int qemu_file_shutdown(QEMUFile *f) { - int ret =3D 0; - /* * We must set qemufile error before the real shutdown(), otherwise * there can be a race window where we thought IO all went though @@ -96,10 +94,10 @@ int qemu_file_shutdown(QEMUFile *f) } =20 if (qio_channel_shutdown(f->ioc, QIO_CHANNEL_SHUTDOWN_BOTH, NULL) < 0)= { - ret =3D -EIO; + return -EIO; } =20 - return ret; + return 0; } =20 bool qemu_file_mode_is_not_valid(const char *mode) --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453180; cv=none; d=zohomail.com; s=zohoarc; b=Wd/SusWqAPXUh0/ewM3wILu+Zzme1ApoxbjXh8toR96cAC9E/G9F6nmWNRaDX6eXU31yS3I8guJAaTYGqBhBj0jAKAuu2qpiD9VAtmzojnL1fhvK4V7ibQF9hJPNiswm3i5WAgRBmzkNIcfMOJTi2crP3NjN9qyzEPmvlw2kEaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453180; 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=tvznSVvrLqLSpbAniNlQaSrKd09QwBSoD5r3kvK3Uhk=; b=Mf224ZzZdsf/4e2LhyOTNQk1aKUTroQaN5rVin0f6+LCAt55k5wkQZplPxcsCXygW7S738fPdvYYR1CvLBZjGA1sh9QpmjEpsj5mfLVa/YYR7bFF8OMU2P8j7DVn15nLJmF/RpgKAtpxcLJ3HbjVt/uCEb5v32MvjHSXcQKwOP4= 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 1687453180550537.2924500313544; Thu, 22 Jun 2023 09:59:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNc7-0000wq-MI; Thu, 22 Jun 2023 12:56:55 -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 1qCNc5-0000kz-10 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:53 -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 1qCNc3-0001OD-11 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:52 -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-48-CiXDBEAWOl6GBj7ZUFTelw-1; Thu, 22 Jun 2023 12:56:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC1DC97DE40; Thu, 22 Jun 2023 16:56:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2975C00049; Thu, 22 Jun 2023 16:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453010; 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=tvznSVvrLqLSpbAniNlQaSrKd09QwBSoD5r3kvK3Uhk=; b=GxLRrO0/hB5wBTpXMbIq2QUO1OoLjG2sRCaKYYDdtFVmRnR4YShhe77fUyBWwTYavrLIDm LNNUEYM6fFmmEUmwTjlPCL8fDxJVO8uDkIYJXj3IQdIM5cSQhEK1fgs2Oequpp/uikt+e0 n7ON5BGP/1+o+lbsAxWxktrCYBuWK3c= X-MC-Unique: CiXDBEAWOl6GBj7ZUFTelw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 29/30] qemu-file: Make qemu_file_get_error_obj() static Date: Thu, 22 Jun 2023 18:55:26 +0200 Message-Id: <20230622165527.2417-30-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: 1687453182138100001 Content-Type: text/plain; charset="utf-8" It was not used outside of qemu_file.c anyways. Reviewed-by: Peter Xu Message-ID: <20230530183941.7223-21-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/qemu-file.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index a081ef6c3f..8b8b7d27fe 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -128,7 +128,6 @@ void qemu_file_skip(QEMUFile *f, int size); * accounting information tracks the total migration traffic. */ void qemu_file_credit_transfer(QEMUFile *f, size_t size); -int qemu_file_get_error_obj(QEMUFile *f, Error **errp); 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 4c577bdff8..d30bf3c377 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -158,7 +158,7 @@ void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHoo= ks *hooks) * is not 0. * */ -int qemu_file_get_error_obj(QEMUFile *f, Error **errp) +static int qemu_file_get_error_obj(QEMUFile *f, Error **errp) { if (errp) { *errp =3D f->last_error_obj ? error_copy(f->last_error_obj) : NULL; --=20 2.40.1 From nobody Sun May 12 07:10:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1687453219; cv=none; d=zohomail.com; s=zohoarc; b=idSbuwVHY5ZGq5szq7k2H11Ixg3Ph6k8TPX0bt7b9hjavNx12zyMt3Y/PLZdvbvx3pZpD2213WMTfXrc/nUg3iW/Nbwuy47iVG43LlckIsM4MH2qVuvY9cz4Qu6cvXf6EZ0TuAgHKd2MYisCt2VbUdzEv7OldLGUiT4R2mEJI0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687453219; 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=HTz/G5BiFE58fQISpbQndXC0ldXtbuPPgD/w277DDSU=; b=Md5awKxXoM1YDOi6mhZ304cHhKnric3dTTnWdHxtlHdlAyCwa6JJsPX9pIpJbaPPMdXqFY0ub+/NreXuZFD47WYZjnGFYA/CNY8xYq6eh61T8CrwckygVParD8Xnc3nnFVWMHr8m47dRZexvqRcE/bbr1+ZJaKkAwBfRvZ1QnQ8= 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 1687453219231260.22763141335963; Thu, 22 Jun 2023 10:00:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qCNc8-000147-Rl; Thu, 22 Jun 2023 12:56:57 -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 1qCNc5-0000n8-Fb for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:53 -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 1qCNc3-0001QS-H0 for qemu-devel@nongnu.org; Thu, 22 Jun 2023 12:56:53 -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-167-exxF4cZ-NYKtMFDOn3RsZA-1; Thu, 22 Jun 2023 12:56:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 399CF8A2E2A; Thu, 22 Jun 2023 16:56:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DAADC00049; Thu, 22 Jun 2023 16:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687453010; 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=HTz/G5BiFE58fQISpbQndXC0ldXtbuPPgD/w277DDSU=; b=dnASCPHojoil98lhJcid2mmaw31CEZMCABMNc2+/XLF0Oyzr88DbP9clkAOVqcrqRqr1/v i0pDKhdd0taW9E46JQ3JwsMdFNNLbVUR/wzL78XoVuXFrqP0F6KtXFm3rn3LCbDHWmdTBL wTC6zNrhAOKDMulVAc7V7XOO9VLyJZI= X-MC-Unique: exxF4cZ-NYKtMFDOn3RsZA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Paolo Bonzini , Stefan Hajnoczi , Thomas Huth , Laurent Vivier , Eric Blake , Fam Zheng , Juan Quintela , Leonardo Bras , Markus Armbruster , qemu-block@nongnu.org Subject: [PULL 30/30] migration/rdma: Split qemu_fopen_rdma() into input/output functions Date: Thu, 22 Jun 2023 18:55:27 +0200 Message-Id: <20230622165527.2417-31-quintela@redhat.com> In-Reply-To: <20230622165527.2417-1-quintela@redhat.com> References: <20230622165527.2417-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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_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: 1687453220405100001 Content-Type: text/plain; charset="utf-8" This is how everything else in QEMUFile is structured. As a bonus they are three less lines of code. Reviewed-by: Peter Xu Message-ID: <20230530183941.7223-17-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/qemu-file.c | 12 ------------ migration/rdma.c | 39 +++++++++++++++++++-------------------- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 8b8b7d27fe..47015f5201 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -102,7 +102,6 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f); */ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, bool may_free); -bool qemu_file_mode_is_not_valid(const char *mode); =20 #include "migration/qemu-file-types.h" =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index d30bf3c377..19c33c9985 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -100,18 +100,6 @@ int qemu_file_shutdown(QEMUFile *f) return 0; } =20 -bool qemu_file_mode_is_not_valid(const char *mode) -{ - if (mode =3D=3D NULL || - (mode[0] !=3D 'r' && mode[0] !=3D 'w') || - mode[1] !=3D 'b' || mode[2] !=3D 0) { - fprintf(stderr, "qemu_fopen: Argument validity check failed\n"); - return true; - } - - return false; -} - static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable) { QEMUFile *f; diff --git a/migration/rdma.c b/migration/rdma.c index dd1c039e6c..ca430d319d 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4053,27 +4053,26 @@ static void qio_channel_rdma_register_types(void) =20 type_init(qio_channel_rdma_register_types); =20 -static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma, const char *mode) +static QEMUFile *rdma_new_input(RDMAContext *rdma) { - QIOChannelRDMA *rioc; + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); =20 - if (qemu_file_mode_is_not_valid(mode)) { - return NULL; - } + rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); + rioc->rdmain =3D rdma; + rioc->rdmaout =3D rdma->return_path; + qemu_file_set_hooks(rioc->file, &rdma_read_hooks); =20 - rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA)); + return rioc->file; +} =20 - if (mode[0] =3D=3D 'w') { - rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); - rioc->rdmaout =3D rdma; - rioc->rdmain =3D rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_write_hooks); - } else { - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); - rioc->rdmain =3D rdma; - rioc->rdmaout =3D rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_read_hooks); - } +static QEMUFile *rdma_new_output(RDMAContext *rdma) +{ + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_= RDMA)); + + rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); + rioc->rdmaout =3D rdma; + rioc->rdmain =3D rdma->return_path; + qemu_file_set_hooks(rioc->file, &rdma_write_hooks); =20 return rioc->file; } @@ -4099,9 +4098,9 @@ static void rdma_accept_incoming_migration(void *opaq= ue) return; } =20 - f =3D qemu_fopen_rdma(rdma, "rb"); + f =3D rdma_new_input(rdma); if (f =3D=3D NULL) { - fprintf(stderr, "RDMA ERROR: could not qemu_fopen_rdma\n"); + fprintf(stderr, "RDMA ERROR: could not open RDMA for input\n"); qemu_rdma_cleanup(rdma); return; } @@ -4224,7 +4223,7 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 - s->to_dst_file =3D qemu_fopen_rdma(rdma, "wb"); + s->to_dst_file =3D rdma_new_output(rdma); migrate_fd_connect(s, NULL); return; return_path_err: --=20 2.40.1