From nobody Sun May 19 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373758; cv=none; d=zohomail.com; s=zohoarc; b=hskqJESs8LkXU3NtpGjrUe71s3FeUmAf48IFmeB+e5sgnoOoNiCw686aX7oDgtQMWVaMQWoTp09cztXgvUPNg138W77dh9NemT3fdDZIzYkG7A4TBxsqImkrKFvIhM2P47JrLMvMsZBjpU2nvXJ8dvT/ZQj1tlEoF6TZhvq10BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373758; 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=VyedKh1dNtVU/WHKU4Zp18V/WTgaYdHAH48231Q1C1Q=; b=Dga32QCjCWldzH7FuoPW4Ge8esM1cNR58wIJ+hQh73zjJBgx3Z/OSI1ITMNSMqNv+R1/IpAmtAnnEX2lKKlJeNqCK7GEgiGUIx/DlswNyUzA8JusMD46XRgv2KSJqvy784LQ1+dggeR+1h1GrtWgf5rR0eXcPgmUn4vYmQCYFP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373758454801.1992437841798; Wed, 26 Jul 2023 05:15:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQQ-0006J1-C1; Wed, 26 Jul 2023 08:15:30 -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 1qOdQA-0006IF-L7 for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:19 -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 1qOdQ5-00040b-1f for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:11 -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-342-jDJH2vJ_Mf-qSipeWKULZw-1; Wed, 26 Jul 2023 08:15:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1031B185A78F; Wed, 26 Jul 2023 12:15:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1844040C206F; Wed, 26 Jul 2023 12:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373708; 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=VyedKh1dNtVU/WHKU4Zp18V/WTgaYdHAH48231Q1C1Q=; b=OTcBoUVWhWlqS7M95hN4J2oxeroJbYprbOdQkZvTabbaGw8PyzCixDwoFLdgtqlJHAqffy v1zVRzmVDtbJMocVpKaeo8H6pj4GMq6VRuwjju01O9UhOwFwooJxGJZwMb3o+hqgM0ubpB wG9o99+fd5gh0dVVX0Dm5dyY22QTcbk= X-MC-Unique: jDJH2vJ_Mf-qSipeWKULZw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Fabiano Rosas , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/25] migration/multifd: Rename threadinfo.c functions Date: Wed, 26 Jul 2023 14:14:35 +0200 Message-Id: <20230726121459.1837-2-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373759288100001 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 0e3ae87449..0f6b203877 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374572; cv=none; d=zohomail.com; s=zohoarc; b=ZtguQU6D+lGT50n+7RkvdhLnkeijhtZ//hGtp0nZZdcsaT4oRmY6Sa2A9OOxIVkaZcwA7IBC8B7Jkerg7oVgn+N4vH1jFF/QYSmfHhL9mJIcnesZZolew4iYm1HJdUcA0iUyA83tw06fxcXxUdbSd3EayGiECCbDAh854SJM2C0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374572; 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=Do+ahMxSpFb3xZTsovb3PeDX3sjOjkFIk83gh9LiK0/znqgVl25BFRrbgYM4yZ9JeHQiFOzbhl2o1L+y6jYpond2DXMWbxXJPTbxDTAz+u+HUSaBaC33akNUqsEJLQzRjHH6IuLbXWG9x/c+QEr9UHLL2Han4fLeuUsaok1u8lM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16903745725231000.6007325573948; Wed, 26 Jul 2023 05:29:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQe-0006RO-Gf; Wed, 26 Jul 2023 08:15:44 -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 1qOdQI-0006Ip-Sa for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQA-00041Z-DO for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15: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-687-A-TJVrUdN3SRiuoJpsV5PA-1; Wed, 26 Jul 2023 08:15:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7AF1B803FDC; Wed, 26 Jul 2023 12:15:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58CC440C2063; Wed, 26 Jul 2023 12:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373713; 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=LBdriHBcnXTmKrQEfUcjOxYQBwuIxIdWoKdZPaJiDBA46+NWIIpN2hn1O48cK1DfgS41zN yjAZt6ogqyuHM6ugXUlVQ0gIEh+ryR6Ohpnh4rQFLON4SPj6iaGEXQzQMHIbDbkN07ZE8M nxPnXA/1MzE11dOWeDMABsZG7zCJtdk= X-MC-Unique: A-TJVrUdN3SRiuoJpsV5PA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Fabiano Rosas Subject: [PULL 02/25] migration/multifd: Protect accesses to migration_threads Date: Wed, 26 Jul 2023 14:14:36 +0200 Message-Id: <20230726121459.1837-3-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374574555100003 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373813; cv=none; d=zohomail.com; s=zohoarc; b=APLw39g4UVfKITHPVZJTZjCQqjc9Ws7yTur+TP8/WQ87Ihx02ujUEEOrOeSoswGMX3GLF1GKXPZVygUWQe6eMFyVH1B4mSWe/xCu/Ao8l/AQUfn0nCTOZy5cCT2x91Q/saOuIGInLFiI9Rj/ShygiXgS2L/62wiDkzBxbAWvAhg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373813; 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=Hqx91fzqfU13mavVD/kJ2kV6Qi7zoGydWmz9ZFXkk64DvyRVvdVnu5qPf58G+WJxkhj7WyGzRt9a4egrocCdUV2XOe6PA0YHISmlRTgFmGr5IgaG4jwsZNwerL9tVCkCPa8lQRcBMAloowU4bqGoBxh4cUkzpk28UAdpQVRVhTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169037381351462.94078394967471; Wed, 26 Jul 2023 05:16:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQc-0006OR-41; Wed, 26 Jul 2023 08:15:42 -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 1qOdQK-0006Iu-JJ for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQI-000420-Fb for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:23 -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-516-cTcmUdC6MliUDNiLphW9gA-1; Wed, 26 Jul 2023 08:15:13 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3EE9E88D543; Wed, 26 Jul 2023 12:15:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 37F7A40C2063; Wed, 26 Jul 2023 12:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373715; 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=SQ08aElKZSw0/yX/iO9sytSZoSsxfmQSMmwPQcK6CPw/ICYns4p8igNX7HXo/ivYLEtY60 A+J8qO3Pyl7qygyMWKQw/qEaUMAn1FnJgM9zGtG5ZT42b0WGn/vnIuTFe9/feTAa0Q/DAX UmGKHTn+yIOvUAdrNwNboLpXJbMSRwU= X-MC-Unique: cTcmUdC6MliUDNiLphW9gA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 03/25] softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" Date: Wed, 26 Jul 2023 14:14:37 +0200 Message-Id: <20230726121459.1837-4-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373814947100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690375070; cv=none; d=zohomail.com; s=zohoarc; b=IMSpTC7GKOvGa43tLE3lEppk8ZoHrd/aHXG9MpI13gASzr39bIZ3pMpiBUFC+ztzdb+OC2Wua3Mk9+J1itPMBoV7rRJ9zeRb1T7DUMquCrzBQVi2k+3I9c32pKfuM/LA5EhjCXclU51rtjVuXBkmI+9/BdPjwpMetUGuHRE93t0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690375070; 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=jQWTBvoxz5EcIB7ksnBy1+OW/aao1/ABKQxVmku2m4c=; b=bVpVgLfiysl194G2tzxBoJxMz7IVHB3yOUzs+Pg5xn7htuOatWEvr3bmQV1fpKTOfOrq9D7dSBgWEPdw9T6fXOtUrmoKBVmVjqObmaGVf+nYGYyTQ2TXh/3SMihy8/hxR9H23rgLk11JVFAs4GfVVzuzER/0PwhLjhliaPMSGs8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1690375070474957.0640719104689; Wed, 26 Jul 2023 05:37:50 -0700 (PDT) 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-616-jODnPO1NPrq54pHWz6u97g-1; Wed, 26 Jul 2023 08:37:43 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3BBD9104459E; Wed, 26 Jul 2023 12:37:41 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DD4640C2063; Wed, 26 Jul 2023 12:37:40 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5658F1949754; Wed, 26 Jul 2023 12:37:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B8AFD1946A69 for ; Wed, 26 Jul 2023 12:15:15 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A6FC040C2070; Wed, 26 Jul 2023 12:15:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87EC540C2063; Wed, 26 Jul 2023 12:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690375069; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jQWTBvoxz5EcIB7ksnBy1+OW/aao1/ABKQxVmku2m4c=; b=S/DXu3pd/3BgJbu4BnhuFqsZZqjzbmiLhV1DVCccmbOltR/5kuagTiiIVO3so3VRabpmGO j1Iv1HahIDhTg5dlSgBeRoX1WfBnVKKDw90vg/mvDkBVKXXxeA3ysgX0A4KiLVIox1yVKb Nw57sZumHWPKbFhTkZ1nGk2o97yH4Tc= X-MC-Unique: jODnPO1NPrq54pHWz6u97g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 04/25] qapi/migration: Introduce x-vcpu-dirty-limit-period parameter Date: Wed, 26 Jul 2023 14:14:38 +0200 Message-Id: <20230726121459.1837-5-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= , Thomas Huth , Juan Quintela , libvir-list@redhat.com, Markus Armbruster , Peter Xu , Leonardo Bras , Paolo Bonzini , Eric Blake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690375071037100001 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 2a6565a0f8..d83b694fef 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373826; cv=none; d=zohomail.com; s=zohoarc; b=YoMJ26rR8V94Z3DAJ7p1+FmS2D+Pn2ZxufkVsGf9Jt/NAxcgFvsorfWG+55URT9A7Ow8ySyN7c/kJU5m/jdNyDbX6aC39fngLLjxISSbHAEmmwQmL+uGIdSAW+D+ArkWY0FheikXAzr9nnxOtAAx+Z/YNW0CQlPC+sF0bBe9ELM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373826; 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=rMcKwH5E6Z5l8jdM/rkAlSREQAGhXsHmKCn6OApLBYQ=; b=C84nbhktHn1YfCR0s9vwhOJYIV6CKWF/WKVX+MONx7c450OgZyMasuznC7AYmShBz7xwGWyURu8gzEQowPyxxtPBeYSjxOBAHuh7WNoq0ZLiSmROm6n7IkPdnBlPoTxHXxgeZ487gyu+woaJ3ItdtzGa/qtontxYg8I7mMoTJLw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373826923141.30797317886197; Wed, 26 Jul 2023 05:17:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQY-0006N9-5r; Wed, 26 Jul 2023 08:15: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 1qOdQL-0006J6-Ot for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:26 -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 1qOdQI-00042I-Fp for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:25 -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-554-NAr6zZbFOSqgcOfPpXMG6g-1; Wed, 26 Jul 2023 08:15:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F03EF3C01C25; Wed, 26 Jul 2023 12:15:17 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id E96B940C2063; Wed, 26 Jul 2023 12:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373719; 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=rMcKwH5E6Z5l8jdM/rkAlSREQAGhXsHmKCn6OApLBYQ=; b=X3jjPo4EmQO5oEePTwRx6/oUg0NAAT2FabVTzGefuoCPIRAYUR8Qj/Rz1pP9fuFqJYKfxA BDfp2AORmSLtM4qNTKRq3OpX9s1B3BJ/ofiO+1pbjQ91mjYLRp6hLwvL3EaSLXX5zH/RTc ygHI9nf1vdvCoZ7hNbI+nmihFTgtjQA= X-MC-Unique: NAr6zZbFOSqgcOfPpXMG6g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 05/25] qapi/migration: Introduce vcpu-dirty-limit parameters Date: Wed, 26 Jul 2023 14:14:39 +0200 Message-Id: <20230726121459.1837-6-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373827174100005 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 d83b694fef..22104cef08 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373766; cv=none; d=zohomail.com; s=zohoarc; b=MlJy+UMycFDt63YqTkenlb8f0OFbLgGM9GfvVFq7jDtvlLsnyTyt+4UHAoB9ktj5KALvZCnukH1FE2w4jTdDip1raOzcozJie2deAOH4J7wi08zQ4+OVYHuwuFr5QI0saRTpJU10ZekbI2179FyCRyaUmeZc3c2JAm0uAp2yN5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373766; 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=H5xVZHLAi1n7lqlqxg/2xkehCnFJZS62FuNXZRBX1zs=; b=VqfdBAP0zJLHPhR1KO3tXKOMhvKmby+RNqS7F4Z5quLyCgH8mWXMumbByBkzgvX7hDDaSqj42YoKx/nZlPePM9Khe+gk7f70VKxOr/5Uq2c72IZcQvlUMD+E5i3SPN6AKpngzq/P0wroP+gFMVlpL5oz3hbSxzJiy+F+7QNQztU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373766350176.05940096287588; Wed, 26 Jul 2023 05:16:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQc-0006R2-Nt; Wed, 26 Jul 2023 08:15:42 -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 1qOdQL-0006J5-OJ for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:26 -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 1qOdQI-00043V-Nv for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:25 -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-658-jOqL9tqdMRitelL0QQ219A-1; Wed, 26 Jul 2023 08:15:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4D5251C05B17; Wed, 26 Jul 2023 12:15:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42F7940C2071; Wed, 26 Jul 2023 12:15:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373722; 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=H5xVZHLAi1n7lqlqxg/2xkehCnFJZS62FuNXZRBX1zs=; b=ZPnOUfIGh5sbdqNWOzW9TrZ8kstlLI9sUEkuPLVxDjdLOWaBc/o0HCUVdDhQ1AamlV/gMK IcX98KCR0P/HTqo+X4p5OZsmbg47CCO0K/2/Svg2A06BifDF1v/DB+eLM06Td4W/f9A6aU NmwuQEHywNDeLf7VbPFt5bQM38P5ZIs= X-MC-Unique: jOqL9tqdMRitelL0QQ219A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 06/25] migration: Introduce dirty-limit capability Date: Wed, 26 Jul 2023 14:14:40 +0200 Message-Id: <20230726121459.1837-7-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373768593100003 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 22104cef08..e094438d74 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374126; cv=none; d=zohomail.com; s=zohoarc; b=XwP2uFV7FJHF0AkSLi6VT+BKBYo+5fu3Ia0mmwxgatFHvx5UnDwMiomcKPth2ugfM06BrPKlfCvMHqQ2GmaxkA3Kl+Xlcp1oSvbZ710eMqYny9gX5427SLW9NfXO8wMXn2AtGjyK/tWG8QJmtGTaS4Udh+ihyOYcsR2obGm12bA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374126; 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=m/xEygbWGwy2rWCaxJQvkRchpEQsyMNUfFE1Oyrd6yYVadVZgbvsHnCWf+LYCRaao5eKQ+XJAMhnLLTvZLJNjCZmfCgcmK4Ma7UT0Pz3xQqCESc9Q/9gIge6eZhsDQWNbG4vc4uzz7AHtxObhVZ9EI1Qaq9XIKMqiVaHs24DQ0g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374126537687.5506622555241; Wed, 26 Jul 2023 05:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQn-0006Vs-G7; Wed, 26 Jul 2023 08:15: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 1qOdQO-0006JN-1R for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15: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 1qOdQM-00045c-Ev for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15: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-284-waezE0KWOq-NVZzMpDbWZw-1; Wed, 26 Jul 2023 08:15:22 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6688B805AF6; Wed, 26 Jul 2023 12:15:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 930F540C2063; Wed, 26 Jul 2023 12:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373725; 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=DFG0QOAvOpYEdjsiUykpkItInD9om/tw8ik+134ujiI5/g7q02FHAd5cCuOOioLgxoDqa+ TBLhf24fh5Yc5JxtmMamH4IaV2vZGiF+RNE26GFX/V+NkhQv9LhhYLXfMDOoW4GRJN9Dkt 1BIBhdUkc9n2GEWxTO9FkfULETrtzi0= X-MC-Unique: waezE0KWOq-NVZzMpDbWZw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 07/25] migration: Refactor auto-converge capability logic Date: Wed, 26 Jul 2023 14:14:41 +0200 Message-Id: <20230726121459.1837-8-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374126896100009 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374982; cv=none; d=zohomail.com; s=zohoarc; b=cNOF60T/zUSyjdvkqPcmBzZd1O8Kz9CxJSgMyZfPbe8apXPGxFlf/436+7sJeyYWnpdZV2insi7WlHfoHVjRGyAGuH2zRq1yqh0RCs2kj8I6BXJUW8p+M0wYBtA46LaffxbLYe1bO1u3ioC8c9b97AXlcuV49JO5hPnJXhkZ138= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374982; 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=nR8rZxl46cPQtShVobmN2IB4i68W2oKoCiOnuvjTFVWClxNYx3qFpPazlLt5q/byNqCLpNKT2R6XJiwitbp26hQUiGSTTJe0Km76o05Xm0fHNZ6PWgI1Tk2zrVyd3Godu+kKGZcPWWwkWmGBTvmBFC+waVUR+ogEhPgKinXk80o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374982568972.7133529464907; Wed, 26 Jul 2023 05:36:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQh-0006Ss-LQ; Wed, 26 Jul 2023 08:15: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 1qOdQP-0006JP-G1 for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15: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 1qOdQN-00046G-KZ for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:29 -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-274-aaguZZcYOVevEnN1x0E4gQ-1; Wed, 26 Jul 2023 08:15:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9EF9C38008BC; Wed, 26 Jul 2023 12:15:24 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB79F40C2063; Wed, 26 Jul 2023 12:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373727; 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=c9Xvp8garExJVILs10aZOHvi8e3WZZIX4sEfiVjAmM3sUcVm+UBwg0AbzfMmJAwV1ksooa jS8u47mXRO81W77ebvdUjWAWNGnNaOQyAAmOsHxvKOsxN5qwL7IJkdWntlYEzfxqIgBml/ gqtuabPDdWIHgQEZlMToGkb1rNQdL1k= X-MC-Unique: aaguZZcYOVevEnN1x0E4gQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 08/25] migration: Put the detection logic before auto-converge checking Date: Wed, 26 Jul 2023 14:14:42 +0200 Message-Id: <20230726121459.1837-9-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374984663100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374063; cv=none; d=zohomail.com; s=zohoarc; b=OFeKgb8jSR4xmGiazgh+3DLx/6IJIQefFQeme1zRaCc+511v+fjXpus/+bh031UJrGLCg60yBWlift1lB673UAw87CxvxO8DzU/wYhVXDF1mwRb5Q2pQgfyXbMyttOaoLYBodqWUNpnsLd3F+gYG09+K5WvI7nfD/C9vvUfbO7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374063; 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=U299hOTVWJxE7gVr88wRDLYa4jyam60RAjQX+AR4/jg=; b=bwP1DeE/4hhu9v3Ywi+I0LfrO91zhAalHPZycy2NqrW9RoGwuJud2PWaFaNRFjEPwniHrXAzU2Y0z4JX5Gz5EFCwxWbXpCLq77/HenduJ8HAsKufgbpb7gC2l++J15z3N6YSScRbtEWok2/Slb3yoMpxl6gFvHCTSsYX1978rrk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374063328906.3137070731275; Wed, 26 Jul 2023 05:21:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQt-0006Y0-2C; Wed, 26 Jul 2023 08:16: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 1qOdQW-0006NE-JH for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:37 -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 1qOdQU-00049m-LD for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-281-sY8vLiYROjSEKXoTyTxPhw-1; Wed, 26 Jul 2023 08:15:27 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DA090830DB2; Wed, 26 Jul 2023 12:15:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id E48DA40C2063; Wed, 26 Jul 2023 12:15:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373733; 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=U299hOTVWJxE7gVr88wRDLYa4jyam60RAjQX+AR4/jg=; b=hcd7RUZUUoMz+S+U4FqD0AqioSd3xKa7DKwVuhkZvaDRMLR3iYI/ebdjnlqhCynD+8AZma Zouyj808ZSmpi4eI+PedpFi+XegHlMnlBBL0Y1rzEb5/b8YHkRYQURGNx4jCnTMrF9iF0J YPvSBP8Ymk6RxW30whXf33GyBgZV7X8= X-MC-Unique: sY8vLiYROjSEKXoTyTxPhw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 09/25] migration: Implement dirty-limit convergence algo Date: Wed, 26 Jul 2023 14:14:43 +0200 Message-Id: <20230726121459.1837-10-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374065091100001 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 4e43fe20fc..4666f19325 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373808; cv=none; d=zohomail.com; s=zohoarc; b=ia4lbBtU0fPYtMYcRrbBZve0OfDZ7/u4S1IHXGOv436Fwr9/GPyxTWNs0evqNNGd0WbNA4ksU+Z6yIaNKXMTJRvukYlkGm3d+AgbogIiSDe6rZTAJxa/ux/TIUOiSolYpMHu5NO+bbm1TsFgPmag1tA3OULmadatweyjZTJ1wLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373808; 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=uC8d0Ym5z5uwYHIoa8kmwHE/GhjM0qxDwYi4PZSizBA=; b=Auxi0E2Xte0gXwoLOEjxOJ5NCceyqkFr6rO9x6d9odqNXp3DhlYJHqCDBx0eFiNgYXU+TtVQtQ/cVbSx87mQeJ7zcBHtPDq3rKXB/4/JHeZBV4WsCKE4s7qOZfEcgIFF+zdCfOHbz+izSvQ3bydBYUbHxmd3u/wgWCf5V6oYUvk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373808183611.4338910392167; Wed, 26 Jul 2023 05:16:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQf-0006RZ-Av; Wed, 26 Jul 2023 08:15:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQW-0006ND-Dz for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:37 -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 1qOdQU-00049k-DT for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:36 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-567-LWW7i7lcOGaxOxvu5jCbIQ-1; Wed, 26 Jul 2023 08:15:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21DF6858290; Wed, 26 Jul 2023 12:15:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BC7C40C2063; Wed, 26 Jul 2023 12:15:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373733; 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=uC8d0Ym5z5uwYHIoa8kmwHE/GhjM0qxDwYi4PZSizBA=; b=Kx3yQj7ZBiffsbTeIVZPWX2ergnjtJjD60W9c1cJpV8TXDvf0wSm8/o12Wkk8cwQiNUu3x f1kV+ngET9gIpclHY9WM+dWOOXyC8Qd7gHsFkvUcaqpd4ol/IvfXybadT0w0pX7p+VOrH6 mxrz5pkUR1Xm5RwOYb5iUTtsP9e86ZQ= X-MC-Unique: LWW7i7lcOGaxOxvu5jCbIQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 10/25] migration: Extend query-migrate to provide dirty page limit info Date: Wed, 26 Jul 2023 14:14:44 +0200 Message-Id: <20230726121459.1837-11-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373808799100001 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 e094438d74..440660bced 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374209; cv=none; d=zohomail.com; s=zohoarc; b=ZiRp3T+h5pnCunlMOR9a9S2+aDmR2PZ59iYQbJh6l6mYk2aolZCwoAlePIh96soHDY1rNQ/1NVI3tHnqkCtmSN2rmQgrh3hC+8D/q3tSlnstEjDnnqLToCfEzjJ4lHyoYaJ2ixVJPoFAPGqnEEbM8GF9ns7KmoCpOiUmoMoCgNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374209; 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=lAEfFsqCdZKf9LJJjw1Xs4Tl+M7IgrwdZZJM6nayxR4CtIblrQBUbEoyVUhJm3hc+jPNA0ECfZAZTF4YY7cNqC35mO5n1LZR7vMyu1B0yd3xalIrHZ00/83cFtz3BL6UCd4AXFSvna3QTKYMc5157AMllD0+OBlXer3z0eKGr+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374209791571.7889362303207; Wed, 26 Jul 2023 05:23:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRe-0007Ce-6r; Wed, 26 Jul 2023 08:16:49 -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 1qOdQV-0006Ml-Ea for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:35 -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 1qOdQU-00049b-1e for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:35 -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-96-LIbh0xrLMpqxRQUM_hlmQA-1; Wed, 26 Jul 2023 08:15:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 175AE38008B9 for ; Wed, 26 Jul 2023 12:15:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6850940C2063; Wed, 26 Jul 2023 12:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373732; 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=e8ko95//HQQNIRx7hkmqgXB3mq1Ax+FsCVca6cOa0SaxQdT0JL/yQQ/0T3y9VM3bAMHfSF bUj7GAr6ERvxpqy9x5uWvMPuGtWpf7/M4lWrD3Q75PAkjlfC7laKfH4lRVZ6qxGfALIEee fpPmmHBfto6WM8awRjMwbRcERaPwi2I= X-MC-Unique: LIbh0xrLMpqxRQUM_hlmQA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 11/25] migration-test: Be consistent for ppc Date: Wed, 26 Jul 2023 14:14:45 +0200 Message-Id: <20230726121459.1837-12-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374210219100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374315; cv=none; d=zohomail.com; s=zohoarc; b=MG/xBVviymeQPIgwDNbhbP955AB7c1ebUqx16SpI9TY4yPlOHaQZlt1uWM+QuCo6tPj/8daJ+OtfkYzdqnCNIt6wx68VzJyvmZflemn1ABRhhESHbGkE6hShufgcRNRVvDYL4wibIYRtWFW4vWbfbaopQm+Ib0M9hjMkCl0yZ30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374315; 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=IO67mDSIPnuvh+bMP5pTUclRuVctvmn+VkgiGdOGWbE=; b=EPXWxES/qZh8fCoQTZJXRdiNL8zsWD9Z4aixmnY/Gqr4XOMddtmjlj2/1zNSw2KLX+4dT+v7vQaiPPL1btPlgrXmRz5OFLBmjy1rIt/el3TjkmD7nYPp5Sw5Tj21D+vy++WJTTuEEA1LjmsAfE69jO96HlZPKUrw/v36AOWYyQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1690374315520501.53706679008985; Wed, 26 Jul 2023 05:25:15 -0700 (PDT) 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-md_DLNYFMFOuEeyo0owJag-1; Wed, 26 Jul 2023 08:25:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6CC7318E0BDA; Wed, 26 Jul 2023 12:24:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06D4A4094DC2; Wed, 26 Jul 2023 12:24:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AEF171949754; Wed, 26 Jul 2023 12:24:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 503641946A69 for ; Wed, 26 Jul 2023 12:15:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 310A340C2063; Wed, 26 Jul 2023 12:15:33 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5D42E40C206F; Wed, 26 Jul 2023 12:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690374314; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IO67mDSIPnuvh+bMP5pTUclRuVctvmn+VkgiGdOGWbE=; b=cseQXlpv1endr1fM5gXqqFDHa+kZjpsMkkGkOOuQgWmvKBll/GWaEeareKgtR+6npRlDBo mHiJrjOq7GHF+xGiM1AivxFbWdoDIOPaT+VBIYVKkpca6rpmFDH0v9DK9yH0461IU4VYXO wKGY/6qCipLHv0cW6CP+paKUnhijup8= X-MC-Unique: md_DLNYFMFOuEeyo0owJag-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 12/25] migration-test: Make machine_opts regular with other options Date: Wed, 26 Jul 2023 14:14:46 +0200 Message-Id: <20230726121459.1837-13-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Juan Quintela , libvir-list@redhat.com, Markus Armbruster , Peter Xu , Leonardo Bras , Paolo Bonzini , Eric Blake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374317461100003 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374126; cv=none; d=zohomail.com; s=zohoarc; b=aYV9nArhAUWMnO3ey2ArXnm8GOr1jf/ykPG0gN6sKPSugzBkGHHetTUz8K/vUky5sO86IG5O6ury63NUjcWc9pq7ijsTD0Mrzi5g3C+1lEQLyBwtBge8/5Q4mFRsJszueQ/V0I1em8Oq42sE7jgRbcy8w3SyX9BQCSd37uq7zkw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374126; 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=FOJjifqM3CO0rZOzzEnlrQo+nu9Y6zON3mYys4QDpO5DMNBahkUCixbNHnTJPz8oH2IAtb4fL2WNiNXH+bNgZDxhChN+jhbpG/16lSjg6MyDOLyRHeQCWe8CQIAC9IuGsekVjDiCiU2/Mid73/YGABhU1lPzy6NbM9TohDx2RWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374126491282.28223916932507; Wed, 26 Jul 2023 05:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRT-000725-D8; Wed, 26 Jul 2023 08:16:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQZ-0006P8-QG for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:41 -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 1qOdQX-0004AQ-GH for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:39 -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-382-MkezuU0QO5m_4F8zXS0FDQ-1; Wed, 26 Jul 2023 08:15:35 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 483F82815E28 for ; Wed, 26 Jul 2023 12:15:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7699840C2063; Wed, 26 Jul 2023 12:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373736; 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=dTMgWPiztq8/6dZoQeHa9JcuiodoDcCDhW1A1NJ8h5WUjJjaoSSOSjwTkyBIFFLzfGa5z+ fa2iUG9EprQScP8g/0UccjkTrAP/gqXY3TOVAkc+WRD5LhK/8sGpjn1EzGE8n2MEFKNpRP QIrltvnZyNAY2WoWeszkff1DqLm6c2o= X-MC-Unique: MkezuU0QO5m_4F8zXS0FDQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 13/25] migration-test: Create arch_opts Date: Wed, 26 Jul 2023 14:14:47 +0200 Message-Id: <20230726121459.1837-14-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374127600100017 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373830; cv=none; d=zohomail.com; s=zohoarc; b=aK525m6cMDj6DQiij9HbtGlKGHXWL+xY3AbcjT/khXK5wrszmQlDsLa8gWdajxprQDr9EGVmu65PDSK2qBbhKmDSwb+q7fFQC2b0AfSdJPlm59SPsaaMM5ysvFl3xsliOLn6v0D5TGB4k3dknV9LOvYb3I/VMCmMl7ZPaAQvtvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373830; 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=kSaNHS7XcpjB/7/Vydj+Tpq0SkQpqH9LK8IiQFyhQxaT3/ALW3GPmFA4eP8fcRFzKYt4sRoZABHDWyv1fD508VdvZTzLBntvhaBxX32tuQxciAH/ugYb4RZUHqw6SL0Tn64oyyreGO1rFg8iZZ4YXlzVlohplUh55vQ4sA4Pwfk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373830441718.3416507246031; Wed, 26 Jul 2023 05:17:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRN-0006qo-H9; Wed, 26 Jul 2023 08:16:30 -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 1qOdQc-0006RA-SI for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQa-0004Aj-PU for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:42 -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-538-hQWyPz7WOIiXEbvtIP9H9g-1; Wed, 26 Jul 2023 08:15:38 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F438805AF7 for ; Wed, 26 Jul 2023 12:15:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F46740C2063; Wed, 26 Jul 2023 12:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373739; 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=GBTvhkgva22ULYnhxoqU5rJEQNbIC00njfWKcoyniQp3r6ya/LM0x+G70Wu62q8wNRioBb eJkx6n+of01ebEvqG1a+9s2ZbZdXJE1IjjAOD4MlkgdDp+Qwo44acP+ZsWWSb/3X4KGARR 9L0AIglJtBAhpRImq/5UgkK/ShSxCuo= X-MC-Unique: hQWyPz7WOIiXEbvtIP9H9g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 14/25] migration-test: machine_opts is really arch specific Date: Wed, 26 Jul 2023 14:14:48 +0200 Message-Id: <20230726121459.1837-15-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373831182100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373839; cv=none; d=zohomail.com; s=zohoarc; b=QK+i8+zH2jLZR0gBSXc2+kdig7Lg7uYKkRVvhxGonndYtAiN4lUKcNmaMJ9v+n1M7IRqP9sJ6eCSCuqKclEVgP7b0LeDxXiZmYbPlongXBB9XBOPzBTbeVdWqWfS5FP/xDJpq1DlfIiQCQjtphOllXzW0G8243+DYXKlsw2tZ8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373839; 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=f3x0NpgM3mvJ20NVMC0fW/AFj7Fy+5n9NDeTZHUDEUg=; b=j788izKpkFHhfwnRZ3GGIiLBxQ6DY/9ckszUb6IXzBLpjU0fYSCyi875k7eBoqzYvIFV6pyvH8bT0jBK3bbHD81ld40PrpSQyyq/c5Zn4PmWxPaZoIjmwV8BLBgNXaQaRgkI6ZVs4RDhK5OLOT0EOT6SdyhOFwmkgBMAtwlYCr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373839586177.27457156405364; Wed, 26 Jul 2023 05:17:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRp-0007Sa-JI; Wed, 26 Jul 2023 08:16: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 1qOdQe-0006RS-Id for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:45 -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 1qOdQc-0004At-2w for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-547-Ka5osULNPMOlp-yVDGgCyA-1; Wed, 26 Jul 2023 08:15:39 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E45580C4FF for ; Wed, 26 Jul 2023 12:15:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id B712E40C206F; Wed, 26 Jul 2023 12:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373741; 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=f3x0NpgM3mvJ20NVMC0fW/AFj7Fy+5n9NDeTZHUDEUg=; b=b/56bx+k2fvLjVKoW51AEiSIr+vxs8/lwR7uzKfXguX+7HhKqVu4dCF3ihobaAbW7+GPGe kpxPND06d8/MvUs0pFl5VMNiogMdZj7MM+ixDuE6a2q8VIdpj7/oBv6f54G9WfjR/+LkVe IQVd6DEh4SpwVRP48KnvLne701L6khE= X-MC-Unique: Ka5osULNPMOlp-yVDGgCyA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 15/25] migration: skipped field is really obsolete. Date: Wed, 26 Jul 2023 14:14:49 +0200 Message-Id: <20230726121459.1837-16-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373841220100003 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 440660bced..388425b4c8 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373823; cv=none; d=zohomail.com; s=zohoarc; b=iEt1LEW+Uf4JrhZvQdc/fwaM2lUlADRr7FzivyLacy5PBUA4GWdWt6NlyWFhsRLqR6WIFqSrkF/vKnCo7KQfiFCz/IRSDHRjP1D7pTXIsStjjegP28UI4fBEpkNQxaTq9k1th27+crHDvT/z4WWe23Gnu2YmKOvgTWSW/ESyEsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373823; 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=PAGxrp19DFYDubZgtXROFZsIdKLNAyRxPzBu42Q1KnzfuZ1jLT/9oQUniiy8Pvwcjxljz0SfRdW3z3rqiau7uinmx+Vu28yLiSrbZjjWYeSZfBaFb6Wl2z5NjaynPS0FXssczgb/s+9V8pmwUGpICEe9VIcAg+VJPJoHBGw9k3M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373823521845.1519073831039; Wed, 26 Jul 2023 05:17:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQl-0006To-J4; Wed, 26 Jul 2023 08:15:51 -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 1qOdQg-0006Sa-Jo for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQd-0004BY-Sb for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:45 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-288-9to0_j4nPsiBPW4O2gDYDA-1; Wed, 26 Jul 2023 08:15:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE094104459C for ; Wed, 26 Jul 2023 12:15:41 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id D488B40C2070; Wed, 26 Jul 2023 12:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373743; 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=L5PypNWybWdQIP1jW77luOFfHqpq+9J3pWFqV49Q20GYfDGjAzy7ajXx1aXsaSjTF6r73o g9GDraw2KBKqhzT+PtmD7XuQo0OE6ggr6kv4nB92FZEqlWnm4g+l4mvRr8QuCO5s3lvi91 ziuCBckwKPPqbKJu3zEIAmPdiEpw588= X-MC-Unique: 9to0_j4nPsiBPW4O2gDYDA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Laszlo Ersek Subject: [PULL 16/25] docs/migration: Update postcopy bits Date: Wed, 26 Jul 2023 14:14:50 +0200 Message-Id: <20230726121459.1837-17-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373825283100003 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373790; cv=none; d=zohomail.com; s=zohoarc; b=gtHBJlLD3k00NitiB2CagwoCEWhU3YGL9DAW1lQkDW6XpUzNy3Fj/7lt2woTiCj/JOM/00jQzVmdsEUSfTM7NaC+QcCjmLEspduNP2JxAt7y8iYbz+o2BxM48sNFGR6YBZ1F/jQmblhl8d7+H0OokgC7wZxR6q2YmM8QwCYtBhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373790; 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=B6Aq3qZfSb/4gs7ZysoTRX0/1ZTS3XnxJXDVNS8tQVwOitXoAJngcl/t/wxOY4t6iI0Ba1NCsGCdLL9dHPLqek1oQcK5A5feSubeQLPJ656r4Iyfq+N9Wd0KLF56Ibw8NXEisY2LHUfjlpMVyzsUFtUyEmvXPUXDcQtxSB0cWzw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373790396486.536502957685; Wed, 26 Jul 2023 05:16:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdQt-0006by-34; Wed, 26 Jul 2023 08:16: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 1qOdQl-0006V8-PN for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15: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 1qOdQj-0004Cl-JD for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:50 -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-384-kU6NwkRqMjy-0FbfF4CKtA-1; Wed, 26 Jul 2023 08:15:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14B6581DA29; Wed, 26 Jul 2023 12:15:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DC7040C206F; Wed, 26 Jul 2023 12:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373748; 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=IP1SYBA9PNtuMUFTN0iEUrf+JPbezSI9M2G44vxwUddG9LBOZC3x+5g3iEjiZpHwbyJbO9 NX3R3TF8oFAypLtELUIf1mlunKz3IXbk+7jickMah+PbhERicaMHSFjiQ7236zh3ZIs4uT 2rKct1vWDoKIKB0dPJLXigvYXFqoSYc= X-MC-Unique: kU6NwkRqMjy-0FbfF4CKtA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Tejus GK Subject: [PULL 17/25] migration: Update error description whenever migration fails Date: Wed, 26 Jul 2023 14:14:51 +0200 Message-Id: <20230726121459.1837-18-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373790788100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373903; cv=none; d=zohomail.com; s=zohoarc; b=jeyPdMa8sl92+Po02rgUsuAGPjofhePwekbUYIXWuEK9wAawwTxsqTzzG2bB2smfnbVxV6S8Y5P2kkw52H2w3LK6UQQmmYjEY8wMgZzdfsLCFcf6pZ6ayjtdrGcAgFGBt3biUnNaKRhdjB9u+Si6qMv9aJcQV9iy/FE9AWhjB3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373903; 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=FOczw+FEmTKaRBspKl66SYoIss6MQN2zg3qh3hkgNxg0qs1Jw++ekrK0lK4EE+2tPGpYVAK5iOg/qOiIigN8013fpiXvvfZVKCI9CLJkuZWqPut8clyq6OTM6QBad8WqtZkw0gklXr4keJ3dXGHx5bVybIorHGeerD04mz4mvng= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690373903043621.2381342668591; Wed, 26 Jul 2023 05:18:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRy-0008EJ-L4; Wed, 26 Jul 2023 08:17: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 1qOdQl-0006VE-Q8 for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQj-0004CV-JF for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:50 -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-231-b8jzowVwPqOqm3hxglDgcw-1; Wed, 26 Jul 2023 08:15:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 335E3802A7D; Wed, 26 Jul 2023 12:15:46 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DB5A40C2063; Wed, 26 Jul 2023 12:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373748; 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=MXFxry3Xg1bIh74o1qI3NyXKA1rAPwko9Q6Vm8jdOecYu0ZRslPXqLIC9VJLu/sPhXF3Ar P3jgUJXZqB3OIBst1WnAZOGanvGQddUugYDADNy8IRfEGgd/weQ/zVY0xHSdK1cx3NlFLf nonsAfD2lG3dh/FGKDcamM9OGOP2hUo= X-MC-Unique: b8jzowVwPqOqm3hxglDgcw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Wei Wang Subject: [PULL 18/25] migration: enforce multifd and postcopy preempt to be set before incoming Date: Wed, 26 Jul 2023 14:14:52 +0200 Message-Id: <20230726121459.1837-19-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373903603100003 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374124; cv=none; d=zohomail.com; s=zohoarc; b=auxlPgQXo+02+o20Bz0bEYrObndaH3JuS6vIb8t0STkDpVsMMOdKlj3VwdeafG92rvGfeMrqXaRtHpOcgZL14ffw7nKeB9K6m6grRa3pe1cW3xbnPunx9cep3wQ3IdIDONivRBrixl0HnYncdmnRaGkcFFHwypVrsE6GN1MFc2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374124; 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=TM9FyMCsxvplw4HM/FFtfzG/w1P/XEXy/L/W3F2dofD7TCJpnx9jU7ysS+ioP9TGYt0DGHWi/AcFa4jl3E4nw16z/r0WDKsa7qFVcQpa4pYZv4z/EaB/c/YjXVNyQ9ebgmxVMkakvtqI6wxrOLM3C1DHb4QlAyRB8pdK1sPKHW0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374124132265.62783421339043; Wed, 26 Jul 2023 05:22:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRs-0007hr-Gb; Wed, 26 Jul 2023 08:17:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQn-0006Vr-0B for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQl-0004Dr-En for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:52 -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-671-0XLqYHVpNPmaO4pyI0n5PQ-1; Wed, 26 Jul 2023 08:15:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5201D3C0C48B; Wed, 26 Jul 2023 12:15:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C41140C2063; Wed, 26 Jul 2023 12:15:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373750; 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=XdbiKVsjTEC7z464WV8K9yf+/T+3/2JxlIx8B8ga1+qyw9GJpa1QtIweiZZByHPbENkO34 RdwqSJihpMAFFRFwd+vXSCzfjB9JE+jA+cCUFaW1nzbdqe4gz6jOjHMg4T1PZycWN07odi XF1IOlr2vHsUhZ4V4jJmJzsa/Ri5SpE= X-MC-Unique: 0XLqYHVpNPmaO4pyI0n5PQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , Wei Wang Subject: [PULL 19/25] qtest/migration-tests.c: use "-incoming defer" for postcopy tests Date: Wed, 26 Jul 2023 14:14:53 +0200 Message-Id: <20230726121459.1837-20-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374125585100005 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374126; cv=none; d=zohomail.com; s=zohoarc; b=VhqKIOXQhsl9eUIOL+XHlRbsygA7QzzY9WaTKWZUVx4tu4TsWKkHBgh0arzaBSFf2rid4CXZfkYI1HrVcsNl1LRGCURGWPk1PhRb39QKCO8k1aq12a0xXMDRTg7lcWRnB53tAKOXOBK/MoqYaEOSbyCmRiGs4ZERAVAGRiKTd8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374126; 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=BTLw8bgXlCHhizFDCkcXPPyM61c8L+lRqPHcFgXsmro=; b=K9lNA3pNmHgfJH5VhBm/LbQ206EMQBZWWHG4Ib+iYqN0AP+vcm/G0cruabWLd46ZuZMDoGeoWv5rgw0ciYAW/FDj81RGEoMLEz5o9ALTJKCwnN4hdEoWbB8bpCzYt6BePXyolHDzitTCy/rsQ74FKsp1pM6s/YmRNf7iQ6Xzx2I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374126645728.8976429155933; Wed, 26 Jul 2023 05:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRT-000723-C8; Wed, 26 Jul 2023 08:16:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQo-0006Wz-Lv for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQn-0004Fb-28 for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-520-DYF_V4ByMumclDaQwmd7JA-1; Wed, 26 Jul 2023 08:15:50 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71863185A793; Wed, 26 Jul 2023 12:15:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99BB640C2063; Wed, 26 Jul 2023 12:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373752; 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=BTLw8bgXlCHhizFDCkcXPPyM61c8L+lRqPHcFgXsmro=; b=C6aps6mSic01gfTJ5IC0hgUXSNmttoSVs5AmVyyw8y/5OJLhDIT0976N1WCoyYtGfAho60 N0V/sS2XZBM/Co1zUiauteZ4wcmUGTIJHPNyCy/LQgUVW4GZ5Nx50+KUZr1JYzJkO2elmd Sa4EjUlQFWe3IrflULB5pi3yVqPzGrE= X-MC-Unique: DYF_V4ByMumclDaQwmd7JA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/25] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Wed, 26 Jul 2023 14:14:54 +0200 Message-Id: <20230726121459.1837-21-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374127437100014 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 51e40e3a0b..0b2583a205 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374126; cv=none; d=zohomail.com; s=zohoarc; b=WcIsWwQMrG4qQ1KMGqptoNlLSl5ima5XnACGYKA6gZa64mScg4G3nSHymUn4NqqlnqAE6PKH3fZrCIQEJp+QPYCkCRN7dqehy3DPI9DwlGrmIT8issy3DeoCtYcA2a5fZNlMiqaftmNK7uzvvu1NQFd2cu1/XAt1DqkYutlp6Qs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374126; 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=OdTS3TNJdPExzL/74l+HCLQVIrh2nHDlwAJNv07PIBY=; b=NcY9cgeC33vvtDim7CErS7s1J+VW6AE8e2YzEiZvZBDG4Szp3enNwfop0UgA2i3T2MPagc5VlogY04MmeCxFMkGqk2b1x43PyvlCjqQhfFkUnti3T/VA8wGQZ2WHQShxLUW7WemrVi7+VGXRHSe2Vo8Vv1OARbRxCb1kE/6r2hI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374126672397.5530494236697; Wed, 26 Jul 2023 05:22:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRr-0007YK-M0; Wed, 26 Jul 2023 08:16: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 1qOdQr-0006Y3-9e for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQo-0004Ih-Rj for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:15:56 -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-584-w6KKeTIPMoOaX4WKKJa6JQ-1; Wed, 26 Jul 2023 08:15:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C6711C03D8E; Wed, 26 Jul 2023 12:15:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id B89C640C2063; Wed, 26 Jul 2023 12:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373754; 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=OdTS3TNJdPExzL/74l+HCLQVIrh2nHDlwAJNv07PIBY=; b=ilQjTsql9q4lgqRtSwgzdFD8aLCQ6sSvpwJq2zAnGhUiHpNYMBLxUgr4IoafSYcLFOHSk1 TGA+bT6Xm26dllxlSix8tqbUJ+g9k3IlZwxnPstugemB6QL4Ypsnmd0KWphNObYRLSFM1p 1rKrjLKeB9VjxyD6ANEVKVj7iCdlASk= X-MC-Unique: w6KKeTIPMoOaX4WKKJa6JQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 21/25] migration: Change qemu_file_transferred to noflush Date: Wed, 26 Jul 2023 14:14:55 +0200 Message-Id: <20230726121459.1837-22-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-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.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374127419100013 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 0b2583a205..a2cb8855e2 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 15:58:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690375007; cv=none; d=zohomail.com; s=zohoarc; b=O42haoklShQ0buPN33DhWF7uBUrZMc/S67uYEMJNzSBpATR2ULHkD0QFqyRQKG7NNhsCfp9iJMzFGBTsyLTimC90EjiD2VWVcpDKb3LFV8NbkQolPg2uxjqHBVWNph7sZTqw30gXfjcj6U6Hq2L2fEjQmnarPBQbS/ZJVv6yJs0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690375007; 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=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=XCMYUxdWIdEKPVICp0uOuTXNyWfBU5Wq7zGtn+WUeVnJL3WduMlJYbZNsB33+sMu3Oz1MrnWFKyID7P9aDx5LE4AFVKauSD57teefILWRcGzKWitMkisXhAUDVEM8gTyJXfvYQqHyklsdYIFuMqI5rz51A0vRi3YXqxyfrDKGN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1690375007172730.7239708908209; Wed, 26 Jul 2023 05:36:47 -0700 (PDT) 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-547-frIK67HRM0KlR4GoI01Nuw-1; Wed, 26 Jul 2023 08:36:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51CF5881B25; Wed, 26 Jul 2023 12:36:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D52240C2063; Wed, 26 Jul 2023 12:36:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0DA2F1949754; Wed, 26 Jul 2023 12:36:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AAB001946A69 for ; Wed, 26 Jul 2023 12:15:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 93F0D40C2070; Wed, 26 Jul 2023 12:15:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id D22DB40C2063; Wed, 26 Jul 2023 12:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690375006; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=TPc+g9fsEICvXNGitIk+mVLYt7XVA+VrWuGcyW1smveQcM3iuhHTyJNJv+m0JIAKopOMlR o5IEux+ITUbLiL7SxZVvT8NnNunTA/6fe3x9+3H4nH3rInnYKr8KMjodf9geHWyCKuR1m0 mQnH6mzWFVp0oxiTwwxaGZHpkfqVigs= X-MC-Unique: frIK67HRM0KlR4GoI01Nuw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Juan Quintela To: qemu-devel@nongnu.org Subject: [PULL 22/25] qemu_file: Make qemu_file_is_writable() static Date: Wed, 26 Jul 2023 14:14:56 +0200 Message-Id: <20230726121459.1837-23-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Juan Quintela , libvir-list@redhat.com, Markus Armbruster , Peter Xu , Leonardo Bras , Paolo Bonzini , Eric Blake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690375008710100001 Content-Type: text/plain; charset="utf-8"; x-default="true" 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374124; cv=none; d=zohomail.com; s=zohoarc; b=OEMEwAoimN5I90NBLTYWJs4NvkGXHGbF2oJskOrvZs21CvC3/atSLlMfTV6adD4+3OfEOodEsQltlrSthbU8NLidnx3PYFDlOjT7McvnCr76QmT9TVB8UOtfRVyxSFgRN00u3zkdjhj5j1LhN2vXN2rSRjRhxUgIE7GeL6lKl8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374124; 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=iscIwOLzM4orPh8cSBpDL9Q0sRGyed4JYJm+ahSSkZFyx5FaDIvFuQxQOzggFvx7S3z4DlX17/oauihNHBqSsCYmbBuojHTSCgzn1QIQDO9NrpUHDQ5NqdR3LH/QO948J5mo0BkxjIv+qL8naoiBeYUIO8nqwUTIrTY96xTeuYc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374124174261.1190731469371; Wed, 26 Jul 2023 05:22:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRt-0007nQ-1E; Wed, 26 Jul 2023 08:17: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 1qOdQu-0006cn-NB for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16:04 -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 1qOdQt-0004Mg-2c for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-167-wc_UdGO3PcumaY0I5YsF9A-1; Wed, 26 Jul 2023 08:15:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 85B0D1044589 for ; Wed, 26 Jul 2023 12:15:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5F5040C2070; Wed, 26 Jul 2023 12:15:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373758; 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=e+qMqyQyMjAHodbB+Z2ea2BCFE1TZiKshDuj7946mMIK4f1u+DUlypeFG8xFm4SHxH3W3S GMG82NWFTQcT/3XcgJPAh/Y30dYBeUQlzV/5y2XwQhaXNa7cuwyS/nTJ0uP9En2N+4aLje U+vgQRwiqHL16NH8np/CdnUUhIJ2d0Q= X-MC-Unique: wc_UdGO3PcumaY0I5YsF9A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 23/25] qemu-file: Simplify qemu_file_shutdown() Date: Wed, 26 Jul 2023 14:14:57 +0200 Message-Id: <20230726121459.1837-24-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374125436100003 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690373878; cv=none; d=zohomail.com; s=zohoarc; b=KYyyHUi6j9VsK0vMOBCr0ep7z07Li2ycbbrBkrz56saCY43adUQVyWXuy4deHravm9qc5XarjJLFoAK5dvt5SHzMTxNEF2n2jOVCD1az9+PL8ikjz7fYd6i0BakTPsZ8RVL1yRw6vT7jUv2lr8ItC3HddjKY8JMmx1ntb4D9Srk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690373878; 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=e0XMK3haqEj9NGseLz+0GLy9rj9xQEEMmTfdGRm51wN02oX9xyJaqDFtEwKCdy1GH3zIGh7622FaCJMdf/PL0ZqjnDlYreFCSlZRna+JVz90Y2Sn8TkxPzG6pC8E0wV9P2rnkss0C3x5ECkFyeOjxunYtIp46hTXrCWWuJNs7so= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16903738784541008.9787328124617; Wed, 26 Jul 2023 05:17:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdRw-00084F-Uq; Wed, 26 Jul 2023 08:17:05 -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 1qOdQy-0006d4-GC for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16:11 -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 1qOdQw-0004N2-EC for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16: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-590-7Jxcv05LOGG_LSwve3vw4w-1; Wed, 26 Jul 2023 08:15:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7BB3F88D549 for ; Wed, 26 Jul 2023 12:15:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCDC440C2070; Wed, 26 Jul 2023 12:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373760; 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=NK0UN0c3BES+steTk+0/oIMlqLeKeGMx8npswZqya/OZbbQngwg74oknqCScNDzOebkF4u BB0LGgWKWtBFXTTrKrU2ULY4zfPPGNI+uR3itaX2K2HT7RMCVEfDTvbIIiEehGMwMztbkL CQGWZMOrKzL1Tq+IXDFe+WhF3ocSIAg= X-MC-Unique: 7Jxcv05LOGG_LSwve3vw4w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 24/25] qemu-file: Make qemu_file_get_error_obj() static Date: Wed, 26 Jul 2023 14:14:58 +0200 Message-Id: <20230726121459.1837-25-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690373879444100001 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 15:58:40 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690374007; cv=none; d=zohomail.com; s=zohoarc; b=fhlcpObLHhh2A5ruGdi4I5YL9M768G3dVFrZl7oPCUrIEoZmyAHlE+avZRmXi+Bupys4r8/flg5XQDjeUUtzC7bwFOz2MHwuixdK9Y/U5IrUeq7XfcHF1rTKM2NeJcHXlbPgVaJGUXeyALC9Shd4pIAYeIoyH/axo9C+JYlMDe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690374007; 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=eUkKwiXMPKDMU6Icnk3mfVFJq6mE2IPo/0vsmeYMUG7OskpYpeSZ4vDx5YXwW8Lo0JMdawqrDDbFY2QRDe1W1DeFeazZwkf9hlysjq7/xol/OUXw3e2woCJeBhnc44HZGA2qP7VGqsZMmrPWKyd6XS8YcJDbv3BQs5Wz1xaJajU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1690374007401960.8275692300463; Wed, 26 Jul 2023 05:20:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOdS3-0000FB-7u; Wed, 26 Jul 2023 08:17: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 1qOdR3-0006hv-Sk for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOdQx-0004NK-5D for qemu-devel@nongnu.org; Wed, 26 Jul 2023 08:16:05 -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-606-lnyvvamQMLC3f7nDHVW-Mg-1; Wed, 26 Jul 2023 08:16:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 939CF1C03D91 for ; Wed, 26 Jul 2023 12:16:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1E0B40C2063; Wed, 26 Jul 2023 12:15:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690373762; 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=CWZJdoC1/tEyw7iQfizR5VBzMHa1sObQeyarcnqU91jL/7dEceD806XP7/Y0MUvItiUECS nSPqOKWEciZ4jcNG3YPdizIe69Te2236c3o+vLeHrkxncAK1zdfr8GrNbYx2784Mt51/DG 36AZS5CFHKQ8giY06KuzPduhXdAVC/U= X-MC-Unique: lnyvvamQMLC3f7nDHVW-Mg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Eric Blake , Peter Xu , Paolo Bonzini , Thomas Huth , libvir-list@redhat.com, Markus Armbruster , Juan Quintela , Laurent Vivier Subject: [PULL 25/25] migration/rdma: Split qemu_fopen_rdma() into input/output functions Date: Wed, 26 Jul 2023 14:14:59 +0200 Message-Id: <20230726121459.1837-26-quintela@redhat.com> In-Reply-To: <20230726121459.1837-1-quintela@redhat.com> References: <20230726121459.1837-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690374008791100003 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