From nobody Sun May 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204028; cv=none; d=zohomail.com; s=zohoarc; b=mfJGDepefQo1wFep+jY9kobIF7Q2KpL9Mf1ZDPQ8RyoEgAUu6qNr/HBIK1ix1Fob9+RnVqwztYDcI/tlpMx0ZXieZvnHnePHC8CcDhDgE4sjCoL7P/j4mb+2AZt8d7jfIzl9VGsaCZeSLgTmR99K6X2m+Z2vLrStI8Xu3/SW2g0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204028; 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=GxFELMNTPogYgHkDIjYbRh2Hj4687Tq9fMjKVNqi1Dk=; b=dUgKJiCLWciXax8UcV/AyKyjc+mfNp1SlDCKc1QdJHjDCDfUSShBSWZekEMskuCQrIK/mZpPLKZyDVnvLsOtSJPuWjgi9ngrJuu9H9yF0r8bkfot18DtMq/JzbU0wv3uoQVfqk0xILjEQMrk8wCTFYcErp2MqpIapgJObto95WY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204028751555.8190119331917; Mon, 24 Jul 2023 06:07:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvH2-00040Q-J8; Mon, 24 Jul 2023 09:06: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 1qNvGz-0003zw-SI for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvGy-0002Wz-8D for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06:49 -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-pUuW5v1_PI-i1HzxCCtZNA-1; Mon, 24 Jul 2023 09:06:45 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 70D5B88D120; Mon, 24 Jul 2023 13:06:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B7CAF782D; Mon, 24 Jul 2023 13:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204007; 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=GxFELMNTPogYgHkDIjYbRh2Hj4687Tq9fMjKVNqi1Dk=; b=UMEYciuV5orUwtfLCE9v3fB3hNg4q7XoArwsxl+5MLqozeznfNbFQAVPeU5+tFhh3neaWz QDCfVPOeP2or5eseokun0e83cjHXABOjvVJYJj4ubZQ8avNWn9ua9jIPYVna3Tq916E5yX XVmSVGKgbbIiCmoFzY5HeEeF9O0v7Dk= X-MC-Unique: pUuW5v1_PI-i1HzxCCtZNA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Fabiano Rosas , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 01/26] migration/multifd: Rename threadinfo.c functions Date: Mon, 24 Jul 2023 15:06:14 +0200 Message-Id: <20230724130639.93135-2-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204149708100001 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 91bba630a8..ae49d42eab 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2953,7 +2953,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 @@ -3031,7 +3031,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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204076; cv=none; d=zohomail.com; s=zohoarc; b=bvC/J9GErvoylrBJxe6QEnb8BLzDiPfaFHUuhY2RohEs5mqKNPnTaO/h1J3r0d2C7ExiYNMHmv/8MLNaBB7cRlGye2ff5OLeYziXFoW/uxqPtaHQajU/FLDnMIk74IVLYvSgeIhLs6GS9ugYbD7k3BDKngkugNHR/v2TifRcP1E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204076; 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=JpIbvCB7+U2UDIDi0bddQZso1DvaDqkABB+vaWBrHWqNGAYkQkcpfMqVn9raS2D3vOM4bN94dGV807Qcw8gSPSG4hhn7J67MvuiY7vuCZyKrsxusDeET8J+ELlvgt0S1TykbZG1yDCvbkGhytQkv9aMforTUBFQolp0csfOZtKw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204076810584.800391819352; Mon, 24 Jul 2023 06:07:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvH7-00041V-5T; Mon, 24 Jul 2023 09:06: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 1qNvH3-00040g-93 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06: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 1qNvH1-0002XZ-D7 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06: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-672-ibu4U3AuMka74eBeVjGXWA-1; Mon, 24 Jul 2023 09:06:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A5466830DC0; Mon, 24 Jul 2023 13:06:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id B58F9F782D; Mon, 24 Jul 2023 13:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204010; 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=EjetHh7vWtcs1EqsVgmy6EBNzw9Qj9FlsMMTM6gdErLbzDWmKPN0/3sxQMxJ9P0BhBvJOI osVy/IFLQXHaQrTU55CaMh+RVP7ISLq0rpCpREivKgBaEA+8wOmV5Xd/dYpVGBg2wFLgaW NZd04aVjNXaOjZUPGaLsj5dwY0V4cQA= X-MC-Unique: ibu4U3AuMka74eBeVjGXWA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Fabiano Rosas Subject: [PATCH 02/26] migration/multifd: Protect accesses to migration_threads Date: Mon, 24 Jul 2023 15:06:15 +0200 Message-Id: <20230724130639.93135-3-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204368973100006 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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204035; cv=none; d=zohomail.com; s=zohoarc; b=TRwx2by2YKw0PWdfIRnEtdGoaHgzk+lFSgjt+dtaKpT3zLeR3d82ro3mSAV8iPdUd0Fycm2mHWhOcUIyS3yDqeb+iMaHUFb702SbBwfkxaq3dl1hSuiD531RbfXIZpyS/wnPhyJBfLxCUo/yRbbx+jiIzCcL7OcJawhkkaqb78k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204035; 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=gGVAft6bfySiZeotsxYzZmc/iSGmdv+xqIf8Pu092GXIlwr3YKhQhv/EasRbi83jZ5crHHUgr+mQfIQV77dzNlVc/SZ/fL7677n/wZ7zHD6PmsqCf/CPBA1oYgVf0VpgjH7TG0DJwB82bL/p6cWgZDEeMLNiXxtk7loda0Venjg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204035967576.0399951805875; Mon, 24 Jul 2023 06:07:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHB-00042s-H3; Mon, 24 Jul 2023 09:07:01 -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 1qNvH8-00041m-NJ for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06:58 -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 1qNvH6-0002Y1-6o for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06:57 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-193-Fb8mOOR0PkiXCTVDpFJ3eg-1; Mon, 24 Jul 2023 09:06:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01E0B3810796; Mon, 24 Jul 2023 13:06:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAC38F782D; Mon, 24 Jul 2023 13:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204013; 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=In55JTXWO5urdwoxi9uWYnC/ntxpsY1stU/AM1brMGAC3GaJkDqnWybdjfDlpbaK1D2Ypd 16pAGla82lHLJWJ7au2+9+wY0Y//WZi0J3hHc+jvB/DM+z2ZjCkQsWHy5v+1UzfPZfFFjr QJT/w5MkCoNTILnt6t1aZZ3mYLTF6Nw= X-MC-Unique: Fb8mOOR0PkiXCTVDpFJ3eg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 03/26] softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" Date: Mon, 24 Jul 2023 15:06:16 +0200 Message-Id: <20230724130639.93135-4-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204311173100001 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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204401; cv=none; d=zohomail.com; s=zohoarc; b=OETc2RokeVRZsj9GCr9pbP1HEB4oofSSrk1Lql1ax5LtFjJzUCTPlA/pWvaHcuc/ApgC4xnn5+ceyUm1vR5Ehba1qcx2qfrb0eDESUxxPfarHI98oEc6g/xGWU4OMc0yUfwMX2p5hrJ0nDBiJDnk3cbAdMAGM7NeZvs2Ccl8b9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204401; 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=B5WVwcY1bk01dpLHof+I7+e8FHOYDq18nSN0Eu1XiGM=; b=DK/8KbpsRWKoUhZAh/9oxiligfB0uiVzY8IcOPpMIvdOWU9LzVlSPKagkrqecO1Lc74klZZGc7Jx9CGj9LW0a3GRSGVIhrs+bBsIwX1VNw57OorGPYWP+ztgIRleSTku8EmR7veFm0RbbGeY8qtkRRdYKus9AoIYbwRCRZBj6pw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204401083470.54239475290615; Mon, 24 Jul 2023 06:13:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvJ1-0007EJ-4F; Mon, 24 Jul 2023 09:08: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 1qNvIH-0005bI-5H for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:22 -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 1qNvIE-0002oR-Bi for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:07 -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-483-aUZILhnnNb6EN91KaNBZaQ-1; Mon, 24 Jul 2023 09:06:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A0D286F122; Mon, 24 Jul 2023 13:06:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45F50F782D; Mon, 24 Jul 2023 13:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204085; 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=B5WVwcY1bk01dpLHof+I7+e8FHOYDq18nSN0Eu1XiGM=; b=Tn+0+Qz218PEtSO9bzHbKwRe4vJfL/qJf2bfQHtYI8PKujG4XQYk6SpiaYPNycMHlylone dya/V3cRknMQja2kvTfdWbeiieql4Gis2+vUg0C8JQOfOgCDDIN9DcNzTMImLTYO+1wLez WjGNnHtCsvxev1D7Oz3CRVmPwSrqrsU= X-MC-Unique: aUZILhnnNb6EN91KaNBZaQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 04/26] qapi/migration: Introduce x-vcpu-dirty-limit-period parameter Date: Mon, 24 Jul 2023 15:06:17 +0200 Message-Id: <20230724130639.93135-5-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204467359100005 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 47dfef0278..384b768e03 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -789,9 +789,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 ## @@ -809,8 +814,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: @@ -945,9 +951,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 @@ -982,7 +993,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: @@ -1137,9 +1150,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 ## @@ -1171,7 +1189,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 5a9505adf7..1de63ba775 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), @@ -908,6 +913,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 @@ -940,6 +948,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 /* @@ -1100,6 +1109,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 @@ -1199,6 +1217,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) @@ -1317,6 +1340,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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204310; cv=none; d=zohomail.com; s=zohoarc; b=Z8CxYN4s/YENyZXOSI1bAy+fBC3oOSTV1bOa+K9HpXo7yRyj/eSilhBNdF/cO6A7S4cyxddCdmN89Wpku3dAMzTy1NmSOcaiihFJ9l2yc3ymX3oVTtRxY1lN3KKB6qd3b7cCSjg1prCcbFcYKqhaoNJw+8+2f9e2LouymtkH544= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204310; 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=HTTb5Z5kDvfeeCH5cQxHKTrfMaQpbET73zReScb//bg=; b=jdbLWFX+eGGmN7qTeeTM69AVNJKEhJRqwxc+Kp1Zu88D1RoZHqQnRE/lf1FC4RzBzJOjwLNXpK4spq8FgufZN3YnIB+cSH6qyWl1L/mQoXi+rnhsdIPPeav3FT1F5iVBZ/icAYqiKF9ISPiytz+SrLhthJttJLZopANhw/Csc8Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204310613897.0541448332485; Mon, 24 Jul 2023 06:11:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHD-000433-1g; Mon, 24 Jul 2023 09:07: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 1qNvHA-00041x-3E for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvH7-0002YZ-Cm for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:06:59 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-553-8AEyakZHP_iRQTOb01cwEA-1; Mon, 24 Jul 2023 09:06:55 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 749C33C0ED5C; Mon, 24 Jul 2023 13:06:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80115F7839; Mon, 24 Jul 2023 13:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204016; 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=HTTb5Z5kDvfeeCH5cQxHKTrfMaQpbET73zReScb//bg=; b=KlC7/4Pdh7KuEFDMCQ+CnPkCBnBBaFGAY2lEROfibBF4iH6H5KwQBFoXoptIB60DBsZHI/ 19cvzlh+SZY3Fw+iH7YaUo/nkYDuXTWuQ9byC5BHjwH7nF/Ml7bi7jU9rW6uay/Ps1zJBj ZYtBqPS60M12EFuWKx16QyQpPKYBfP0= X-MC-Unique: 8AEyakZHP_iRQTOb01cwEA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 05/26] qapi/migration: Introduce vcpu-dirty-limit parameters Date: Mon, 24 Jul 2023 15:06:18 +0200 Message-Id: <20230724130639.93135-6-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204429540100001 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 384b768e03..aa590dbf0e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -793,6 +793,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 @@ -816,7 +819,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: @@ -955,6 +959,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 @@ -995,7 +1002,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: @@ -1154,6 +1162,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 @@ -1191,7 +1202,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 1de63ba775..7d2d98830e 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), @@ -915,6 +919,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; } @@ -949,6 +955,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 /* @@ -1118,6 +1125,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 @@ -1222,6 +1237,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) @@ -1345,6 +1363,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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204045; cv=none; d=zohomail.com; s=zohoarc; b=ddxXWU3rclNoiAwSB5Uj/qAwyhxWSmgohh0JOJ9x6gwK8zrdkz7sx5R/VTp6K1mh8BoHDy4QEjNilkPMlFSCu1Rf6pk6omT4nG/tQgajk/KWDU7O7qPnl5OwHYPYGfXc0Mqp389KjYJj8kh0QkFCZr+Ohq8M5iIH9aUnhAqGWiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204045; 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=rwFy6lfN0ts+RTbUZj1aGNeIu2txPg9Sz4/q51PTYQI=; b=ImyxQTagTZRB+lXZ1KRpyCbPgI822gPwsW6KexZY0PJHUhdII89HgrVmszXA6eKXSycp6r+PW+zMkt6aF6ZWO98Fl4GfBvm18Ux4eJIT7OhGZcIcgQFymRTteu23wTCwJVZW2w9Ie5I72NfmGFYHIyi9+kacMrPTxpQfqGT6dN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204045436101.16390333275206; Mon, 24 Jul 2023 06:07:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHG-00043m-Pn; Mon, 24 Jul 2023 09:07:06 -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 1qNvHB-000432-Tl for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:01 -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 1qNvH9-0002Z4-Sl for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:01 -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-248-w2hWAOTHNdy4BBLEnlMk7A-1; Mon, 24 Jul 2023 09:06:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8F89310504AB; Mon, 24 Jul 2023 13:06:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id B963AF782D; Mon, 24 Jul 2023 13:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204018; 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=rwFy6lfN0ts+RTbUZj1aGNeIu2txPg9Sz4/q51PTYQI=; b=BwIg+6ObdDDHSwtgiqSo6Tbs2zOI19l6CJ6FvhGrmfT9zBBTpBrBLF3yZcburo0WCnkUyT 4DYfmNxQEMdctdJHsB8N+bgJG2w2x8z6JytznlQMkEBLbs7pzHvpNw1IbSmRBxGE5ODFBN QAv8TcWo1DW6Mo249/MhoUiV7bbkvP0= X-MC-Unique: w2hWAOTHNdy4BBLEnlMk7A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 06/26] migration: Introduce dirty-limit capability Date: Mon, 24 Jul 2023 15:06:19 +0200 Message-Id: <20230724130639.93135-7-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204339196100001 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 | 13 ++++++++++++- migration/options.h | 1 + migration/options.c | 23 ++++++++++++++++++++++- softmmu/dirtylimit.c | 18 ++++++++++++++---- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index aa590dbf0e..cc51835cdd 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -497,6 +497,16 @@ # are present. 'return-path' capability must be enabled to use # it. (since 8.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. @@ -512,7 +522,8 @@ 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] }, 'validate-uuid', 'background-snapshot', - 'zero-copy-send', 'postcopy-preempt', 'switchover-ack'] } + 'zero-copy-send', 'postcopy-preempt', 'switchover-ack', + 'dirty-limit'] } =20 ## # @MigrationCapabilityStatus: diff --git a/migration/options.h b/migration/options.h index 9aaf363322..045e2a41a2 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 7d2d98830e..7d83f190d6 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 @@ -196,7 +197,7 @@ Property migration_properties[] =3D { #endif DEFINE_PROP_MIG_CAP("x-switchover-ack", MIGRATION_CAPABILITY_SWITCHOVER_ACK), - + DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT), DEFINE_PROP_END_OF_LIST(), }; =20 @@ -242,6 +243,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(); @@ -572,6 +580,19 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) return false; } } + 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; + } + } =20 return true; } 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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204129; cv=none; d=zohomail.com; s=zohoarc; b=A2ukUJHxDEVjEeoII4C8x7O1IV6SpssD6YqVxRYuwjrAwJJnJStg93Arq1+VJxfZe42y/Fz/E2uVw4vh+A5fd18XfQI2HJGZNg6yrjljrV3qwNVd+EYxYXeuyV8/NmQmdKQD50AYT2sAAhAwWZsFr9ZqQSsvXmH4fErmVlUXVas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204129; 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=j2QZJCtHhaH7HqI/ypiRvoBO4jcPfMfyKnCvIG4aho8=; b=dhDCNXEbDgM0IjwpzY0xuuRWlhAvW+q0IseOzuJ2KP+ea82Ejp3JbYd2fGaDG7FOpFKbehKP1Yf0+FPLxCaIVgGWobySQElKduWxe3xzbLz/+4MYdRmDzf4hk6SMSbvR/s+X0DS8CAgi19gHlFK1rz6OdudqPuJGQ+lQtgghrR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204129815971.6345864808522; Mon, 24 Jul 2023 06:08:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHM-00046O-1w; Mon, 24 Jul 2023 09:07:12 -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 1qNvHE-00043l-8m for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:04 -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 1qNvHB-0002ZP-Dy for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:03 -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-306-gDYY5JHCPwGCwHwecH338g-1; Mon, 24 Jul 2023 09:06:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B77EC10504B1; Mon, 24 Jul 2023 13:06:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7A49F782D; Mon, 24 Jul 2023 13:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204020; 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=j2QZJCtHhaH7HqI/ypiRvoBO4jcPfMfyKnCvIG4aho8=; b=ApvKeRs1kOSuAaFpdTBLi0OOMndm0nyYmvaEb0kIE6T+lBbQLGxjh13ij011NUAarYKmZb u4Lcp2tPcA2MIwymu8bDSkpw2zQyCgucVBnmzxzh1AlM346Vd5dNcXmtyn8zwF846zZCsm ROz958dB+suyTrJmXMg7IFJ+Qasw8jo= X-MC-Unique: gDYY5JHCPwGCwHwecH338g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 07/26] migration: Refactor auto-converge capability logic Date: Mon, 24 Jul 2023 15:06:20 +0200 Message-Id: <20230724130639.93135-8-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204250806100001 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 0ada6477e8..f31de47a47 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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204056; cv=none; d=zohomail.com; s=zohoarc; b=OwHQkUakBfbYjCPEsm4iVQkogzBdfWscOzfQYyq5Q9EuQt1iFPrpK19OaPrEKmfAeRtJ4U7kYrZEIw78NEtlX0ZVimIWBe2q1PfaJ7Hn+iBgX1sQyX/2QY/HJ/wI7DhBjyhYDGX4P/AlF6EbFegHGJLR654VHu3XN31VUK3rE1c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204056; 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=T6NDPnkzHlHMJ2E96BT2L8DNXWr8MPzQrE/ZuIz1ThM=; b=GHcVPdSpYX5sk7zHbKQXREFL2csXELc9HlXqmpxvriQ/NEJTD3wMihDjdz0sXUADQ/+s5kjwZBPcxIcgal/Q2dfXeHdkPQR3CRdN1TJsVLR7TOnIN3V8OZMfxWdJw9QthfImnKUqbc1bCKlxt/4aPR0zSFtH55FyIFLLHSTdN2k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204056428941.6793373944826; Mon, 24 Jul 2023 06:07:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHV-0004AQ-JR; Mon, 24 Jul 2023 09:07:21 -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 1qNvHM-00046l-T9 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:14 -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 1qNvHK-0002ac-26 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:12 -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-450-qYq6qj0gPKad8U-KUuThcA-1; Mon, 24 Jul 2023 09:07:01 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D1D8810504BD; Mon, 24 Jul 2023 13:07:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08C65F782E; Mon, 24 Jul 2023 13:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204028; 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=T6NDPnkzHlHMJ2E96BT2L8DNXWr8MPzQrE/ZuIz1ThM=; b=XeyOUwa1NRfBiYtUJdgixOnBitxnLvMv6UT2q4JKGr91UZXwctf4VuyUojleZVWs/SEpDn H024Qh2CED4RvXu/NKXM47MYkhdqeSTwLnerhOjK4WdVq38Gkmr7PjG7ANQ3haowUYwAgx IjhYNfPbyfZeb5NNWZfc+a5M5k1guM0= X-MC-Unique: qYq6qj0gPKad8U-KUuThcA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 08/26] migration: Put the detection logic before auto-converge checking Date: Mon, 24 Jul 2023 15:06:21 +0200 Message-Id: <20230724130639.93135-9-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204359653100001 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 f31de47a47..1d9300f4c5 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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204070; cv=none; d=zohomail.com; s=zohoarc; b=NOhhq9wvOFTib51sqVxQq5d3hkEG+wWldlgPi6DH+kIc/wpPiIja2LrLziqyraAKuN/EbtsvrWWPgD9mRdqaACZ/PgTtAfiS5bqm+FAKwMg/rCZTh2y3pmzN+hD5g0wMN07m2M1Kw6EwqGOzWGxujDRaYc8x+XlzWFme/kVr4JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204070; 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=u51OtPwfPBL7MdDO5U3j5SvZo8pKrPKFjkFTcGk4gTs=; b=WCi1d3gkSvif976lRnauTT4DLe54mDJpWq77qvDAW4jzxza5rpnUMVrDZTkIE+DG8Ut3SGeyIaDH5SiHIyigRx5dPQcsftzgtA8KnupmPZOiTMif4skFlbUlO7/+/FX1/uUztzU35A3l3GW4n6Fb5ZDLIRqnx314Ros8pkW3ROg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204070199692.7782255912327; Mon, 24 Jul 2023 06:07:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHZ-0004GB-Su; Mon, 24 Jul 2023 09:07:26 -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 1qNvHP-00046v-1i for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvHK-0002ae-2U for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:13 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-398-b7dO1pNMMAGkX7462HzWTA-1; Mon, 24 Jul 2023 09:07:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC5433C0FCA4; Mon, 24 Jul 2023 13:07:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22E69F782D; Mon, 24 Jul 2023 13:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204028; 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=u51OtPwfPBL7MdDO5U3j5SvZo8pKrPKFjkFTcGk4gTs=; b=IjwJ0BJK/P5GUGKjAHjcM5CggFq5fOr8SqXeEf7rDkrcqikGrF6nd9pNvPWprkYL9kVSpn 6SqTAYBGmGrJeEPJ5qHBTnEROvEZaB0JKXGYsaM+lZOCGheWDOt+opXlW42Rp5Q2AW/Yr3 2ko8JjtyLdNUuyCeBp5RrfDWYIu7dv4= X-MC-Unique: b7dO1pNMMAGkX7462HzWTA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 09/26] migration: Implement dirty-limit convergence algo Date: Mon, 24 Jul 2023 15:06:22 +0200 Message-Id: <20230724130639.93135-10-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204192195100001 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 ae49d42eab..49332251e8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -166,6 +166,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 1d9300f4c5..9040d66e61 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 5259c1044b..580895e86e 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -93,6 +93,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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204139; cv=none; d=zohomail.com; s=zohoarc; b=SA2FIQ9UGSsAsAbc7YreYjhfqt/5mK/bFN3n/M0rl+RuW17/m48juoou/uCRfF8YYJSF8+PtaROvlmBc31siE4HGe+Fiba6LWitpfL3BJd5fESAP+tOmwRHd7dYFwmG7Nq2OxFxWL0R0EEaxO9ZxhIvvvZdlV8dS+wS3JXIXypg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204139; 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=hjSRZQf+LUSGc2iLBTOUuJI1YKlBI5q/qZZ0Y90Bs4I=; b=GHw5WV0QgxJ3wuY3urPQJ3x1MGGMGY++qJyzveyQzCDNFm5fG8FENFEELZs4lmw0fxtE6OI0doxSBhQ8HlMMpI0rePqXrXF5oWkZVc3hFsEDmOHIB6m5VU2YsaRQ2OKULzJuKTnMR/WuFIFRctfIPUuHtL4oGxKYhXm6RgkEmSk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204138996457.05379493643466; Mon, 24 Jul 2023 06:08:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHw-0004fp-6u; Mon, 24 Jul 2023 09:07:50 -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 1qNvHS-00049T-Mr for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:19 -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 1qNvHP-0002bu-O3 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:18 -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-633-AvbS5J6lMWKLf8gsYl8nOQ-1; Mon, 24 Jul 2023 09:07:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 11514835170; Mon, 24 Jul 2023 13:07:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D56CF782D; Mon, 24 Jul 2023 13:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204034; 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=hjSRZQf+LUSGc2iLBTOUuJI1YKlBI5q/qZZ0Y90Bs4I=; b=LUiFuJFZFTgNSUobkykccDh+4kxgIfT8mxe2cxO/sfamZmAQpNeqDs36CqlEWS5BKgbQw4 uK4DS8BBpbL+C34l1qzZFbf3Ygz1acr24NqBCfkfEFUI6ViGsQoXXGJlqPYYE+v8/h1huv nfxgHsgHQGfvHRxu1dVazKevm3+lzus= X-MC-Unique: AvbS5J6lMWKLf8gsYl8nOQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PATCH 10/26] migration: Extend query-migrate to provide dirty page limit info Date: Mon, 24 Jul 2023 15:06:23 +0200 Message-Id: <20230724130639.93135-11-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204372274100015 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 cc51835cdd..ebc15e2782 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 49332251e8..1ea7512291 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); @@ -974,6 +975,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 19 10:12:00 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204242; cv=none; d=zohomail.com; s=zohoarc; b=Wo7L9GXzGdENxjZtQCOJS6O9HPkuX/0NHSKR7t/TPVN/2jZsqkqo967FXhM/Q/9B5okXX99g2moCw6NZOjhogxrIF99XcYVOudd98eNtLWZKFDpiQkxsspWNeDCwhrMM00c6j7NESrv4qbdfKWMh4vZazlD5OcLMpRfpWDqOSC8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204242; 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=bqSSxdbrGVcLiKw79+VweBZw2f7OPbtHdvM9k78oG9E=; b=V6+XpoXtxlb2UNm/95b+hJ6CURY6mrtu0mA0cuBf6WctWNbjnnTvy5WMQ6RKMKgjtr85i8TBZnC9DACWUCpMBMHCfW0vUtmUkwU1eiLYJyD6cjOhcXTX10p4QuR/FEda4jBRMWsv1HDfV2+V+53uBcGgXmgRN1azsCn67uXO0kQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204242939656.7614200119946; Mon, 24 Jul 2023 06:10:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHY-0004D3-Rx; Mon, 24 Jul 2023 09:07:26 -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 1qNvHM-00046k-St for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:15 -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 1qNvHK-0002ai-2H for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:12 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-68-Ok3WPGKOOUyjHwdnDKDdvg-1; Mon, 24 Jul 2023 09:07:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05CE32834773 for ; Mon, 24 Jul 2023 13:07:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5584DF7833; Mon, 24 Jul 2023 13:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204029; 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=bqSSxdbrGVcLiKw79+VweBZw2f7OPbtHdvM9k78oG9E=; b=VTzEfMmd9MF6Sow/sxxLZ+zdVzFoff2+GGobYgjLJDhSNClPozFPbKUjBItl/LgQC/QgQw HMwQ1PwQg2QZfeftKiAGKjeiyLw7Q+1BvDtt16o5l58VDLnM+5Jngcj1PzYu9Alx8P217a YHyAR0A+xagoGRKs8bUAoVjDXwLVaiI= X-MC-Unique: Ok3WPGKOOUyjHwdnDKDdvg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 11/26] migration-test: Be consistent for ppc Date: Mon, 24 Jul 2023 15:06:24 +0200 Message-Id: <20230724130639.93135-12-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204363471100001 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 e256da1216..2296ed4bf5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -748,7 +748,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204129; cv=none; d=zohomail.com; s=zohoarc; b=QVc7H9aWEYvi8pxp5n+kqj94Ibo2C7e1QAWkvGWrGP15xesi1NI3bPOrH/bZl+n2JDmQpWniFk3Q0mZuOcvDppAEkqOEVzPwmFGRuBBg4TLrugF7X+gC4cmbV+ndmTwyXdhbic10Cq+tZpJoqaHYaEF7Mpis3Yv7yGbEMCrZOZ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204129; 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=IO67mDSIPnuvh+bMP5pTUclRuVctvmn+VkgiGdOGWbE=; b=Vpfg/eyRBqPw58/W0wbHVAh3ch6BoNGni9IquGF5lLzsE2IfU2E+/q7Oc692IqwlLSvTQ8Cqt01zT4wupaRhewB+bKzVlGYu5iANdj0IsbV7YQDwMBf6JpAtvK+2msQNC1J7L5UavqUhXmUTvcVUSx3S4sJBRrCsBS7NBTCKQ4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204129968707.3771821901811; Mon, 24 Jul 2023 06:08:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHv-0004UK-Rp; Mon, 24 Jul 2023 09:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvHN-00046r-ME for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:15 -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 1qNvHL-0002ax-IJ for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:13 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-130-NHW7S-J8O9a7Zm7DpCqQ2Q-1; Mon, 24 Jul 2023 09:07:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB9193810D25 for ; Mon, 24 Jul 2023 13:07:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49C82F782E; Mon, 24 Jul 2023 13:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204030; 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=IO67mDSIPnuvh+bMP5pTUclRuVctvmn+VkgiGdOGWbE=; b=OOpaBGnM+Il7dpD9U/yjN4nX7JNiOpjdUfwo+8mjX3hXuQPURGbHpTCIweA4iUqnW/AfS4 BfquxKOnY2Fy1k6C01P2af+vOjI2JAz03mcdTMEF1IivZbdxqqqwvhOOQFvd12/EqfNrft S3kRjEZORX5GYwuh4McHAxV7IApZ8tQ= X-MC-Unique: NHW7S-J8O9a7Zm7DpCqQ2Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 12/26] migration-test: Make machine_opts regular with other options Date: Mon, 24 Jul 2023 15:06:25 +0200 Message-Id: <20230724130639.93135-13-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204328465100001 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 2296ed4bf5..f51a25e299 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -739,7 +739,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; @@ -751,7 +751,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", @@ -791,14 +791,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, @@ -811,7 +810,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 " @@ -819,7 +818,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204132; cv=none; d=zohomail.com; s=zohoarc; b=K262qshN/XVdXInqkDT91ic9+OmGTZ4Y+nj/gR4FuPn3vr1DjFMvMbMYy/j4TM+732YUCHOVvQWxXGD3sNOFlSR0070XgGQZdYxs/paQH2jE3Uo/41m9zlAYB2sMPcVgwzHHl8W03QMavvQbxH1rm3gsKhBhLAVhQUWpbhrz090= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204132; 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=KNC9nSJyggxk1F8QEqwfNe0/LHOiMWhVaqtIL8XGii0=; b=OhK/cVTmKr9QnoPu0yl174qa6uA+nMMCkqXFSaNWNrBl2tIOTdERVvdCdkWyrK/G7OEC0upBULcKIJ7ep69+lzPHjLMO+kqjF04dfyd2rCht5kibc7NPvMvfXLaVCOxGx7L2HtTslV1QPYtkIZfPQD9Y4f8TXKNisd9vhniMRP8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169020413289914.052459511354527; Mon, 24 Jul 2023 06:08:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvI1-0004oj-S8; Mon, 24 Jul 2023 09:07:53 -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 1qNvHc-0004QW-EC for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:29 -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 1qNvHN-0002ba-Sx for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:27 -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-690-OWW5egLnMuaGNNG3kIe7pA-1; Mon, 24 Jul 2023 09:07:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DDF86830DB7 for ; Mon, 24 Jul 2023 13:07:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C29F10E5E; Mon, 24 Jul 2023 13:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204033; 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=KNC9nSJyggxk1F8QEqwfNe0/LHOiMWhVaqtIL8XGii0=; b=ew7JUxx6RXvT5SwQJuDn76yfCVXsBH0DEXuxOKv/1fWRyNSNTL7ffv2nO/BzekbSlrfAzp VbJl5mRNPUidSwQYk/Vpq2dsiE9wVJF0S8aayFyV6Gm0EkBlCkGwl9qnQN7YAEh+WYMltH FgnV01lYVkKQyQrX0bvAdxE9RoxIHeo= X-MC-Unique: OWW5egLnMuaGNNG3kIe7pA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 13/26] migration-test: Create arch_opts Date: Mon, 24 Jul 2023 15:06:26 +0200 Message-Id: <20230724130639.93135-14-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204345663100001 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 f51a25e299..c723f083da 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -702,6 +702,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; @@ -727,15 +729,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) { @@ -743,20 +743,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 @@ -795,12 +791,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) { @@ -815,12 +813,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204368; cv=none; d=zohomail.com; s=zohoarc; b=DjnUMdW+QbC6edvW44/SCvBO9bXb8kV3LKSHaj3DysyzlNP7I2YFmfeaZ21uw0UhvmLEipBkt8TERoQAbjdo+nNnVMYFT6+ecBpDtHO4OppK5ZSAv0VYUycEEVzqQ/znGL44trQASef0ZpwzdIhFk/WLfZ25iFv/1Kl0pm9uOqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204368; 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=P/n8gDGifsWxAYVoM2b9VPggXZSyNeMKEDHZl2X1mHU=; b=bN2rbhRSd15qQGtiFOTLQo+IiWzAU3T8Ik+0V5t5O7xq7IFB6SiTRBhxCFYIrj8A2Nnv1Rbb2tICBiA5KPphDzKXQaFJ1GoRe7wn7sjzVy+NyRZ5o4ErOyjdlT9vTT+qAoxemRuzwOOlWCsNOnpCPjU1U4XkoTTM7jvyb3AZwDY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204368388567.0341672549259; Mon, 24 Jul 2023 06:12:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvI1-0004oy-UB; Mon, 24 Jul 2023 09:07: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 1qNvHg-0004R9-4U for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:32 -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 1qNvHQ-0002cA-T4 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:31 -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-124-nuW-CxbWOpugSPLymiu4kA-1; Mon, 24 Jul 2023 09:07:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D22B410504B3 for ; Mon, 24 Jul 2023 13:07:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EA6110E5E; Mon, 24 Jul 2023 13:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204035; 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=P/n8gDGifsWxAYVoM2b9VPggXZSyNeMKEDHZl2X1mHU=; b=UEWr5RCwovZKY3U9yJl71FZlWJahOFVz8Rg9zrn5bWJsplgXyRxkVgUuw2ZlG6wT2LlsmE d6NN0w0NnniNWYApof9eCQDV+1zSJh8IFS5cYCU1wtcR3PXiF28DyVyy4C8SykXQEcuuXX MJs4KQ3RRR0+XPA7zzKXXExbDsg27L4= X-MC-Unique: nuW-CxbWOpugSPLymiu4kA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 14/26] migration-test: machine_opts is really arch specific Date: Mon, 24 Jul 2023 15:06:27 +0200 Message-Id: <20230724130639.93135-15-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204463350100001 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 c723f083da..fd145e38d9 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -711,7 +711,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) { @@ -739,7 +738,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; @@ -747,12 +745,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 @@ -787,14 +785,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 : "", @@ -808,7 +805,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 " @@ -816,7 +813,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204139; cv=none; d=zohomail.com; s=zohoarc; b=KOwI4j8R9+GXGhHK9kKqGKpoe8eJ80COZKfpxV2QMVv2NQCRACpFdOwwKP5qiFbPTIWVK7ZVjNo1dM62JBxc4HOV/TB700i/UaqrG7IJjqBiHtMCjMc3REqMCwp6htcyquYPIVVYI5IcOZEQtkJXP+efW4TVn04n5M7FBZ7mja8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204139; 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=rfpWTfZ+3x5RyL6taoFNi43rXXPurwpmB4npR5ydTnc=; b=eAsp7MIN/vc2ND9SjPyRmcnD6mt/E1N5ktFZfXUE+WostvrloZ8g7eyHv1TcvfD3oZ8KbG5PGyZ20Mev3Ojfb/fkPdXqQWSFojCuUwDoJ0ZcKFpDqmifhEX0pyNfbCRJDpdZ+7o/PkcMUJHshh1guskGno9HNZC4fR+pjisrDT0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204139081454.50254241454184; Mon, 24 Jul 2023 06:08:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvID-0005Pz-34; Mon, 24 Jul 2023 09:08: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 1qNvHi-0004S3-2b for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvHf-0002fi-R2 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:33 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-684-VlCWPl40MuSijTpiYnSYJw-1; Mon, 24 Jul 2023 09:07:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCB2C283476C for ; Mon, 24 Jul 2023 13:07:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23007F782D; Mon, 24 Jul 2023 13:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204049; 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=rfpWTfZ+3x5RyL6taoFNi43rXXPurwpmB4npR5ydTnc=; b=SpEWjxWYpthrzbJo/K0iznVqz5PVN8Gy5JD7xr1Pe1EQDm9Vb9gn1BWUul0ty3el7fsAlT 3nuyH9kWcaFQidJuy67DNtow+46ZAngBTJ5Ul9qrZrkPCVuLd9JZVHGD6qXF3sRen9TbBX 9dsO/oB8WCIv8wMMd3m4RSVmpN2QYOw= X-MC-Unique: VlCWPl40MuSijTpiYnSYJw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 15/26] migration.json: Don't use space before colon Date: Mon, 24 Jul 2023 15:06:28 +0200 Message-Id: <20230724130639.93135-16-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204260410100001 Content-Type: text/plain; charset="utf-8" So all the file is consistent. Reviewed-by: Markus Armbruster Message-ID: <20230612191604.2219-1-quintela@redhat.com> Signed-off-by: Juan Quintela --- qapi/migration.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index ebc15e2782..7ccb28e64f 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -67,13 +67,13 @@ { 'struct': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , 'duplicate': 'int', 'skipped': 'int', 'normal': 'int', - 'normal-bytes': 'int', 'dirty-pages-rate' : 'int', - 'mbps' : 'number', 'dirty-sync-count' : 'int', - 'postcopy-requests' : 'int', 'page-size' : 'int', - 'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64', - 'precopy-bytes' : 'uint64', 'downtime-bytes' : 'uint64', - 'postcopy-bytes' : 'uint64', - 'dirty-sync-missed-zero-copy' : 'uint64' } } + 'normal-bytes': 'int', 'dirty-pages-rate': 'int', + 'mbps': 'number', 'dirty-sync-count': 'int', + 'postcopy-requests': 'int', 'page-size': 'int', + 'multifd-bytes': 'uint64', 'pages-per-second': 'uint64', + 'precopy-bytes': 'uint64', 'downtime-bytes': 'uint64', + 'postcopy-bytes': 'uint64', + 'dirty-sync-missed-zero-copy': 'uint64' } } =20 ## # @XBZRLECacheStats: @@ -276,7 +276,7 @@ '*cpu-throttle-percentage': 'int', '*error-desc': 'str', '*blocked-reasons': ['str'], - '*postcopy-blocktime' : 'uint32', + '*postcopy-blocktime': 'uint32', '*postcopy-vcpu-blocktime': ['uint32'], '*compression': 'CompressionStats', '*socket-address': ['SocketAddress'], @@ -551,7 +551,7 @@ # Since: 1.2 ## { 'struct': 'MigrationCapabilityStatus', - 'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } } + 'data': { 'capability': 'MigrationCapability', 'state': 'bool' } } =20 ## # @migrate-set-capabilities: @@ -1634,7 +1634,7 @@ # Since: 2.9 ## { 'command': 'xen-set-replication', - 'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' }, + 'data': { 'enable': 'bool', 'primary': 'bool', '*failover': 'bool' }, 'if': 'CONFIG_REPLICATION' } =20 ## --=20 2.40.1 From nobody Sun May 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204430; cv=none; d=zohomail.com; s=zohoarc; b=P3c1c7MIcP1UCO5espeR0A6wg4tjd79GnK3FPH+vOYmI+NomTHZzGmR6RKwUyJDN0edIn5x5eZIiY/ZQJf0ae4vFyUHEv4xgClF7/vVnldX/W4wlzOLy2nkGXeXRkAc+JvPjsCTCrLo7BlLGvfPUh8pv8k4a/YQuLTCCI6ELkZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204430; 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=DgfPHen12kn/Tt0KY2EYgK30m6PxOvFEC8h9F1aKAnY=; b=SIoLtl/UAa1dAuQBoBmN7XOsOdbQIvgsMV0jch63VcARgws7wb2oGCJ/XvQ+Ji7Kyp4vPXMAFrSNj9rW/qYK4hkNeatgqHOhmfUp2L75yeTW0eKNr7miwCyRqyWjVGevt748sbXBPVWk3cpj00wyvGsURbn9aVXDmLoaQa1mcVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204430945739.753141081561; Mon, 24 Jul 2023 06:13:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvI3-0004rl-OR; Mon, 24 Jul 2023 09:07: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 1qNvHV-0004Aq-Qg for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:21 -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 1qNvHU-0002cl-9G for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:21 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-78-jrcKU4RuOkOktaYuaZuFAQ-1; Mon, 24 Jul 2023 09:07:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6002381180C for ; Mon, 24 Jul 2023 13:07:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D4D110E5E; Mon, 24 Jul 2023 13:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204039; 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=DgfPHen12kn/Tt0KY2EYgK30m6PxOvFEC8h9F1aKAnY=; b=Dgo7Pjfc02MmO00wKPVHL73g1hjc8R8IRNpt8RXwqqv07nLEAPS+TGyp+MEcA3d2Ns5Cyv ENUaaWyBMXjvPIadOYJCAbopVzQixllSbZElJ/oEB9cKo6LB0uF4cM9UULSIRaIbbBFRC1 CC1MrD/AMsPTqt4i1itcEBaYqIo06Bs= X-MC-Unique: jrcKU4RuOkOktaYuaZuFAQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 16/26] migration: skipped field is really obsolete. Date: Mon, 24 Jul 2023 15:06:29 +0200 Message-Id: <20230724130639.93135-17-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204505495100001 Has return zero for more than 10 years. Specifically we introduced the field in 1.5.0 commit f1c72795af573b24a7da5eb52375c9aba8a37972 Author: Peter Lieven Date: Tue Mar 26 10:58:37 2013 +0100 migration: do not sent zero pages in bulk stage during bulk stage of ram migration if a page is a zero page do not send it at all. the memory at the destination reads as zero anyway. even if there is an madvise with QEMU_MADV_DONTNEED at the target upon receipt of a zero page I have observed that the target starts swapping if the memory is overcommitted. it seems that the pages are dropped asynchronously. this patch also updates QMP to return the number of skipped pages in MigrationStats. but removed its usage in 1.5.3 commit 9ef051e5536b6368a1076046ec6c4ec4ac12b5c6 Author: Peter Lieven Date: Mon Jun 10 12:14:19 2013 +0200 Revert "migration: do not sent zero pages in bulk stage" Not sending zero pages breaks migration if a page is zero at the source but not at the destination. This can e.g. happen if different BIOS versions are used at source and destination. It has also been reported that migration on pseries is completely broken with this patch. This effectively reverts commit f1c72795af573b24a7da5eb52375c9aba8a3797= 2. Reviewed-by: Daniel P. Berrang=C3=A9 Message-ID: <20230612193344.3796-2-quintela@redhat.com> Signed-off-by: Juan Quintela --- docs/about/deprecated.rst | 10 ++++++++++ qapi/migration.json | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 02ea5a839f..1c35f55666 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -451,3 +451,13 @@ both, older and future versions of QEMU. The ``blacklist`` config file option has been renamed to ``block-rpcs`` (to be in sync with the renaming of the corresponding command line option). + +Migration +--------- + +``skipped`` MigrationStats field (since 8.1) +'''''''''''''''''''''''''''''''''''''''''''' + +``skipped`` field in Migration stats has been deprecated. It hasn't +been used for more than 10 years. + diff --git a/qapi/migration.json b/qapi/migration.json index 7ccb28e64f..bc9ae3fef7 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -23,7 +23,8 @@ # # @duplicate: number of duplicate (zero) pages (since 1.2) # -# @skipped: number of skipped zero pages (since 1.5) +# @skipped: number of skipped zero pages. Always zero, only provided for +# compatibility (since 1.5) # # @normal: number of normal pages (since 1.2) # @@ -62,11 +63,18 @@ # between 0 and @dirty-sync-count * @multifd-channels. (since # 7.1) # +# Features: +# +# @deprecated: Member @skipped is always zero since 1.5.3 +# # Since: 0.14 +# ## { 'struct': 'MigrationStats', 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , - 'duplicate': 'int', 'skipped': 'int', 'normal': 'int', + 'duplicate': 'int', + 'skipped': { 'type': 'int', 'features': ['deprecated'] }, + 'normal': 'int', 'normal-bytes': 'int', 'dirty-pages-rate': 'int', 'mbps': 'number', 'dirty-sync-count': 'int', 'postcopy-requests': 'int', 'page-size': 'int', --=20 2.40.1 From nobody Sun May 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204442; cv=none; d=zohomail.com; s=zohoarc; b=dH1BDgX4wBV1BE8148A8VHXCMz/2at5Fe125TDN4yHMVvpNhJ3HCA700VpYImhYifXZRBse/BzeXtcWR/T2V8ZbaN0GRuH4qnVTV2UeZYRcCxxPF4+SEtHwuUZKCCWkauQvgXCdVtERgKrMxwpbzNpVNylNgKKlbF/NzHyG9sXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204442; 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=QiOZ1ggUM9oK6J9I8Tk59DOGpnsa6ThaMxsEexebhCs=; b=cL8huRB6PLRhyxjwqtXmcoYy/r6IArvc69nNpLwkE+8ezQsbxxWrksAcZ+ZYFuZN3vXYeNlDGKT+Iw9dO6MihYm41to7HArWLnML792c9N50ebF5cGe6AyOAjdVYrMkLicMJsKEfPa1snAHZS96m93k+7oBiRwPSWctIRBc5R4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204442186626.1057419127526; Mon, 24 Jul 2023 06:14:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvHs-0004Rd-Kz; Mon, 24 Jul 2023 09:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvHY-0004J1-Uq for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:26 -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 1qNvHW-0002d7-0i for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:24 -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-563-01Bwvm0CM3aGJt8s18SB1A-1; Mon, 24 Jul 2023 09:07:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09AE988D2AB for ; Mon, 24 Jul 2023 13:07:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3609E10E5E; Mon, 24 Jul 2023 13:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204041; 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=QiOZ1ggUM9oK6J9I8Tk59DOGpnsa6ThaMxsEexebhCs=; b=NxRlscXheFrEqUXqlnbOHYaFqCCm1dWjPME/Cp4lPoTAPUDhkA1ImLEvXdDINdwEU+sBtL mFhlCkT7FLoPyE0YBj1He0RvKTjWIZbD/eR1zq5KITwxl9zAEEZyQHUK/bgslXsp/6Ttz4 YARCTMe4gWXwrjSBcEcPuSw8I6A1JCo= X-MC-Unique: 01Bwvm0CM3aGJt8s18SB1A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Laszlo Ersek Subject: [PATCH 17/26] docs/migration: Update postcopy bits Date: Mon, 24 Jul 2023 15:06:30 +0200 Message-Id: <20230724130639.93135-18-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204514175100003 Content-Type: text/plain; charset="utf-8" From: Peter Xu We have postcopy recovery but not reflected in the document, do an update for that. Add a very small section on postcopy preempt. Touch up the pagemap section, dropping the unsent map because it's already been dropped in the source code in commit 1e7cf8c323 ("migration/postcopy: unsentmap is not necessary for postcopy"). Touch up the postcopy section to remove "network connection" failures as downside, because now it's not fatal and can be recovered. Suggested by Laszlo. Acked-by: Laszlo Ersek Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Message-ID: <20230706115611.371048-1-peterx@redhat.com> Signed-off-by: Juan Quintela --- docs/devel/migration.rst | 94 ++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 27 deletions(-) diff --git a/docs/devel/migration.rst b/docs/devel/migration.rst index 6f65c23b47..c3e1400c0c 100644 --- a/docs/devel/migration.rst +++ b/docs/devel/migration.rst @@ -594,8 +594,7 @@ Postcopy 'Postcopy' migration is a way to deal with migrations that refuse to conve= rge (or take too long to converge) its plus side is that there is an upper bou= nd on the amount of migration traffic and time it takes, the down side is that d= uring -the postcopy phase, a failure of *either* side or the network connection c= auses -the guest to be lost. +the postcopy phase, a failure of *either* side causes the guest to be lost. =20 In postcopy the destination CPUs are started before all the memory has been transferred, and accesses to pages that are yet to be transferred cause @@ -721,6 +720,42 @@ processing. is no longer used by migration, while the listen thread carries on serv= icing page data until the end of migration. =20 +Postcopy Recovery +----------------- + +Comparing to precopy, postcopy is special on error handlings. When any +error happens (in this case, mostly network errors), QEMU cannot easily +fail a migration because VM data resides in both source and destination +QEMU instances. On the other hand, when issue happens QEMU on both sides +will go into a paused state. It'll need a recovery phase to continue a +paused postcopy migration. + +The recovery phase normally contains a few steps: + + - When network issue occurs, both QEMU will go into PAUSED state + + - When the network is recovered (or a new network is provided), the admin + can setup the new channel for migration using QMP command + 'migrate-recover' on destination node, preparing for a resume. + + - On source host, the admin can continue the interrupted postcopy + migration using QMP command 'migrate' with resume=3Dtrue flag set. + + - After the connection is re-established, QEMU will continue the postcopy + migration on both sides. + +During a paused postcopy migration, the VM can logically still continue +running, and it will not be impacted from any page access to pages that +were already migrated to destination VM before the interruption happens. +However, if any of the missing pages got accessed on destination VM, the VM +thread will be halted waiting for the page to be migrated, it means it can +be halted until the recovery is complete. + +The impact of accessing missing pages can be relevant to different +configurations of the guest. For example, when with async page fault +enabled, logically the guest can proactively schedule out the threads +accessing missing pages. + Postcopy states --------------- =20 @@ -765,36 +800,31 @@ ADVISE->DISCARD->LISTEN->RUNNING->END (although it can't do the cleanup it would do as it finishes a normal migration). =20 + - Paused + + Postcopy can run into a paused state (normally on both sides when + happens), where all threads will be temporarily halted mostly due to + network errors. When reaching paused state, migration will make sure + the qemu binary on both sides maintain the data without corrupting + the VM. To continue the migration, the admin needs to fix the + migration channel using the QMP command 'migrate-recover' on the + destination node, then resume the migration using QMP command 'migrate' + again on source node, with resume=3Dtrue flag set. + - End =20 The listen thread can now quit, and perform the cleanup of migration state, the migration is now complete. =20 -Source side page maps ---------------------- - -The source side keeps two bitmaps during postcopy; 'the migration bitmap' -and 'unsent map'. The 'migration bitmap' is basically the same as in -the precopy case, and holds a bit to indicate that page is 'dirty' - -i.e. needs sending. During the precopy phase this is updated as the CPU -dirties pages, however during postcopy the CPUs are stopped and nothing -should dirty anything any more. - -The 'unsent map' is used for the transition to postcopy. It is a bitmap th= at -has a bit cleared whenever a page is sent to the destination, however duri= ng -the transition to postcopy mode it is combined with the migration bitmap -to form a set of pages that: - - a) Have been sent but then redirtied (which must be discarded) - b) Have not yet been sent - which also must be discarded to cause any - transparent huge pages built during precopy to be broken. - -Note that the contents of the unsentmap are sacrificed during the calculat= ion -of the discard set and thus aren't valid once in postcopy. The dirtymap -is still valid and is used to ensure that no page is sent more than once. = Any -request for a page that has already been sent is ignored. Duplicate reque= sts -such as this can happen as a page is sent at about the same time the -destination accesses it. +Source side page map +-------------------- + +The 'migration bitmap' in postcopy is basically the same as in the precopy, +where each of the bit to indicate that page is 'dirty' - i.e. needs +sending. During the precopy phase this is updated as the CPU dirties +pages, however during postcopy the CPUs are stopped and nothing should +dirty anything any more. Instead, dirty bits are cleared when the relevant +pages are sent during postcopy. =20 Postcopy with hugepages ----------------------- @@ -853,6 +883,16 @@ Retro-fitting postcopy to existing clients is possible: guest memory access is made while holding a lock then all other threads waiting for that lock will also be blocked. =20 +Postcopy Preemption Mode +------------------------ + +Postcopy preempt is a new capability introduced in 8.0 QEMU release, it +allows urgent pages (those got page fault requested from destination QEMU +explicitly) to be sent in a separate preempt channel, rather than queued in +the background migration channel. Anyone who cares about latencies of page +faults during a postcopy migration should enable this feature. By default, +it's not enabled. + Firmware =3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.40.1 From nobody Sun May 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204232; cv=none; d=zohomail.com; s=zohoarc; b=QYJKX5v+ydgzfDm3gjTce6mYZKaACWZV9wPYL/3xXtjvCKvs5rE4ryfbcj6viK6R/gnUsxUKWz1ltYdAY80Zt9SYuvZLCz2bSz5/l0YpR/esxs//fCjCH4Lu+UpwSV7J+FH1d0QN6CdFeEa0t22d8t3JAVTQXt3Hv9C15xUfHyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204232; 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=KI3dFGgJCVIkFT6zm9OUq1Zb8EsTegJDKH5PB9xMTL0=; b=ACoeuB+teeG7wZTcgo7WzMZTwtmItm/DkijuJndqQkGBmfdcu2+2FfY5gzebO0X9qiGCwy2qdbGVCIW+TEmzHbkJJTfmaiNsy8feEWDxHTk3G+oqwKPtNbuEdqCJ8UKceSBgJh5pG1zyVidwl7qu0fDC50W9gFmZMK7lcBcIu9M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169020423251370.35136696886195; Mon, 24 Jul 2023 06:10:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIw-0006p4-U0; Mon, 24 Jul 2023 09:08:50 -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 1qNvIb-0005jI-C1 for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:30 -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 1qNvIL-0002pP-Qk for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:15 -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-597-VB5_ChLlPlOEaFpI4v1uGQ-1; Mon, 24 Jul 2023 09:07:21 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1F1F488D06E; Mon, 24 Jul 2023 13:07:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F03FF782D; Mon, 24 Jul 2023 13:07:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204092; 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=KI3dFGgJCVIkFT6zm9OUq1Zb8EsTegJDKH5PB9xMTL0=; b=ETl+TY/AWBKGQ+UAobX7qT1ekzunpSP4Vn5dWhkRcTHMBfOfJ/HDaUP+2vY1eab8PT1RN5 17CCS3p03fjQvxnBMFSGTtuaFaNR2Yg3THbLFbRP3EUOSE6BkQbtLB0Tfvj8gGHGJ8Bbh8 epEmJr14CrWWEkBUMIBFyiGBY029PM8= X-MC-Unique: VB5_ChLlPlOEaFpI4v1uGQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Tejus GK Subject: [PATCH 18/26] migration: Update error description whenever migration fails Date: Mon, 24 Jul 2023 15:06:31 +0200 Message-Id: <20230724130639.93135-19-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204353217100001 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 1ea7512291..5528acb65e 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1689,7 +1689,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, if (!resume_requested) { 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); @@ -2082,7 +2082,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; @@ -2192,7 +2192,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 @@ -2229,7 +2229,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); } @@ -2750,6 +2750,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; bool can_switchover =3D migration_can_switchover(s); =20 @@ -2773,8 +2774,9 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) /* Still a significant amount to transfer */ if (!in_postcopy && must_precopy <=3D s->threshold_size && can_switcho= ver && 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; } @@ -3265,8 +3267,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; } @@ -3290,6 +3294,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204395; cv=none; d=zohomail.com; s=zohoarc; b=lCrYTOMnEiNQ9uEVsNnWN3wV7ym2WKGZ3giU7p1nBX8s0+7YkUNwbwjwYS1NkdnswN/L5bs6YXBB8KXUzdpqv/1gPtUjAqGN8/5JH3fURoMvrJ0EmHc0i0/hMJTyFJAa/PmQ0XzoWIB83lHNakhTRgBeFwwzL4MG1TqEk5q51VI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204395; 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=b0o4U99LJ9kK5FwaBfgO5EQigxi+V8F9l3IWjv5C77I=; b=Tak2c8Dv/5FftFZT1H/RCqcUolbrgKzwkdOU5FFLOWbZRFEERPmgf3A6vMqo7W34mq7fELSRQq7Csiyp58VyZUfYhtrRnOvICoG08SChrOJoZrTUPudSwQEKvJtWqQNDVxaZux4yMFZ1je9of42d7iNtJS5qJRUi2blx+w/U6wg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204395141394.2690242346173; Mon, 24 Jul 2023 06:13:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIz-00071O-IG; Mon, 24 Jul 2023 09:08:53 -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 1qNvIH-0005bJ-5A for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:14 -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 1qNvIE-0002oT-DB for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:08 -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-675-n3IFu84GP7ulHTEj2WKHGg-1; Mon, 24 Jul 2023 09:07:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3372888D06C; Mon, 24 Jul 2023 13:07:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 644DBF782D; Mon, 24 Jul 2023 13:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204085; 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=b0o4U99LJ9kK5FwaBfgO5EQigxi+V8F9l3IWjv5C77I=; b=bKTQVa56+gx1+O8yQhtjx2Xc1Y/3syeuiVaS9WSGOa/J3zeZJSWC8EywEmnAkSvT9E4cKE MDxtVpZU1jY/DWCEV/odr3pc7BZAxlit/TwVxjXtAvk2EJzxgMYyZpIW7/RHe9nWv0wZac XYu0Q71OPmJjUBka9amwA26LvtzjVJU= X-MC-Unique: n3IFu84GP7ulHTEj2WKHGg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Wei Wang Subject: [PATCH 19/26] migration: enforce multifd and postcopy preempt to be set before incoming Date: Mon, 24 Jul 2023 15:06:32 +0200 Message-Id: <20230724130639.93135-20-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204485342100001 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 7d83f190d6..1d1e1321b0 100644 --- a/migration/options.c +++ b/migration/options.c @@ -441,6 +441,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 * @@ -564,6 +569,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]) { @@ -571,6 +582,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_SWITCHOVER_ACK]) { --=20 2.40.1 From nobody Sun May 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204401; cv=none; d=zohomail.com; s=zohoarc; b=KPPxItapHxyr0HrYHXneoFEB15m3WyCk07Eh6a+ugA09DvAzvNtjvdXAUosLDosc1gExKjVew2LAXD1Ab+ljJLF8Cb/GBOSvR5soy4pxe9wyuvpXzpT1w8aFfnESpJsL0skuH4Zgj/gtTWS1EyQXRJiPtKh9LB40K3VEEwsfdks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204401; 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=FWFwDqx4JQfHRH7m6E9tS35/4X1yzQqreQewxBJ2yMc=; b=ZjuWfMMD3TIFXhX2duH5v3GXuP/xOLjJKAoV5ouLPT1EjLOyizUrWLPWWZMrBTsqDlLs++6OLGjTrbt3A0Bc0fK6Iekm66RvNHNoy4w8Fnar+u0zLSXRQvowqSoeaJ19p23JDjPVh0kd/4UVChDpOv58rLrZwBgOMkpeg0d2zTk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169020440156821.28627718366488; Mon, 24 Jul 2023 06:13:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIv-0006kV-VR; Mon, 24 Jul 2023 09:08:50 -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 1qNvHw-0004iW-Ry for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:50 -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 1qNvHu-0002j8-MQ for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:48 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-633-MM2c31prOXiJH1w_6zZj_g-1; Mon, 24 Jul 2023 09:07:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7269D38117E6; Mon, 24 Jul 2023 13:07:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B2CBF782E; Mon, 24 Jul 2023 13:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204059; 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=FWFwDqx4JQfHRH7m6E9tS35/4X1yzQqreQewxBJ2yMc=; b=E01OxJxgRSjpct84CqA3V/I/6a8ZlJGyb1qDwaqypaxfV79co9hPxmfRq5JoC2MuU/cHJr aj69ZuZiK0rzqeuaziLnrrc4xrLTL/3CPrgcahCRhU7jhlcqymrdOUmGkvi+eQNTvuUvHE WOmy4u7Y54De7Xv8IAUWy03HJBBmhrg= X-MC-Unique: MM2c31prOXiJH1w_6zZj_g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , Wei Wang Subject: [PATCH 20/26] qtest/migration-tests.c: use "-incoming defer" for postcopy tests Date: Mon, 24 Jul 2023 15:06:33 +0200 Message-Id: <20230724130639.93135-21-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204494659100001 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index fd145e38d9..62d3f37021 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1239,10 +1239,9 @@ static int migrate_postcopy_prepare(QTestState **fro= m_ptr, QTestState **to_ptr, MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); 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 @@ -1262,10 +1261,13 @@ static int migrate_postcopy_prepare(QTestState **fr= om_ptr, migrate_ensure_non_converge(from); =20 migrate_prepare_for_dirty_mem(from); + qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); =20 /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 + g_autofree char *uri =3D migrate_get_socket_address(to, "socket-addres= s"); migrate_qmp(from, uri, "{}"); =20 migrate_wait_for_dirty_mem(from, to); --=20 2.40.1 From nobody Sun May 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204395; cv=none; d=zohomail.com; s=zohoarc; b=ec5JgHysuoxalvjlpx+1RQo+z+H3f5tz4W2uWcYRVtWfYcFcjJLL1mMqB9LXs924blg51f7URvTVItfd7RSX2R2qH/VGaIgk7kbQLv2KlncU5PbBR8E1SukIIMN+f2ahwCejmVFqPSxvk9rPCVROk37dS8N2CVkaIjyr1twYVCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204395; 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=BZvjnHCDcjoJy/VQcFDdQTWd/9NEv2Kc87WInEpIMHM=; b=JmZTZ0ZsVXedyuDVmhihJbk0ABT10QSb7FfJxpMWhl5ZUGINbTyiVi+0CzGKHqUUWVLBtdDVDX7mLX4FH7DdKsKuL/0oeGz367a5qjzbCMjpvEdkfUqtxH2TmoEKo0YVZNpe5VvqiZygRaO8rOqvWWkFytu3di0/8dfkocSYKY0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204395272328.93599165215414; Mon, 24 Jul 2023 06:13:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvI6-00056q-Vl; Mon, 24 Jul 2023 09:07:59 -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 1qNvHi-0004S4-2l for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvHf-0002fj-Te for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:33 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-681-KxP_K1YSMESsBoN-woOjgQ-1; Mon, 24 Jul 2023 09:07:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8A77E38117E1; Mon, 24 Jul 2023 13:07:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id B69EEF782E; Mon, 24 Jul 2023 13:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204049; 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=BZvjnHCDcjoJy/VQcFDdQTWd/9NEv2Kc87WInEpIMHM=; b=WGOyBAxxRgeCSx9uxskq36Shj8wPu96ueTsbI3bb7WhCA8pElNoIJu0x1SHxAAxDOyeZxl FKDfqv4C9np3XzWV6f6VxiJQ0i4AgyroBv+/CXGy7xhZU0shEy55SZjfjRpAEgZaH+aMYN DEOCtcuGnJPp9XFfHMY27u4irPML10Y= X-MC-Unique: KxP_K1YSMESsBoN-woOjgQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 21/26] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Mon, 24 Jul 2023 15:06:34 +0200 Message-Id: <20230724130639.93135-22-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204480553100001 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 95c2abf47c..a07070db62 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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204395; cv=none; d=zohomail.com; s=zohoarc; b=FhwE+64lYagUEcSs1UYOBj6t89av+7OLnxRrV/pUu5CVuJ6/kcf/exu24/RQynKomTmYTqOGXYlTtp9I0u9u6ep9dKG9rBOEWqpHKn2ZsRfoYAp7yZQxiVMTsmn+hz0bY+uHCA0IsG71h60AfERWvpuOoWTuLoFPIb9PshEJWwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204395; 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=MeH7PktH+FNtsjfIYC6Epl9rNxUy5ZSfxM5KILDzoIU=; b=nlJ3v0p+NEALIPsvJbK3alwNs9ohKcHp0Q4WNuFDZJzsK+XExhHRweFmvtl0wmpMwOxbcwc+B5MlF8VaVA+i645fumRDVqPouar2Y+LExJzkT6aBKvnlJ4yiPiDwKbfRBOjZaeedOk6TluHi9JZpf189QWwcTSDh11XJgarkydY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204395635749.5961058625792; Mon, 24 Jul 2023 06:13:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIi-0005kK-O1; Mon, 24 Jul 2023 09:08: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 1qNvHq-0004W0-DF for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvHk-0002gO-1C for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:37 -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-63-RcIqkJY_OHyoVqiCkg6DHg-1; Mon, 24 Jul 2023 09:07:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A28CB8910F0; Mon, 24 Jul 2023 13:07:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE7DCF782E; Mon, 24 Jul 2023 13:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204053; 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=MeH7PktH+FNtsjfIYC6Epl9rNxUy5ZSfxM5KILDzoIU=; b=HtaKc32GOR69peQKHGalaWu6WA2/0Hg1jD0pk6tydnOLkcgk334TuZAMn61n61H50TbGW+ YYTPzmBtan95dZrFK6ONisQNSPY0VxrJS28DUV5DW7RTVlJUCQKrT0/b6Yo69qXy0/xcCi pTi9Qfyn+D/k3TeAZ/PCEfJ8UVCDUDA= X-MC-Unique: RcIqkJY_OHyoVqiCkg6DHg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 22/26] migration: Change qemu_file_transferred to noflush Date: Mon, 24 Jul 2023 15:06:35 +0200 Message-Id: <20230724130639.93135-23-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-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.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204488882100001 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 a07070db62..cc59ddaa87 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -3007,7 +3007,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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204447; cv=none; d=zohomail.com; s=zohoarc; b=A+HI3x0xwG/2HG8UC3TDzO3qXjJLvGIQYxgsvOmIe1tbwT1ZDOlpCAJ0aJR6eDUEzFIeXHkVBnbbMjOixcpZWUR5oEWP4CyA5ZdMa5iec0dpsiOkFZqkOW5lGyQ8RmolyNgJRkYV9d/mz9kktwTMPUB9khVzvcKldxNICfrYBVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204447; 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=ewGVx/KmcUqjrTDuhhsdYjPTI+Di6Q0boDPUzJYPY5FNW22ofh+19Ydp1O0ARWW5ILgYPo08yxTpzT23WGppfdraOM4G85aMkzIRO349r9ETxed2Qq0HGbJWZpa9GpNuqWWeZVGHxmPEhsSJ9xaIrkVfWXG5mZZp2Wh0SztVRzY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204447158710.1249887110931; Mon, 24 Jul 2023 06:14:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIs-0006Ow-ES; Mon, 24 Jul 2023 09:08:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvIH-0005bH-4z for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:19 -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 1qNvID-0002oH-Qb for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:08:07 -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-692-j6hQIc6yOJaSnOKHBjmeog-1; Mon, 24 Jul 2023 09:07:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CB73802A7D for ; Mon, 24 Jul 2023 13:07:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5E0B10E5E; Mon, 24 Jul 2023 13:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204085; 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=Y8M573Hc8F4o/hi8QldYpmFJUISmUIC2aUhQaf414xnXfaVPDWL16rnABuNtwTGOhcMhuA W3cu1/2xpslEFW5tClQ3u/FncXRGOP/RGMQHqLVNNB4kW8SrV/GjDPeGE9gudODWVhmuwC 7nMr6Bms0L3yqw67p3n995TGPXjoOcw= X-MC-Unique: j6hQIc6yOJaSnOKHBjmeog-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 23/26] qemu_file: Make qemu_file_is_writable() static Date: Mon, 24 Jul 2023 15:06:36 +0200 Message-Id: <20230724130639.93135-24-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204491793100001 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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204440; cv=none; d=zohomail.com; s=zohoarc; b=i8Ok5WDh5L6QYAkvYEUDWoYTQfSap2YOxHJuO576xjUYStlBHQ1wOlAgPxKf3ao9IPNYw8KX6Ok/lrRyEzFCdtMftT6RfESJecbO8avLgUMQfSeIyzalDYa/IXgdspS9hsDFruMeXK2vGS9cMDlkyx6iGRvoTAwfMpjY1dxDHms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204440; 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=iQnW3ccHLZ6cbMQmbq0AgGgALrPgOvxwNv9aUQ5dDjpAV/TTRXXY9OGsF30tG9RgOo6ryxBQYeqJC+VXlMd4p4rs5oPEhr+qH2QljVDSgEzoLjYntZAcOqjnmqR1hTOUxUjujm8vrGkUuOcdG/Sp9wZME8slO/FLxDrM9CxxJoY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204440708776.0809354193; Mon, 24 Jul 2023 06:14:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIs-0006Mg-2V; Mon, 24 Jul 2023 09:08:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNvHu-0004ek-RB for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:47 -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 1qNvHq-0002gl-4i for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:43 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-516-vJnbyCx1NBqlDV6sAHU_2A-1; Mon, 24 Jul 2023 09:07:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E70A51C0755D for ; Mon, 24 Jul 2023 13:07:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0947F782D; Mon, 24 Jul 2023 13:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204056; 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=dC0qAHfvU8Kl7aGjl7XJosxAgaQ2T6Y4ksJf3Dutdl5FdVac5WoOI8A7xFvFRuncwCIqCL FF5hD2tjIGN3V8XzFe6Cm/BJ3i9WajhsFVcxk7e4xJpGmmNhRvlAvfvgZ/zeFLEyyMVEoC 1Hw+dP1nhEc9HQoXyTgPlj9ojCFlU+k= X-MC-Unique: vJnbyCx1NBqlDV6sAHU_2A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 24/26] qemu-file: Simplify qemu_file_shutdown() Date: Mon, 24 Jul 2023 15:06:37 +0200 Message-Id: <20230724130639.93135-25-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204513676100001 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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204323; cv=none; d=zohomail.com; s=zohoarc; b=WbpdaHYLDbuBJDDmXiBg2Ch6ALDpeie6FvmvuplqrVaqFEmvoSrNItlHkfhT3HaWn3jBYh1V+zKOm9gBUvS+jsq8u37lWuzsiEKnWBY1vuC/wYTaVc9gZWOOM70yfIWJaes9CMaagAGx0LgQWLO8n356Ci2629xs0ieuhAEwfRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204323; 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=F5bPwo8ujgYpIF0HmcpOuxrsuIl1AR0U/IxPSBykFLyUeXwCp+Gopf2p0M2qeD0dOiLc2W/KZCwlAgu4r6+6AaDdOlHKsCcxBNG2pub6kC0T9jiP5pUUMAnQB8oeVACjuqqouSBTDioCqWlQ7WxB4Fhd86hHzZVlM9e2XlmIhDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690204323024469.2256371708095; Mon, 24 Jul 2023 06:12:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvIi-0005kH-N7; Mon, 24 Jul 2023 09:08: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 1qNvHu-0004ei-RK for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvHq-0002iF-9P for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-119-zvVFELhzNvmDgBl7aSxZHA-1; Mon, 24 Jul 2023 09:07:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 788A38870D8 for ; Mon, 24 Jul 2023 13:07:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 372BAF7833; Mon, 24 Jul 2023 13:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204060; 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=VTNNuKLBvT2j4Q4ekL5mCu3mJBTlmZrEnE2yb4ikD5D6RSs7UgCe1MNDJAlwmjC9NECWiW /7Dwz0wHdPhXTdE7hf7ys13PEWS5NXXafHFmCxVC/vYZcpmO3yVWk3C+mIvasQ99dAI0vy 8gT/43thobLm3AiC5cB3dMm5os4rOGc= X-MC-Unique: zvVFELhzNvmDgBl7aSxZHA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 25/26] qemu-file: Make qemu_file_get_error_obj() static Date: Mon, 24 Jul 2023 15:06:38 +0200 Message-Id: <20230724130639.93135-26-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204436895100001 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 19 10:12:01 2024 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690204082; cv=none; d=zohomail.com; s=zohoarc; b=A3jJBgTOramfI5ksTHSK/MPoZlTa8GIITXx0kkpNFjodau/srIxrGdd22uPxBI0HxeK83L/leMkZZAzS0bOWO190JiBOgT9EbvIj9CyhPpxngdoExOSrILzHfFD7LJhZKpdlcvcgbiv49UMBQcBrWD/2RunUp+kgJy5FmcYPreI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690204082; 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=UP9JfanStd1k0xUkK4woQz7lJxmbIn1DnMPyhMRnCQAFh1p9qxCDBtcAUTROGjK1sBLVW+MLy53RhO4+7ERdzYyakYqIfjt16kLBEjfX+X8UuX0fGG/G+272ifDlxiSH7Aw1XQr/tp7JNBJe9zb54D9bW5dD6mDva+AhLjUDDiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169020408232737.01821219384044; Mon, 24 Jul 2023 06:08:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNvI7-0005AH-Jg; Mon, 24 Jul 2023 09:07:59 -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 1qNvHu-0004ej-Ru for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07: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 1qNvHq-0002iS-Aw for qemu-devel@nongnu.org; Mon, 24 Jul 2023 09:07:45 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-561-BTqjnX92NWCf8wwoAEtGnQ-1; Mon, 24 Jul 2023 09:07:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D7061C07560 for ; Mon, 24 Jul 2023 13:07:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCE20F782D; Mon, 24 Jul 2023 13:07:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690204061; 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=S6B8LLUT+/zdH2vUoNDtzJ6/OtwdOH89nA186CIAjn9haU+RknI23kv9x2ovU+37U43Py6 hkX8nbXeUmP4dVQb0l3uq3qZIq27BaLubNq7pyhIdGnJ0CcOggOIfKktFqXswhxG4j2ig2 PJ8TiNlonZKpTQtuHiF3Xcu2nYn234M= X-MC-Unique: BTqjnX92NWCf8wwoAEtGnQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Laurent Vivier , Thomas Huth , Markus Armbruster , libvir-list@redhat.com, Paolo Bonzini , Peter Xu , Eric Blake , Juan Quintela , Leonardo Bras Subject: [PATCH 26/26] migration/rdma: Split qemu_fopen_rdma() into input/output functions Date: Mon, 24 Jul 2023 15:06:39 +0200 Message-Id: <20230724130639.93135-27-quintela@redhat.com> In-Reply-To: <20230724130639.93135-1-quintela@redhat.com> References: <20230724130639.93135-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690204204802100001 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