From nobody Sat May 18 13:36:57 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=1687400031; cv=none; d=zohomail.com; s=zohoarc; b=neHDwIWhPMgmDkV2ZpVfb6+uoO7b6k1HNOSPqQm3JJ3yC/lGHWk5MkmRtdrwtZnjWorGh7LiTXWw29pnYDlA4Uey8j9dWvj/SaCPNuQj+iZCL6bpvAKwVz+0s9cuHDRiNzmSMEZAqa2OI1BpXWwK/9LieoOh1+GSwVfrlTFPzy0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400031; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=86HMKLzBPnMyNMxPJsg/OhLOiHcaCIfAHsYhpv8Xq0Y=; b=k8aYquoRSlKDJJBGDYgUKdrmMN8cDgb6Jgou8nVyDaYYEndz2483I55/YyPuzo52RDmPEcHLnNFXu5y17sxCg0t5WWpXz8kU+MFc/tSVGGVPtShs9ruB2mNCMvOWAs1WhMWivk+zhJI150aoSbEtkbayz9Gr2qIVIX8cQU71uiQ= 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 1687400031946999.1527813392328; Wed, 21 Jun 2023 19:13:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pK-0005RX-FQ; Wed, 21 Jun 2023 22:13:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pF-0005Qe-2S for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:33 -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 1qC9pD-0004oR-8r for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:32 -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-489-UaYK3aixOv2Jv7a3LNs74w-1; Wed, 21 Jun 2023 22:13:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 30399185A791; Thu, 22 Jun 2023 02:13:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id D594F112132C; Thu, 22 Jun 2023 02:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400010; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=86HMKLzBPnMyNMxPJsg/OhLOiHcaCIfAHsYhpv8Xq0Y=; b=eBbBxvx/rzB47taXfMV9xpqQD8nUbg/IOXLJs10z2zsTbD8ij/zz/6j7X3r+7MySSgeI62 ZskK0Pav8F6hXA0ViXO1LiIS/yIxyvGMpMwiomgoAoA2KC7PkkksB2TQ8Lf+suT3cpETEk rezAPnjYuAloIPl4zcAwN5NrN08yZx4= X-MC-Unique: UaYK3aixOv2Jv7a3LNs74w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Fabiano Rosas , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 01/30] migration/multifd: Rename threadinfo.c functions Date: Thu, 22 Jun 2023 04:12:51 +0200 Message-Id: <20230622021320.66124-2-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400034214100005 From: Fabiano Rosas We're about to add more functions to this file so make it use the same coding style as the rest of the code. Signed-off-by: Fabiano Rosas Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Peter Xu Message-Id: <20230607161306.31425-2-farosas@suse.de> Signed-off-by: Juan Quintela --- migration/threadinfo.h | 5 ++--- migration/migration.c | 4 ++-- migration/multifd.c | 4 ++-- migration/threadinfo.c | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/migration/threadinfo.h b/migration/threadinfo.h index 4d69423c0a..8aa6999d58 100644 --- a/migration/threadinfo.h +++ b/migration/threadinfo.h @@ -23,6 +23,5 @@ struct MigrationThread { QLIST_ENTRY(MigrationThread) node; }; =20 -MigrationThread *MigrationThreadAdd(const char *name, int thread_id); - -void MigrationThreadDel(MigrationThread *info); +MigrationThread *migration_threads_add(const char *name, int thread_id); +void migration_threads_remove(MigrationThread *info); diff --git a/migration/migration.c b/migration/migration.c index dc05c6f6ea..3a001dd042 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2922,7 +2922,7 @@ static void *migration_thread(void *opaque) MigThrError thr_error; bool urgent =3D false; =20 - thread =3D MigrationThreadAdd("live_migration", qemu_get_thread_id()); + thread =3D migration_threads_add("live_migration", qemu_get_thread_id(= )); =20 rcu_register_thread(); =20 @@ -3000,7 +3000,7 @@ static void *migration_thread(void *opaque) migration_iteration_finish(s); object_unref(OBJECT(s)); rcu_unregister_thread(); - MigrationThreadDel(thread); + migration_threads_remove(thread); return NULL; } =20 diff --git a/migration/multifd.c b/migration/multifd.c index 3387d8277f..4c6cee6547 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -651,7 +651,7 @@ static void *multifd_send_thread(void *opaque) int ret =3D 0; bool use_zero_copy_send =3D migrate_zero_copy_send(); =20 - thread =3D MigrationThreadAdd(p->name, qemu_get_thread_id()); + thread =3D migration_threads_add(p->name, qemu_get_thread_id()); =20 trace_multifd_send_thread_start(p->id); rcu_register_thread(); @@ -767,7 +767,7 @@ out: qemu_mutex_unlock(&p->mutex); =20 rcu_unregister_thread(); - MigrationThreadDel(thread); + migration_threads_remove(thread); trace_multifd_send_thread_end(p->id, p->num_packets, p->total_normal_p= ages); =20 return NULL; diff --git a/migration/threadinfo.c b/migration/threadinfo.c index 1de8b31855..3dd9b14ae6 100644 --- a/migration/threadinfo.c +++ b/migration/threadinfo.c @@ -14,7 +14,7 @@ =20 static QLIST_HEAD(, MigrationThread) migration_threads; =20 -MigrationThread *MigrationThreadAdd(const char *name, int thread_id) +MigrationThread *migration_threads_add(const char *name, int thread_id) { MigrationThread *thread =3D g_new0(MigrationThread, 1); thread->name =3D name; @@ -25,7 +25,7 @@ MigrationThread *MigrationThreadAdd(const char *name, int= thread_id) return thread; } =20 -void MigrationThreadDel(MigrationThread *thread) +void migration_threads_remove(MigrationThread *thread) { if (thread) { QLIST_REMOVE(thread, node); --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400215; cv=none; d=zohomail.com; s=zohoarc; b=lC4IXlY/XDFtDtZJbXJb3PiNpTRO3gL2tP2wxk/5crCjHuavM76bRLqfLN+QRwCQIac87LICxpjTuzEjh1Lsy+t+KGbjvfMcZ8QshhagRBLy158zuh5+nFhofF7aMBjWIgRWA+vG95IXCz1qneus8qiZnhOluoQV+sma/xtqccQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400215; 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=kDQ59faEc7v+EgiZCy1FMwC+xTYJEDHYkO71s1xIH+e5TbNmg8huUJSEpkOme+FSXDiUin6YdWo0coIqFkYIJh+JcOJL6B9DS3k2i1aEgqkzxlZR/AcA88stdGA/G0IrRbfj91M8MDcHdXqP8ZK65YJVP2byLZ7RbJUm0lW4i34= 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 1687400215517985.65647667253; Wed, 21 Jun 2023 19:16:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pS-0005YN-1N; Wed, 21 Jun 2023 22:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pE-0005Qd-Vp for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:33 -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 1qC9pD-0004oW-8e for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:32 -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-7-eOwQccumMLi7JxlHIv2Oiw-1; Wed, 21 Jun 2023 22:13:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B999B810BB2; Thu, 22 Jun 2023 02:13:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A987112132C; Thu, 22 Jun 2023 02:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400010; 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=BewHzzX83ruEbVEoHNaBXv/sKoxTJ3cGs1prVCHFnjFM03KpRHQPRcXE0o5WiR3qsKV8vt 3WeWk1AAeJpk0FMJkAx8o0tq8Hm3ot24pVcZ55gYIiyrR8Avfh/M5+SfCDk7A+mioylIwT BCY/qGvS/Vr8YGUm3PtzntCY39y+mfE= X-MC-Unique: eOwQccumMLi7JxlHIv2Oiw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Fabiano Rosas Subject: [PULL 02/30] migration/multifd: Protect accesses to migration_threads Date: Thu, 22 Jun 2023 04:12:52 +0200 Message-Id: <20230622021320.66124-3-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400217376100007 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 Sat May 18 13:36:57 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=1687400216; cv=none; d=zohomail.com; s=zohoarc; b=eMKFydshZ5L/+A+8ohokW8ttl1fCWL/cORPUJSeoSDswYqG1+IGjASRdgWSooVCi8rU3raqVTfFHyOPRhbllQkXtkIAMguKmXhx3wvKcKqVF7jwHwKp+3lsU4FjjJc7i3dVJqMDBFIEa5vSjBJQ4l2QdIEcpF9paYz5APxHyOaE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400216; 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=VIMnHSP9RUdf5ypifstZBmauNhEEok0ZnZYAC+7f52M=; b=WmDi2DJsLH5RjdtoG/FdKs/Ss/W2Om4Xja4mn9zKkdeSpasO45DTkovws6In5+p2NOiLU0h6kmPmclEkaXCdocoDSD4lMtqo0KOfk3dnPI9RNrXScwMLl5Lz+FojURx1l3BHkx+/gpy0uwC/mBEDzNE3Zal1hqnDrbf2HKyYjTg= 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 16874002160515.959260822652368; Wed, 21 Jun 2023 19:16:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pS-0005Z4-Ni; Wed, 21 Jun 2023 22:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pI-0005Ru-Ga for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:37 -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 1qC9pG-0004pW-Fl for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:35 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-108-zMPewLBHOeuWE2Pc53ihqA-1; Wed, 21 Jun 2023 22:13:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F3FC3C10151; Thu, 22 Jun 2023 02:13:31 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0BBFA112132C; Thu, 22 Jun 2023 02:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400013; 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=VIMnHSP9RUdf5ypifstZBmauNhEEok0ZnZYAC+7f52M=; b=HOT8IKJ90K/y0NwcPwClX6dAQn2iDk31VSiVQ6mNXvefM/1B1SJW58kZk6NAoAR7RFfiv8 mQvUmS/CYuQeCU4lpW9XUYUAuJuEeqOZC9QDTEDkxfWU8UZueJ/DLR2D7bT20tKxI5A4l8 RVkP8hqDd4//7AdAIhtgnmQHAA3vur0= X-MC-Unique: zMPewLBHOeuWE2Pc53ihqA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 03/30] softmmu/dirtylimit: Add parameter check for hmp "set_vcpu_dirty_limit" Date: Thu, 22 Jun 2023 04:12:53 +0200 Message-Id: <20230622021320.66124-4-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400216625100004 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..5c12d26d49 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 %ld", 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 Sat May 18 13:36:57 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=1687400082; cv=none; d=zohomail.com; s=zohoarc; b=dPgK46h3TkcEXt4bM0JlzP4R90oqEnGfGGerdXAQt4Ka3v7oo6tKKu1jh1l7UXPhwYD63CBdQBczZhn1TriVXu+7wGBm6hgRGXbJOO1JWeXSDsPgOuVzUZVFfQuXZoM/v7aBa9C6UAwONa/Vl6eRuAoYB/vO4h//N05aAhfAdwo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400082; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SFhrjM7lUKDquypfaK4yDGZL8ex0kV3B/YXIxLQaoVU=; b=MSaULvks8HifBzleQZYPX3SJqil+VuU7344xtfrkCY+EjZyHt7tTzxP8y+SqTydBsk2nRGBeaY6peGI4xmvC0uy1erpnKkYZHIt3mWPGZyb6ZwCVHQ0ebYhucjPQDTaFhV+bKtZcE7JukQgvJ9Q7aOJBwayArWGYsjO2EMysLiI= 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 1687400082976106.84162423388284; Wed, 21 Jun 2023 19:14:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pS-0005Yb-8r; Wed, 21 Jun 2023 22:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pM-0005WB-G5 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pK-0004qf-Fb for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:13:40 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-179-aukcg451MauZBOSCkAu0wQ-1; Wed, 21 Jun 2023 22:13:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46E0E8AB382; Thu, 22 Jun 2023 02:13:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBD13112132C; Thu, 22 Jun 2023 02:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SFhrjM7lUKDquypfaK4yDGZL8ex0kV3B/YXIxLQaoVU=; b=e8ufGCH3FUqeSlUunm6vFX4su52L53b5JLXDwmmCn645TFoDzIgyGXF3MWmDTTvw4jiU9Y vvzXblVmt9KAAbq5osypvafXuDX8u/5vK9Bffgw4wxcBqLh/g3PIfXVM5iigPZ82SW09IR hudWlQiEHEgq2eY6vvQiKp+6avAlYYI= X-MC-Unique: aukcg451MauZBOSCkAu0wQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 04/30] qapi/migration: Introduce x-vcpu-dirty-limit-period parameter Date: Thu, 22 Jun 2023 04:12:54 +0200 Message-Id: <20230622021320.66124-5-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400084165100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce "x-vcpu-dirty-limit-period" migration experimental parameter, which is in the range of 1 to 1000ms and used to make dirtyrate calculation period configurable. Currently with the "x-vcpu-dirty-limit-period" varies, the total time of live migration changes, test results show the optimal value of "x-vcpu-dirty-limit-period" ranges from 500ms to 1000 ms. "x-vcpu-dirty-limit-period" should be made stable once it proves best value can not be determined with developer's experiments. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-2@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 34 +++++++++++++++++++++++++++------- migration/migration-hmp-cmds.c | 8 ++++++++ migration/options.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+), 7 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 5bb5ab82a0..67c26d9dea 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -779,9 +779,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # Since: 2.4 ## @@ -799,8 +804,9 @@ 'multifd-channels', 'xbzrle-cache-size', 'max-postcopy-bandwidth', 'max-cpu-throttle', 'multifd-compression', - 'multifd-zlib-level' ,'multifd-zstd-level', - 'block-bitmap-mapping' ] } + 'multifd-zlib-level', 'multifd-zstd-level', + 'block-bitmap-mapping', + { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= } ] } =20 ## # @MigrateSetParameters: @@ -935,9 +941,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # TODO: either fuse back into MigrationParameters, or make # MigrationParameters members mandatory @@ -972,7 +983,9 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*x-vcpu-dirty-limit-period': { 'type': 'uint64', + 'features': [ 'unstable' ] } }= } =20 ## # @migrate-set-parameters: @@ -1127,9 +1140,14 @@ # Nodes are mapped to their block device name if there is one, and # to their node name otherwise. (Since 5.2) # +# @x-vcpu-dirty-limit-period: Periodic time (in milliseconds) of dirty lim= it during +# live migration. Should be in the range 1 to = 1000ms, +# defaults to 1000ms. (Since 8.1) +# # Features: # -# @unstable: Member @x-checkpoint-delay is experimental. +# @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period +# are experimental. # # Since: 2.4 ## @@ -1161,7 +1179,9 @@ '*multifd-compression': 'MultiFDCompression', '*multifd-zlib-level': 'uint8', '*multifd-zstd-level': 'uint8', - '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ] } } + '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], + '*x-vcpu-dirty-limit-period': { 'type': 'uint64', + 'features': [ 'unstable' ] } }= } =20 ## # @query-migrate-parameters: diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 9885d7c9f7..352e9ec716 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -364,6 +364,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) } } } + + monitor_printf(mon, "%s: %" PRIu64 " ms\n", + MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), + params->x_vcpu_dirty_limit_period); } =20 qapi_free_MigrationParameters(params); @@ -620,6 +624,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) error_setg(&err, "The block-bitmap-mapping parameter can only be s= et " "through QMP"); break; + case MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERIOD: + p->has_x_vcpu_dirty_limit_period =3D true; + visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index b62ab30cd5..9743dea3ab 100644 --- a/migration/options.c +++ b/migration/options.c @@ -80,6 +80,8 @@ #define DEFINE_PROP_MIG_CAP(name, x) \ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 +#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ + Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, store_global_state, true), @@ -163,6 +165,9 @@ Property migration_properties[] =3D { DEFINE_PROP_STRING("tls-creds", MigrationState, parameters.tls_creds), DEFINE_PROP_STRING("tls-hostname", MigrationState, parameters.tls_host= name), DEFINE_PROP_STRING("tls-authz", MigrationState, parameters.tls_authz), + DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, + parameters.x_vcpu_dirty_limit_period, + DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -891,6 +896,9 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) s->parameters.block_bitmap_mapping); } =20 + params->has_x_vcpu_dirty_limit_period =3D true; + params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; + return params; } =20 @@ -923,6 +931,7 @@ void migrate_params_init(MigrationParameters *params) params->has_announce_max =3D true; params->has_announce_rounds =3D true; params->has_announce_step =3D true; + params->has_x_vcpu_dirty_limit_period =3D true; } =20 /* @@ -1083,6 +1092,15 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) } #endif =20 + if (params->has_x_vcpu_dirty_limit_period && + (params->x_vcpu_dirty_limit_period < 1 || + params->x_vcpu_dirty_limit_period > 1000)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "x-vcpu-dirty-limit-period", + "a value between 1 and 1000"); + return false; + } + return true; } =20 @@ -1182,6 +1200,11 @@ static void migrate_params_test_apply(MigrateSetPara= meters *params, dest->has_block_bitmap_mapping =3D true; dest->block_bitmap_mapping =3D params->block_bitmap_mapping; } + + if (params->has_x_vcpu_dirty_limit_period) { + dest->x_vcpu_dirty_limit_period =3D + params->x_vcpu_dirty_limit_period; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1300,6 +1323,11 @@ static void migrate_params_apply(MigrateSetParameter= s *params, Error **errp) QAPI_CLONE(BitmapMigrationNodeAliasList, params->block_bitmap_mapping); } + + if (params->has_x_vcpu_dirty_limit_period) { + s->parameters.x_vcpu_dirty_limit_period =3D + params->x_vcpu_dirty_limit_period; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400290; cv=none; d=zohomail.com; s=zohoarc; b=RAWev2uU+AySkW3cirNWByLxX1leGQHBUkrw/AlC6+4KCbLMp/mCVMlihnNGvd9hLma3gJUxYtci93lWhh6hmDrwuYt030+/TAdU+ZyZ9J9RIYwUewdmsjWiG5y/3esVmNWRmcgen3c5M79bOb4XPQBiHRBlVs2fi2qGr0DZVPo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400290; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/St81kdkZQJj4V+hE6fkLQyP9wya7SS1yQmgWrwVEkY=; b=YJLIYCQ3fqeVooQm/Ro3A1kmqBS7EvoODIIr98zANVYSk7wnuuSLhDLfpjFJI893sECJdJinlKeYHKNPOe8kYUM/J9FtbR5eCToBEFDHTzYsuk/i+SBkx0pzC5NczbWaCneew0V6EMNFotVauqNOT0rO0ntnG/DsvXRBwuIDwPk= 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 1687400290412475.8122040112944; Wed, 21 Jun 2023 19:18:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9ps-00064I-Bh; Wed, 21 Jun 2023 22:14: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 1qC9pq-00063R-5J for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:10 -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 1qC9pn-0004wl-CU for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-537-QJE53prCNgS3ilLYyr7WMg-1; Wed, 21 Jun 2023 22:14:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D0A388C5868; Thu, 22 Jun 2023 02:14:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90A7B112132C; Thu, 22 Jun 2023 02:13:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400046; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/St81kdkZQJj4V+hE6fkLQyP9wya7SS1yQmgWrwVEkY=; b=fNSfVJcqjKy8do4T1wEbNDZG6NyQ1Ynk8Fmq74WvTdDkPU8eNhVIi+f78lXM9EDpUM+gI0 3e1lkdui/zyaC8paoWUlEMXH338Iw/nz2bDG3pdlHUoOBAe8fHxOvgf/fVinKYB2kSGWM1 xAMfEeHsCeokosev/wonODq1NZ2c3c0= X-MC-Unique: QJE53prCNgS3ilLYyr7WMg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 05/30] qapi/migration: Introduce vcpu-dirty-limit parameters Date: Thu, 22 Jun 2023 04:12:55 +0200 Message-Id: <20230622021320.66124-6-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400290857100001 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce "vcpu-dirty-limit" migration parameter used to limit dirty page rate during live migration. "vcpu-dirty-limit" and "x-vcpu-dirty-limit-period" are two dirty-limit-related migration parameters, which can be set before and during live migration by qmp migrate-set-parameters. This two parameters are used to help implement the dirty page rate limit algo of migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-3@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 18 +++++++++++++++--- migration/migration-hmp-cmds.c | 8 ++++++++ migration/options.c | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 67c26d9dea..e7243c0c0d 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -783,6 +783,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -806,7 +809,8 @@ 'max-cpu-throttle', 'multifd-compression', 'multifd-zlib-level', 'multifd-zstd-level', 'block-bitmap-mapping', - { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= } ] } + { 'name': 'x-vcpu-dirty-limit-period', 'features': ['unstable']= }, + 'vcpu-dirty-limit'] } =20 ## # @MigrateSetParameters: @@ -945,6 +949,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -985,7 +992,8 @@ '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] } }= } + 'features': [ 'unstable' ] }, + '*vcpu-dirty-limit': 'uint64'} } =20 ## # @migrate-set-parameters: @@ -1144,6 +1152,9 @@ # live migration. Should be in the range 1 to = 1000ms, # defaults to 1000ms. (Since 8.1) # +# @vcpu-dirty-limit: Dirtyrate limit (MB/s) during live migration. +# Defaults to 1. (Since 8.1) +# # Features: # # @unstable: Members @x-checkpoint-delay and @x-vcpu-dirty-limit-period @@ -1181,7 +1192,8 @@ '*multifd-zstd-level': 'uint8', '*block-bitmap-mapping': [ 'BitmapMigrationNodeAlias' ], '*x-vcpu-dirty-limit-period': { 'type': 'uint64', - 'features': [ 'unstable' ] } }= } + 'features': [ 'unstable' ] }, + '*vcpu-dirty-limit': 'uint64'} } =20 ## # @query-migrate-parameters: diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 352e9ec716..35e8020bbf 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -368,6 +368,10 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) monitor_printf(mon, "%s: %" PRIu64 " ms\n", MigrationParameter_str(MIGRATION_PARAMETER_X_VCPU_DIRTY_LIMIT_PERI= OD), params->x_vcpu_dirty_limit_period); + + monitor_printf(mon, "%s: %" PRIu64 " MB/s\n", + MigrationParameter_str(MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT), + params->vcpu_dirty_limit); } =20 qapi_free_MigrationParameters(params); @@ -628,6 +632,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_x_vcpu_dirty_limit_period =3D true; visit_type_size(v, param, &p->x_vcpu_dirty_limit_period, &err); break; + case MIGRATION_PARAMETER_VCPU_DIRTY_LIMIT: + p->has_vcpu_dirty_limit =3D true; + visit_type_size(v, param, &p->vcpu_dirty_limit, &err); + break; default: assert(0); } diff --git a/migration/options.c b/migration/options.c index 9743dea3ab..8acf5f1d2c 100644 --- a/migration/options.c +++ b/migration/options.c @@ -81,6 +81,7 @@ DEFINE_PROP_BOOL(name, MigrationState, capabilities[x], false) =20 #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ +#define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ =20 Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, @@ -168,6 +169,9 @@ Property migration_properties[] =3D { DEFINE_PROP_UINT64("x-vcpu-dirty-limit-period", MigrationState, parameters.x_vcpu_dirty_limit_period, DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD), + DEFINE_PROP_UINT64("vcpu-dirty-limit", MigrationState, + parameters.vcpu_dirty_limit, + DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -898,6 +902,8 @@ MigrationParameters *qmp_query_migrate_parameters(Error= **errp) =20 params->has_x_vcpu_dirty_limit_period =3D true; params->x_vcpu_dirty_limit_period =3D s->parameters.x_vcpu_dirty_limit= _period; + params->has_vcpu_dirty_limit =3D true; + params->vcpu_dirty_limit =3D s->parameters.vcpu_dirty_limit; =20 return params; } @@ -932,6 +938,7 @@ void migrate_params_init(MigrationParameters *params) params->has_announce_rounds =3D true; params->has_announce_step =3D true; params->has_x_vcpu_dirty_limit_period =3D true; + params->has_vcpu_dirty_limit =3D true; } =20 /* @@ -1101,6 +1108,14 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (params->has_vcpu_dirty_limit && + (params->vcpu_dirty_limit < 1)) { + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, + "vcpu_dirty_limit", + "is invalid, it must greater then 1 MB/s"); + return false; + } + return true; } =20 @@ -1205,6 +1220,9 @@ static void migrate_params_test_apply(MigrateSetParam= eters *params, dest->x_vcpu_dirty_limit_period =3D params->x_vcpu_dirty_limit_period; } + if (params->has_vcpu_dirty_limit) { + dest->vcpu_dirty_limit =3D params->vcpu_dirty_limit; + } } =20 static void migrate_params_apply(MigrateSetParameters *params, Error **err= p) @@ -1328,6 +1346,9 @@ static void migrate_params_apply(MigrateSetParameters= *params, Error **errp) s->parameters.x_vcpu_dirty_limit_period =3D params->x_vcpu_dirty_limit_period; } + if (params->has_vcpu_dirty_limit) { + s->parameters.vcpu_dirty_limit =3D params->vcpu_dirty_limit; + } } =20 void qmp_migrate_set_parameters(MigrateSetParameters *params, Error **errp) --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400282; cv=none; d=zohomail.com; s=zohoarc; b=iNfBbenAA7i5oGZk4QRNmQgAukQB5zJaxI3gN1l4hH73UstAv8S9u+jSJIsE0dKqPptc5wal+iSBlkQBXS3QzvJIr+QcFe6MADHJ76XbBuvjYBq0iwoiPx2HjQDN2+j4kHT0HkTEQqWIua5J6/75IRMJKiqrdL9VUbQrEaNJ3CQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400282; 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=RRLR/vUBbi1K0dz6wa49qSsAzRG878m4KSUyse2mU0k=; b=Go65RJGOCzl9VBKfnUdPpU4Y7i/gyizYZqDl3/K0iEyAuRJCLTP26TuAFqBr4FbrdSi9xrZqLqpRrG5cU75YowmI/jRLq/HolOesbJjbJ/kpa8tzHUyyd1yGkTI3GxOJIJ3yssELHVoRwAvQbUmZ03H7L99dm6Kr1hewovLumFQ= 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 1687400282329200.18048356218276; Wed, 21 Jun 2023 19:18:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9ps-00063o-3l; Wed, 21 Jun 2023 22:14: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 1qC9po-00061w-Tk for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:08 -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 1qC9pn-0004wd-1h for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:08 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-hlArjA3RPCq9B_4gW0Gnzw-1; Wed, 21 Jun 2023 22:14:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4489D104458F; Thu, 22 Jun 2023 02:14:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 262CA112132C; Thu, 22 Jun 2023 02:14:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400046; 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=RRLR/vUBbi1K0dz6wa49qSsAzRG878m4KSUyse2mU0k=; b=KoE+/8X8XDP0KuxAzWpqzvWFI5b3nias4No/7zMdYvKXSUpIc1ylTluOTyLfo4DB0JM87I 1uVOP/uHOwsNBzoQjS5rjXOtrfai9mTmLLYg8Xvh7QgBBMAUTNCN+xedvzUjjx0IZWpM5C 3cAF97WdVLbUCpgVm+3DY2pMRlvJ02o= X-MC-Unique: hlArjA3RPCq9B_4gW0Gnzw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 06/30] migration: Introduce dirty-limit capability Date: Thu, 22 Jun 2023 04:12:56 +0200 Message-Id: <20230622021320.66124-7-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400282824100017 From: Hyman Huang(=E9=BB=84=E5=8B=87) Introduce migration dirty-limit capability, which can be turned on before live migration and limit dirty page rate durty live migration. Introduce migrate_dirty_limit function to help check if dirty-limit capability enabled during live migration. Meanwhile, refactor vcpu_dirty_rate_stat_collect so that period can be configured instead of hardcoded. dirty-limit capability is kind of like auto-converge but using dirty limit instead of traditional cpu-throttle to throttle guest down. To enable this feature, turn on the dirty-limit capability before live migration using migrate-set-capabilities, and set the parameters "x-vcpu-dirty-limit-period", "vcpu-dirty-limit" suitably to speed up convergence. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-4@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 12 +++++++++++- migration/options.h | 1 + migration/options.c | 23 +++++++++++++++++++++++ softmmu/dirtylimit.c | 18 ++++++++++++++---- 4 files changed, 49 insertions(+), 5 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index e7243c0c0d..621e6604c6 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -487,6 +487,16 @@ # and should not affect the correctness of postcopy migration. # (since 7.1) # +# @dirty-limit: If enabled, migration will use the dirty-limit algo to +# throttle down guest instead of auto-converge algo. +# Throttle algo only works when vCPU's dirtyrate greater +# than 'vcpu-dirty-limit', read processes in guest os +# aren't penalized any more, so this algo can improve +# performance of vCPU during live migration. This is an +# optional performance feature and should not affect the +# correctness of the existing auto-converge algo. +# (since 8.1) +# # Features: # # @unstable: Members @x-colo and @x-ignore-shared are experimental. @@ -502,7 +512,7 @@ 'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate', { 'name': 'x-ignore-shared', 'features': [ 'unstable' ] }, 'validate-uuid', 'background-snapshot', - 'zero-copy-send', 'postcopy-preempt'] } + 'zero-copy-send', 'postcopy-preempt', 'dirty-limit'] } =20 ## # @MigrationCapabilityStatus: diff --git a/migration/options.h b/migration/options.h index 45991af3c2..51964eff29 100644 --- a/migration/options.h +++ b/migration/options.h @@ -29,6 +29,7 @@ bool migrate_block(void); bool migrate_colo(void); bool migrate_compress(void); bool migrate_dirty_bitmaps(void); +bool migrate_dirty_limit(void); bool migrate_events(void); bool migrate_ignore_shared(void); bool migrate_late_block_activate(void); diff --git a/migration/options.c b/migration/options.c index 8acf5f1d2c..ba1010e08b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -27,6 +27,7 @@ #include "qemu-file.h" #include "ram.h" #include "options.h" +#include "sysemu/kvm.h" =20 /* Maximum migrate downtime set to 2000 seconds */ #define MAX_MIGRATE_DOWNTIME_SECONDS 2000 @@ -194,6 +195,7 @@ Property migration_properties[] =3D { DEFINE_PROP_MIG_CAP("x-zero-copy-send", MIGRATION_CAPABILITY_ZERO_COPY_SEND), #endif + DEFINE_PROP_MIG_CAP("x-dirty-limit", MIGRATION_CAPABILITY_DIRTY_LIMIT), =20 DEFINE_PROP_END_OF_LIST(), }; @@ -240,6 +242,13 @@ bool migrate_dirty_bitmaps(void) return s->capabilities[MIGRATION_CAPABILITY_DIRTY_BITMAPS]; } =20 +bool migrate_dirty_limit(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->capabilities[MIGRATION_CAPABILITY_DIRTY_LIMIT]; +} + bool migrate_events(void) { MigrationState *s =3D migrate_get_current(); @@ -556,6 +565,20 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) { + if (new_caps[MIGRATION_CAPABILITY_AUTO_CONVERGE]) { + error_setg(errp, "dirty-limit conflicts with auto-converge" + " either of then available currently"); + return false; + } + + if (!kvm_enabled() || !kvm_dirty_ring_enabled()) { + error_setg(errp, "dirty-limit requires KVM with accelerator" + " property 'dirty-ring-size' set"); + return false; + } + } + return true; } =20 diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 5c12d26d49..3f1103b04b 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 Sat May 18 13:36:57 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=1687400260; cv=none; d=zohomail.com; s=zohoarc; b=dpKWYtu3OCGowYJ5Z+F2HmJNGakjbFjMWIWZCAsMTqMvTgrPrri4ibBYB+ucb/xxWVDLdnkbuS5oof6S3coj9HDUikZlCOaSfSCEHcvE+m179MeVhlFqBsMKMsSUs5ZAu+JKDhPHuBuPLBN7DaIB0hqw+jDL37r2zLvp/QzgY+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400260; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fyGp5tlDuMU4pJ2uo8I+uUxA4U7xysFjVKjI1S8HWyk=; b=GoyeCmlUCn9NarcbOef+GPjr9pp85XKerd6bjqmFIH3ONiLf2jktrQKxVXs25LXAHLeeH30nnhq3ivSVWV02xIUD2dhk8J+ou7N7BR9HYs2Ba2bw6NF5FTm4h9FfrFamhYL0VkWKur1bpxg3j0LZUhDA6FUPhQEoWRI/wCBPnkc= 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 16874002605802.634159970151927; Wed, 21 Jun 2023 19:17:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pv-00065X-7z; Wed, 21 Jun 2023 22:14:15 -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 1qC9pt-000658-TW for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:13 -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 1qC9ps-0004xt-9E for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:13 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-b1lC7gENMHOdjCTob-csrQ-1; Wed, 21 Jun 2023 22:14:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A9A49810BB2; Thu, 22 Jun 2023 02:14:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D7FE112132C; Thu, 22 Jun 2023 02:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fyGp5tlDuMU4pJ2uo8I+uUxA4U7xysFjVKjI1S8HWyk=; b=N0+xo85cLqXvabp4/8jCXidr//NCyVOcdIJ2UFT8WKXhfeJr9ishSkSbKnZeNGnFO43R5o 0xMwU010/w9O22bTxXiJXR8biHdaMCzuwHvQpPvLNdERa2TLs6XokJdJbqimog0RaZacdR eqwyDyj7ys0UYT4MluxVJeZiFWpvfmk= X-MC-Unique: b1lC7gENMHOdjCTob-csrQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 07/30] migration: Refactor auto-converge capability logic Date: Thu, 22 Jun 2023 04:12:57 +0200 Message-Id: <20230622021320.66124-8-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400262644100002 From: Hyman Huang(=E9=BB=84=E5=8B=87) Check if block migration is running before throttling guest down in auto-converge way. Note that this modification is kind of like code clean, because block migration does not depend on auto-converge capability, so the order of checks can be adjusted. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Acked-by: Peter Xu Reviewed-by: Juan Quintela Message-Id: <168618975839.6361.17407633874747688653-5@git.sr.ht> Signed-off-by: Juan Quintela --- migration/ram.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 5283a75f02..78746849b5 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -995,7 +995,11 @@ static void migration_trigger_throttle(RAMState *rs) /* During block migration the auto-converge logic incorrectly detects * that ram migration makes no progress. Avoid this by disabling the * throttling logic during the bulk phase of block migration. */ - if (migrate_auto_converge() && !blk_mig_bulk_active()) { + if (blk_mig_bulk_active()) { + return; + } + + if (migrate_auto_converge()) { /* The following detection logic can be refined later. For now: Check to see if the ratio between dirtied bytes and the approx. amount of bytes that just got transferred since the last time --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400254; cv=none; d=zohomail.com; s=zohoarc; b=dYNgkCt1pMCcYCOLMn5es/qObKHLmo8pn/YilZ+Z2nr7pYzPr6TUj8IJkyr96Kb/4b5DDb3rKqjPWmNn7jpOGR8eCfeo2cG9lMrNck2r2TIq1qBuAgN1jASAhrRkODwYBxxVg66UMMFqLtXHy14amiLxIu64iFf4GoUDc/5Y1zw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400254; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RyrBR3BrwHNOq+0v7TNtPuGcKpCABMgy95OqYLF5fYM=; b=U2hKkXFa06NL6Ww+Zk6Y6+QRm2xQJPfDYJO/JPneqEJ2DbkfirjuBESLDZ+qpWgdtlo+GKKB4J+GrZARwUGtZ/Iyrj8VSa2hppAd5e8viQLfcpLZMGaG5a75NnhaW0iM2igcIOZYGgjdjv4ghqRPkv7JmzweQ4VQmDDIBMMsIh0= 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 1687400254127733.222712791523; Wed, 21 Jun 2023 19:17:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9px-00068X-V8; Wed, 21 Jun 2023 22:14:18 -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 1qC9pv-00066l-8i for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:15 -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 1qC9pt-0004yE-NK for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-DHhFjAv5O2aJ1v9JpktR5w-1; Wed, 21 Jun 2023 22:14:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E146380052A; Thu, 22 Jun 2023 02:14:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3574112132E; Thu, 22 Jun 2023 02:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RyrBR3BrwHNOq+0v7TNtPuGcKpCABMgy95OqYLF5fYM=; b=Id3GiAEG+L1roQx+z8Q8Txqu/xGUUZNqFGjvbGJpQ9/HHfFtEM6z3b4aic70fuwjJljO5g UaxFG0OD7uY+pWgabHnpJnnZKHF6UYFUbiOSS8jwAa+3S/beKVWPWL2RPgDcyRxqHqQytK UDV0IhJ+2edXyuTwX6sI98+WzPr1YMw= X-MC-Unique: DHhFjAv5O2aJ1v9JpktR5w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 08/30] migration: Put the detection logic before auto-converge checking Date: Thu, 22 Jun 2023 04:12:58 +0200 Message-Id: <20230622021320.66124-9-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400254754100003 From: Hyman Huang(=E9=BB=84=E5=8B=87) This commit is prepared for the implementation of dirty-limit convergence algo. The detection logic of throttling condition can apply to both auto-converge and dirty-limit algo, putting it's position before the checking logic for auto-converge feature. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Juan Quintela Message-ID: <168733225273.5845.15871826788879741674-6@git.sr.ht> Signed-off-by: Juan Quintela --- migration/ram.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 78746849b5..b6559f9312 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -999,17 +999,18 @@ static void migration_trigger_throttle(RAMState *rs) return; } =20 - if (migrate_auto_converge()) { - /* The following detection logic can be refined later. For now: - Check to see if the ratio between dirtied bytes and the approx. - amount of bytes that just got transferred since the last time - we were in this routine reaches the threshold. If that happens - twice, start or increase throttling. */ - - if ((bytes_dirty_period > bytes_dirty_threshold) && - (++rs->dirty_rate_high_cnt >=3D 2)) { + /* + * The following detection logic can be refined later. For now: + * Check to see if the ratio between dirtied bytes and the approx. + * amount of bytes that just got transferred since the last time + * we were in this routine reaches the threshold. If that happens + * twice, start or increase throttling. + */ + if ((bytes_dirty_period > bytes_dirty_threshold) && + (++rs->dirty_rate_high_cnt >=3D 2)) { + rs->dirty_rate_high_cnt =3D 0; + if (migrate_auto_converge()) { trace_migration_throttle(); - rs->dirty_rate_high_cnt =3D 0; mig_throttle_guest_down(bytes_dirty_period, bytes_dirty_threshold); } --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400127; cv=none; d=zohomail.com; s=zohoarc; b=YecNiS/MHmNTb7gHTaBT7BgI1dYxybIU52nt+k2vr62ke/zVg4sQgJhfy/Uk1FFXcgHjcvHsiaq/apnsGRgLrV88Md3twCsYmteUMdGcn445+q9VMNjNuK3n158qnTI5zEIW0H8eq0QOVzFdUH5PDjm8fGd1DInM2nRnXLuLHUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400127; 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=1m5a8MExYn64qqA78BKQfNDEfFIFuKJa3rn1I7bapmM=; b=ZXW+G8Z+Mrefp8oGA4szBq0hv6j/OZ3WN0L0iPv23s64uHoNlzI6i0Ho2EpwuwxqFgszn1nZUhV67CTW+alnWpsj9WYS8bKrh6+U1eZU5Ob2RHq/hP8N2gCLZBHEmnb2VfcRAFUGh/I5JStZAsowNGh+4/EDKJhR5dxOje32hTM= 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 1687400127568837.4785167947106; Wed, 21 Jun 2023 19:15:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9pz-0006AL-Dv; Wed, 21 Jun 2023 22:14:22 -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 1qC9pw-00067q-6l for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9pu-0004yM-FS for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:15 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-156-97P7hNiIPZ-O_H68nMAXQw-1; Wed, 21 Jun 2023 22:14:11 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8515F380052A; Thu, 22 Jun 2023 02:14:11 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 678C3112132E; Thu, 22 Jun 2023 02:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400053; 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=1m5a8MExYn64qqA78BKQfNDEfFIFuKJa3rn1I7bapmM=; b=bG1CUnzpnb3Ou9cwAJokEI5ps6BLR7OO/5rHUdJJn6vScPcP0yyzRpC+0H26tWiDFjLRgo JqGoQce0Pruhx4Rg5GLJrW1sWOhPHI4190pGNrozBQ1LU5FHQYOklZkR40VyJYIfM6QD0r tf5tNm6uKi6KWW6jDBk+pZVxoUTKBEQ= X-MC-Unique: 97P7hNiIPZ-O_H68nMAXQw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 09/30] migration: Implement dirty-limit convergence algo Date: Thu, 22 Jun 2023 04:12:59 +0200 Message-Id: <20230622021320.66124-10-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400128284100007 From: Hyman Huang(=E9=BB=84=E5=8B=87) Implement dirty-limit convergence algo for live migration, which is kind of like auto-converge algo but using dirty-limit instead of cpu throttle to make migration convergent. Enable dirty page limit if dirty_rate_high_cnt greater than 2 when dirty-limit capability enabled, Disable dirty-limit if migration be canceled. Note that "set_vcpu_dirty_limit", "cancel_vcpu_dirty_limit" commands are not allowed during dirty-limit live migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Message-ID: <168733225273.5845.15871826788879741674-7@git.sr.ht> Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/migration.c | 3 +++ migration/ram.c | 36 ++++++++++++++++++++++++++++++++++++ softmmu/dirtylimit.c | 29 +++++++++++++++++++++++++++++ migration/trace-events | 1 + 4 files changed, 69 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 3a001dd042..c101784dfa 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -165,6 +165,9 @@ void migration_cancel(const Error *error) if (error) { migrate_set_error(current_migration, error); } + if (migrate_dirty_limit()) { + qmp_cancel_vcpu_dirty_limit(false, -1, NULL); + } migrate_fd_cancel(current_migration); } =20 diff --git a/migration/ram.c b/migration/ram.c index b6559f9312..8a86363216 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -46,6 +46,7 @@ #include "qapi/error.h" #include "qapi/qapi-types-migration.h" #include "qapi/qapi-events-migration.h" +#include "qapi/qapi-commands-migration.h" #include "qapi/qmp/qerror.h" #include "trace.h" #include "exec/ram_addr.h" @@ -59,6 +60,8 @@ #include "multifd.h" #include "sysemu/runstate.h" #include "options.h" +#include "sysemu/dirtylimit.h" +#include "sysemu/kvm.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ =20 @@ -984,6 +987,37 @@ static void migration_update_rates(RAMState *rs, int64= _t end_time) } } =20 +/* + * Enable dirty-limit to throttle down the guest + */ +static void migration_dirty_limit_guest(void) +{ + /* + * dirty page rate quota for all vCPUs fetched from + * migration parameter 'vcpu_dirty_limit' + */ + static int64_t quota_dirtyrate; + MigrationState *s =3D migrate_get_current(); + + /* + * If dirty limit already enabled and migration parameter + * vcpu-dirty-limit untouched. + */ + if (dirtylimit_in_service() && + quota_dirtyrate =3D=3D s->parameters.vcpu_dirty_limit) { + return; + } + + quota_dirtyrate =3D s->parameters.vcpu_dirty_limit; + + /* + * Set all vCPU a quota dirtyrate, note that the second + * parameter will be ignored if setting all vCPU for the vm + */ + qmp_set_vcpu_dirty_limit(false, -1, quota_dirtyrate, NULL); + trace_migration_dirty_limit_guest(quota_dirtyrate); +} + static void migration_trigger_throttle(RAMState *rs) { uint64_t threshold =3D migrate_throttle_trigger_threshold(); @@ -1013,6 +1047,8 @@ static void migration_trigger_throttle(RAMState *rs) trace_migration_throttle(); mig_throttle_guest_down(bytes_dirty_period, bytes_dirty_threshold); + } else if (migrate_dirty_limit()) { + migration_dirty_limit_guest(); } } } diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 3f1103b04b..6e218bb249 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -436,6 +436,23 @@ static void dirtylimit_cleanup(void) dirtylimit_state_finalize(); } =20 +/* + * dirty page rate limit is not allowed to set if migration + * is running with dirty-limit capability enabled. + */ +static bool dirtylimit_is_allowed(void) +{ + MigrationState *ms =3D migrate_get_current(); + + if (migration_is_running(ms->state) && + (!qemu_thread_is_self(&ms->thread)) && + migrate_dirty_limit() && + dirtylimit_in_service()) { + return false; + } + return true; +} + void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index, int64_t cpu_index, Error **errp) @@ -449,6 +466,12 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index, return; } =20 + if (!dirtylimit_is_allowed()) { + error_setg(errp, "can't cancel dirty page rate limit while" + " migration is running"); + return; + } + if (!dirtylimit_in_service()) { return; } @@ -499,6 +522,12 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index, return; } =20 + if (!dirtylimit_is_allowed()) { + error_setg(errp, "can't set dirty page rate limit while" + " migration is running"); + return; + } + if (!dirty_rate) { qmp_cancel_vcpu_dirty_limit(has_cpu_index, cpu_index, errp); return; diff --git a/migration/trace-events b/migration/trace-events index cdaef7a1ea..c5cb280d95 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -91,6 +91,7 @@ migration_bitmap_sync_start(void) "" migration_bitmap_sync_end(uint64_t dirty_pages) "dirty_pages %" PRIu64 migration_bitmap_clear_dirty(char *str, uint64_t start, uint64_t size, uns= igned long page) "rb %s start 0x%"PRIx64" size 0x%"PRIx64" page 0x%lx" migration_throttle(void) "" +migration_dirty_limit_guest(int64_t dirtyrate) "guest dirty page rate limi= t %" PRIi64 " MB/s" ram_discard_range(const char *rbname, uint64_t start, size_t len) "%s: sta= rt: %" PRIx64 " %zx" ram_load_loop(const char *rbname, uint64_t addr, int flags, void *host) "%= s: addr: 0x%" PRIx64 " flags: 0x%x host: %p" ram_load_postcopy_loop(int channel, uint64_t addr, int flags) "chan=3D%d a= ddr=3D0x%" PRIx64 " flags=3D0x%x" --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400248; cv=none; d=zohomail.com; s=zohoarc; b=FdV3ZQ+wVq5h3R5LOW4UDGvGdBk+JAo/tG2bFtDwNS6mc8LcfnzINFyNmqv8UAkbkyE7JfPvcWppb0bQ+uMyhBqWKdi/0/pFoTLRMAeIElf8BJZSlXm78bzXsNBhGcxaIgkguIaoRERI8xjUEtr3CUjfXpaqcSFvQiePHG+K9uA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400248; 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=P70FlDZpObGZQS8D4nsK+aA0KbBwtH1uHs73xK+ae/4=; b=mPkg4xhJY3C8tyiRXjEingWfLFq3vz78+DRbAOK3dIBSEa4RBMQdpNiBpmMTvPktR/fJp/6TSExnRoqrru6yW5tMtbqzlSrob4ORrLBaa9FZs0sAe2Sk9AhRAjIza1giRa0WWq6rYA+YkA/Yo/U835gvdzFtn56nmix9QRFRkFA= 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 1687400248523284.02327766969336; Wed, 21 Jun 2023 19:17:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qW-0007rd-1X; Wed, 21 Jun 2023 22:14: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 1qC9qG-0006u1-VP for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qE-00054A-14 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:35 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-36-7-12WZQxP_6dW9J4XFE3Ig-1; Wed, 21 Jun 2023 22:14:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ED4ED3C10145; Thu, 22 Jun 2023 02:14:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEFCB112132E; Thu, 22 Jun 2023 02:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400073; 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=P70FlDZpObGZQS8D4nsK+aA0KbBwtH1uHs73xK+ae/4=; b=EYqvDNBIylxcdLspF1zmaDSMQPtKqew1YRolao4ykPI3B2wyRxutVaI4zC9PtUrmmVdc2N /dZkUsh0mbKdrQ/2KrnHG0Qo8eC/V97Dl2eDOJruudHvINfNgCObj6lFlBJkdx2xohJa5Q wIVInbIb/4f3xNFCHU3voYuj7FCUdhI= X-MC-Unique: 7-12WZQxP_6dW9J4XFE3Ig-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?= Subject: [PULL 10/30] migration: Extend query-migrate to provide dirty page limit info Date: Thu, 22 Jun 2023 04:13:00 +0200 Message-Id: <20230622021320.66124-11-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400248754100002 From: Hyman Huang(=E9=BB=84=E5=8B=87) Extend query-migrate to provide throttle time and estimated ring full time with dirty-limit capability enabled, through which we can observe if dirty limit take effect during live migration. Signed-off-by: Hyman Huang(=E9=BB=84=E5=8B=87) Reviewed-by: Markus Armbruster Reviewed-by: Juan Quintela Message-ID: <168733225273.5845.15871826788879741674-8@git.sr.ht> Signed-off-by: Juan Quintela --- qapi/migration.json | 16 +++++++++++++- include/sysemu/dirtylimit.h | 2 ++ migration/migration-hmp-cmds.c | 10 +++++++++ migration/migration.c | 10 +++++++++ softmmu/dirtylimit.c | 39 ++++++++++++++++++++++++++++++++++ 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/qapi/migration.json b/qapi/migration.json index 621e6604c6..e9b24fc410 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -250,6 +250,18 @@ # blocked. Present and non-empty when migration is blocked. # (since 6.0) # +# @dirty-limit-throttle-time-per-round: Maximum throttle time (in microsec= onds) of virtual +# CPUs each dirty ring full round, w= hich shows how +# MigrationCapability dirty-limit af= fects the guest +# during live migration. (since 8.1) +# +# @dirty-limit-ring-full-time: Estimated average dirty ring full time (in = microseconds) +# each dirty ring full round, note that the v= alue equals +# dirty ring memory size divided by average d= irty page rate +# of virtual CPU, which can be used to observ= e the average +# memory load of virtual CPU indirectly. Note= that zero +# means guest doesn't dirty memory (since 8.1) +# # Since: 0.14 ## { 'struct': 'MigrationInfo', @@ -267,7 +279,9 @@ '*postcopy-blocktime' : 'uint32', '*postcopy-vcpu-blocktime': ['uint32'], '*compression': 'CompressionStats', - '*socket-address': ['SocketAddress'] } } + '*socket-address': ['SocketAddress'], + '*dirty-limit-throttle-time-per-round': 'uint64', + '*dirty-limit-ring-full-time': 'uint64'} } =20 ## # @query-migrate: diff --git a/include/sysemu/dirtylimit.h b/include/sysemu/dirtylimit.h index 8d2c1f3a6b..d11ebbbbdb 100644 --- a/include/sysemu/dirtylimit.h +++ b/include/sysemu/dirtylimit.h @@ -34,4 +34,6 @@ void dirtylimit_set_vcpu(int cpu_index, void dirtylimit_set_all(uint64_t quota, bool enable); void dirtylimit_vcpu_execute(CPUState *cpu); +uint64_t dirtylimit_throttle_time_per_round(void); +uint64_t dirtylimit_ring_full_time(void); #endif diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 35e8020bbf..c115ef2d23 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -190,6 +190,16 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) info->cpu_throttle_percentage); } =20 + if (info->has_dirty_limit_throttle_time_per_round) { + monitor_printf(mon, "dirty-limit throttle time: %" PRIu64 " us\n", + info->dirty_limit_throttle_time_per_round); + } + + if (info->has_dirty_limit_ring_full_time) { + monitor_printf(mon, "dirty-limit ring full time: %" PRIu64 " us\n", + info->dirty_limit_ring_full_time); + } + if (info->has_postcopy_blocktime) { monitor_printf(mon, "postcopy blocktime: %u\n", info->postcopy_blocktime); diff --git a/migration/migration.c b/migration/migration.c index c101784dfa..719f91573f 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -64,6 +64,7 @@ #include "yank_functions.h" #include "sysemu/qtest.h" #include "options.h" +#include "sysemu/dirtylimit.h" =20 static NotifierList migration_state_notifiers =3D NOTIFIER_LIST_INITIALIZER(migration_state_notifiers); @@ -968,6 +969,15 @@ static void populate_ram_info(MigrationInfo *info, Mig= rationState *s) info->ram->dirty_pages_rate =3D stat64_get(&mig_stats.dirty_pages_rate); } + + if (migrate_dirty_limit() && dirtylimit_in_service()) { + info->has_dirty_limit_throttle_time_per_round =3D true; + info->dirty_limit_throttle_time_per_round =3D + dirtylimit_throttle_time_per_round(); + + info->has_dirty_limit_ring_full_time =3D true; + info->dirty_limit_ring_full_time =3D dirtylimit_ring_full_time(); + } } =20 static void populate_disk_info(MigrationInfo *info) diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 6e218bb249..af27f0d022 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 Sat May 18 13:36:57 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=1687400170; cv=none; d=zohomail.com; s=zohoarc; b=gA9J5muhTj5289YURT8w/a6sA0SooI5jvBTC+64zTpH29spe/ETxYpv0R7tNu51BX0Z3q4kf6/jqdIiqv1kv2FB7u83nimne+PuMMzAMVrjmDEYGWvXRJGeUA1Gr5SLaqBvNb+reDpPE0lDfsVQMiKxSbKbEHHpycyzWTAT8CRI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400170; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aN5p6skIIBhg7piCxOmYKQra9+UkFG8YnJMzg4pOE2E=; b=FXkAhgD5OjrXfyXp1ESP8lY1Gbyj1Y7hF0xSDZGNyTLuwFxOfxsld1W01xFPyW3kBHGTUzoZdXnFarbEwH2cufTy3zxQJBo+/K1EEz0WfRrU8+tRVIdDfI/i0Tx6IiTHYO4gG3L9ugXyOLdIxLQAOiiv7z5DJrkR0HmK5IyR28A= 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 1687400170112800.8504313589401; Wed, 21 Jun 2023 19:16:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qC-0006bl-AU; Wed, 21 Jun 2023 22:14:32 -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 1qC9q3-0006Jp-5B for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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 1qC9q1-000519-Nu for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:22 -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-515-19AtB0rhMku8Vq-D-dyI8w-1; Wed, 21 Jun 2023 22:14:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 39D5E8028B2; Thu, 22 Jun 2023 02:14:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 420D3112132C; Thu, 22 Jun 2023 02:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400061; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aN5p6skIIBhg7piCxOmYKQra9+UkFG8YnJMzg4pOE2E=; b=hji0kVU+4oVDR8zMADc6HakNiTFBfzyKBvvoeqdtMz5Ez/L7fgHLqaFo1+4VKx6EoC9w+d 2gsIBWpwzb3JfS9tYChW0gtzG8Q12wuE9LuiWdoj/noD26N1Fn1slxpCzC5D3v0lJ3qkVj Gmmelvd88OLDRHxlh0dEPbJYDmcwM9s= X-MC-Unique: 19AtB0rhMku8Vq-D-dyI8w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 11/30] migration-test: Be consistent for ppc Date: Thu, 22 Jun 2023 04:13:01 +0200 Message-Id: <20230622021320.66124-12-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400170415100001 Content-Type: text/plain; charset="utf-8" It makes no sense that we don't have the same configuration on both sides. Reviewed-by: Laurent Vivier Message-ID: <20230608224943.3877-2-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index b0c355bbd9..c5e0c69c6b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -646,7 +646,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup(""); + arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "virt,gic-version=3Dmax"; --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400188; cv=none; d=zohomail.com; s=zohoarc; b=EQrRqD8L30Gn6NRbaHbdpKD/8w6L6RxIX50CJmARJXahU7o7yO6HCc0UP7mJ75802h39ZtfEnddy0WB91AFINOdFz0aoJKv7uokkiiS+8ad8dygAem1ca47BSm70lS+GlXGvX593Bpv4sxMvW25qS/uvRw+UePRrQw/cU4CnBtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400188; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/rFBgHJ4D0rnee2hOZE5ZKRJbpKxVo1csNBW02wMzHA=; b=N6fRiYCCiGpJ8gZ93RktBv03Op9PQXHBjNFb3plRFMp6ojNSyiYcIbSqkhhX5szRvbUTpbDdo+9wOwsbdL8wokXPdGzQiZaAlFQGIM5GbeNuI8y6UOLCOFDxnOnNd1nVysifLvZ7xX1wYQfXZFqXDeSdJtAEXds8CKuIyG61g4k= 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 1687400188065126.78177624991156; Wed, 21 Jun 2023 19:16:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qC-0006cw-6M; Wed, 21 Jun 2023 22:14:32 -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 1qC9q5-0006Mz-Qb for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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 1qC9q4-00051h-A6 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-hupQGlqFM1mR8yx26P5xCA-1; Wed, 21 Jun 2023 22:14:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9BE4C185A7A7; Thu, 22 Jun 2023 02:14:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8011F112132C; Thu, 22 Jun 2023 02:14:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400063; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/rFBgHJ4D0rnee2hOZE5ZKRJbpKxVo1csNBW02wMzHA=; b=ajBaAiFJdPjmX6Rmnjtu0JRvnoT7q8jVl9gnn4dUHcWL0tXwqOmmgyQFHux+lYY9qYklqi AtZsnknZuOPBMuZ3/Y/d5nX5lTo1Fy0FXvy5gqaWOX1K59Z6ANEUvY7kRgWn/3UFaHz+up 5iC5DTaXkRfcpNsP7Hw40g5oBukE2ik= X-MC-Unique: hupQGlqFM1mR8yx26P5xCA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 12/30] migration-test: Make machine_opts regular with other options Date: Thu, 22 Jun 2023 04:13:02 +0200 Message-Id: <20230622021320.66124-13-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400188407100005 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Signed-off-by: Juan Quintela Message-ID: <20230608224943.3877-5-quintela@redhat.com> --- tests/qtest/migration-test.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index c5e0c69c6b..79157d600b 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -637,7 +637,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "vsmt=3D8"; + machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -649,7 +649,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, arch_target =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_opts =3D "virt,gic-version=3Dmax"; + machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; arch_source =3D g_strdup_printf("-cpu max " "-kernel %s", @@ -689,14 +689,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, arch_source, shmem_opts, @@ -709,7 +708,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -717,7 +716,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? " -machine " : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_target, shmem_opts, --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400292; cv=none; d=zohomail.com; s=zohoarc; b=iUdOymERoJ9S1APCBkwM9vdSIKrS0Uc/zJAGGsEULjUrbSNQXNUYLKPo+qMbWKdLhlcihIHCssxStjofec2Syc9OZwhCktrAw4HNfz/sk6XZkbPPfYy+ZV5KN+3cL/Ml4DQ1T2f+SbzvlomRflV4U3DdVjGeRNfqQbCL33PJXd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400292; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=feGe41Lqr8pFN4/LkM2/RlPwQoWrtkla/6guXH2f0IA=; b=CZozauV3FyO0L9M4Rn8M2fWYZLNN/CkQgDfPKwK66twJIe5zfcfAvKlubsBi4hc+VQrtBSXZre7RftuALj4AHC+pHsEb6YT0qBup/Y+YHxNkv1blpfPGHFr2N7sTy7zG9Y/6O+xSX9sFvJToKaTERN71EY1qXG9gr1pWhdrMk3Q= 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 1687400292360507.87281803573273; Wed, 21 Jun 2023 19:18:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qO-0006zg-B6; Wed, 21 Jun 2023 22:14: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 1qC9q8-0006RR-Ov for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:30 -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 1qC9q6-00052H-FQ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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-669-eZEooO64PWuuuuqFpufVWQ-1; Wed, 21 Jun 2023 22:14:23 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 115158C5865; Thu, 22 Jun 2023 02:14:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id E51CF112132C; Thu, 22 Jun 2023 02:14:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=feGe41Lqr8pFN4/LkM2/RlPwQoWrtkla/6guXH2f0IA=; b=DFi9+cTKn9fE5a6f0erUxUU5cIqgJwsLs0YNHBD+Tddr/uofWnEl3mJvkAWNDA+aeM3vlY QQxsJUusS67REseqd897FyGZV0G6fGD/bKszY8hOtjQq4IX25hgtQgPQW1sOyHIedPIQo0 MogVvxl+BJFohgehz3ZtKeSUn/Lybs0= X-MC-Unique: eZEooO64PWuuuuqFpufVWQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 13/30] migration-test: Create arch_opts Date: Thu, 22 Jun 2023 04:13:03 +0200 Message-Id: <20230622021320.66124-14-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400292905100005 Content-Type: text/plain; charset="utf-8" This will contain the options needed for both source and target. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-6-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 79157d600b..4d8542f5c7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -600,6 +600,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, { g_autofree gchar *arch_source =3D NULL; g_autofree gchar *arch_target =3D NULL; + /* options for source and target */ + g_autofree gchar *arch_opts =3D NULL; g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr; @@ -625,15 +627,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, assert(sizeof(x86_bootsect) =3D=3D 512); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-drive file=3D%s,format=3Draw", b= ootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; - arch_source =3D g_strdup_printf("-bios %s", bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { @@ -641,20 +641,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; - arch_source =3D g_strdup_printf("-nodefaults " - "-prom-env 'use-nvramrc?=3Dtrue' -pr= om-env " + arch_source =3D g_strdup_printf("-prom-env 'use-nvramrc?=3Dtrue' -= prom-env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_target =3D g_strdup("-nodefaults"); + arch_opts =3D g_strdup("-nodefaults"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_source =3D g_strdup_printf("-cpu max " - "-kernel %s", - bootpath); - arch_target =3D g_strdup(arch_source); + arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -693,12 +689,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, - arch_source, shmem_opts, + arch_opts ? arch_opts : "", + arch_source ? arch_source : "", + shmem_opts, args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { @@ -713,12 +711,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "-m %s " "-serial file:%s/dest_serial " "-incoming %s " - "%s %s %s %s", + "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", machine_opts ? machine_opts : "", memory_size, tmpfs, uri, - arch_target, shmem_opts, + arch_opts ? arch_opts : "", + arch_target ? arch_target : "", + shmem_opts, args->opts_target ? args->opts_target : "= ", ignore_stderr); *to =3D qtest_init(cmd_target); --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400273; cv=none; d=zohomail.com; s=zohoarc; b=WSqdgIMbnKZO6rDyCtbPYhk0rZB05Gpn460RYjycpeq7/RDe7zPDGunIFH/jnAH1yHfM5kthP3rF7kQA9oT2DS+PFVDuC7V4YNybw1Na9aUdVgKHQ1lg1eYAk3+1FrfEjY1qrph7MUlMtUJ0C0WReI9DZXcANZETS1H6PuWouxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400273; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iYb2bfBZQLdDFilPwdrDveJpKsXXGmfNbdXXcf46b9s=; b=XW5qm+i+Q/lMbm9Vn9jr4xsUbW07A4vomEscn62Df809v8MmXDozAXD4cIRWQc+H75KIcfw2d69yNuuc7sMHdeiHJuo8v7n4A+LpUaFcMWxuKSYMn81Z0JOZay4mM6D58LpUJ0Hh7gcqQmyUXrqkKFwzAFkxWfzSorQFqfLh1IM= 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 1687400273698437.349865108107; Wed, 21 Jun 2023 19:17:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qR-0007Ed-AV; Wed, 21 Jun 2023 22:14: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 1qC9qB-0006Z4-3j for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:31 -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 1qC9q8-00052c-HE for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:30 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-22-5xVJucRgP_-Cga5-7BuiPA-1; Wed, 21 Jun 2023 22:14:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 752AC3C10160; Thu, 22 Jun 2023 02:14:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A7D2112132C; Thu, 22 Jun 2023 02:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iYb2bfBZQLdDFilPwdrDveJpKsXXGmfNbdXXcf46b9s=; b=PPEiBnXW+qJkH90kHNaYXJO9ezdOb1BCo9W1skCv2OOzLt9yazdARQrFkUbMU7N2BIViWt cOZlk/IA+UceXv3tXtvT96FC8Gk9bwusWtbrIa0Cx+SEUGWrbZo719qUkjeGuHFKSjywDK +iB9fsiuv/HX+lWoxM7s3EgCzgnUNRQ= X-MC-Unique: 5xVJucRgP_-Cga5-7BuiPA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 14/30] migration-test: machine_opts is really arch specific Date: Thu, 22 Jun 2023 04:13:04 +0200 Message-Id: <20230622021320.66124-15-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400274818100003 Content-Type: text/plain; charset="utf-8" And it needs to be in both source and target, so put it on arch_opts. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-7-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 4d8542f5c7..fc3337b7bb 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -609,7 +609,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *arch =3D qtest_get_arch(); - const char *machine_opts =3D NULL; const char *memory_size; =20 if (args->use_shmem) { @@ -637,7 +636,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_opts =3D "-machine vsmt=3D8"; memory_size =3D "256M"; start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -645,12 +643,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " "until'", end_address, start_address= ); - arch_opts =3D g_strdup("-nodefaults"); + arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_opts =3D "-machine virt,gic-version=3Dmax"; memory_size =3D "150M"; - arch_opts =3D g_strdup_printf("-cpu max -kernel %s", bootpath); + arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " + "-kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -685,14 +683,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 - cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -706,7 +703,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, &got_src_stop); } =20 - cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg %s " + cmd_target =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " @@ -714,7 +711,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=3D4096" : "", - machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400255; cv=none; d=zohomail.com; s=zohoarc; b=bzjtsdI/2g4CNT7tZSuomnFT52ykUZeUrYNdD720C2L4YzcpU84g/JLoKuGaxOh+1nI3qFg7se1oV62tB+XgqQYmfTaszmlr6b8Z8iWbGriYxy01IV+4wmBzB9TntvjfsAEVaee6eO3tRze50Nsns3X0P/FDjLCmiXcLuR5Smfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400255; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=th20gtdJz46Y/hIxKBOSCv22ZBhWyLLDoPcKqHvRxik=; b=euqJJ7SYEoyh8kmDACc9sL3Nc9vT3T138SPTbopMKYjhBg3dkuOZAAzx0z3ga/BeeeMXwZBp5aydH1W9il3Y4t3GWnvmllaIj0TeGQDnFSGq4otgS4sGZOq2Sx5MlFojbGrtefcGF3RaP+F6UmFrNEaqdtYq8F9Um7MwxTrMmsA= 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 1687400255274708.1003060520154; Wed, 21 Jun 2023 19:17:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qS-0007OQ-H1; Wed, 21 Jun 2023 22:14:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qE-0006jX-71 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:34 -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 1qC9qC-00053q-OL for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:33 -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-88-djaeEICyMzuB8WZXstiOzA-1; Wed, 21 Jun 2023 22:14:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B5B41101A54E; Thu, 22 Jun 2023 02:14:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDC50112132C; Thu, 22 Jun 2023 02:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=th20gtdJz46Y/hIxKBOSCv22ZBhWyLLDoPcKqHvRxik=; b=enLIPeT2lT0B/gJXSMwes1FxEWpWH4Uc+trRGADlCJVsaBfdqYDTof0On8XhrUE4V8X08U PvUjlCw5OBonyDCLXlKlxDKTDGIoqNwE6qGBDLXw2TMeZLKbFOjaLqQB5O5SCrd5MlZtE7 MHMSVwuylLlxkLIja9E0r0p5QZwqGuM= X-MC-Unique: djaeEICyMzuB8WZXstiOzA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 15/30] migration-test: Create kvm_opts Date: Thu, 22 Jun 2023 04:13:05 +0200 Message-Id: <20230622021320.66124-16-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400256601100006 Content-Type: text/plain; charset="utf-8" So arch_dirty_ring option becomes one option like the others. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-8-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index fc3337b7bb..40967fdffc 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -608,6 +608,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; + const char *kvm_opts =3D NULL; const char *arch =3D qtest_get_arch(); const char *memory_size; =20 @@ -683,13 +684,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 + if (args->use_dirty_ring) { + kvm_opts =3D ",dirty-ring-size=3D4096"; + } + cmd_source =3D g_strdup_printf("-accel kvm%s -accel tcg " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", @@ -709,8 +713,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s %s", - args->use_dirty_ring ? - ",dirty-ring-size=3D4096" : "", + kvm_opts ? kvm_opts : "", memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400201; cv=none; d=zohomail.com; s=zohoarc; b=na/97gOi6laxCNAvRmCSOwf1SrOwotbT4F0OS9Bq/Hn+ULjJs7ozvbA+aJPOtkfmU5O96l5kdiwhB7MOhLypLY+rTCyglBQqZkTAbVvZJhk8LnK/IHUtMuxsfhHZtmXYDF23HvQi33kPVi9l+fZyymcHa4nbdRD36GuojHGXql4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400201; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YK9i97oj+2hte8T79ySuooH4bjMECzrsr80F+WOLqQw=; b=haU6kDr3PBc/lm2+PcDja9iaxhfvgDlvwPSdryoxZPeUdP6+RVQiMznuxDKlDEYfAVKSO8z/TN/2qEWQasBrIjlSPHd7TIp662egh3JxOpAD1LAixJF52xKHcodYGWRZv/0iGJAx7qN6QEwQKT4Xf+pQ6WWP6ZzcTRc66/kMGsc= 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 1687400201599321.63448762874475; Wed, 21 Jun 2023 19:16:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qZ-0007zi-T8; Wed, 21 Jun 2023 22:14:56 -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 1qC9qK-00070z-90 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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 1qC9qG-00054k-Ur for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:38 -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-190-RoqpWqWAOBGOp3KXGdFLJQ-1; Wed, 21 Jun 2023 22:14:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 231D0104458D; Thu, 22 Jun 2023 02:14:30 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 079C3112132C; Thu, 22 Jun 2023 02:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YK9i97oj+2hte8T79ySuooH4bjMECzrsr80F+WOLqQw=; b=UCUVYklCrjQA7PElP/JFx6/NiiL5v/IAB8TLEUve1YjuHo0Rkz5+u0t1qmf15EyPYA+zVp FCAErast2HdlFmAJ66chZfqVWd6lSZA7UcFzCLdFLbeNYkV/EzyAxdaV0r2q0e60FokF1p uT4jWbKcZmbchJEJaLOkWM/fwHdRSE4= X-MC-Unique: RoqpWqWAOBGOp3KXGdFLJQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 16/30] migration-test: bootpath is the same for all tests and for all archs Date: Thu, 22 Jun 2023 04:13:06 +0200 Message-Id: <20230622021320.66124-17-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400203374100007 Content-Type: text/plain; charset="utf-8" So just make it a global variable. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-9-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 40967fdffc..0f80dbfe80 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -102,6 +102,7 @@ static bool ufd_version_check(void) #endif =20 static char *tmpfs; +static char *bootpath; =20 /* The boot file modifies memory area in [start_address, end_address) * repeatedly. It outputs a 'B' at a fixed rate while it's still running. @@ -110,7 +111,7 @@ static char *tmpfs; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(const char *bootpath, void *content, size_t len) +static void init_bootfile(void *content, size_t len) { FILE *bootfile =3D fopen(bootpath, "wb"); =20 @@ -605,7 +606,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_autofree gchar *cmd_source =3D NULL; g_autofree gchar *cmd_target =3D NULL; const gchar *ignore_stderr; - g_autofree char *bootpath =3D NULL; g_autofree char *shmem_opts =3D NULL; g_autofree char *shmem_path =3D NULL; const char *kvm_opts =3D NULL; @@ -621,17 +621,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 got_src_stop =3D false; got_dst_resume =3D false; - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { /* the assembled x86 boot sector should be exactly one sector larg= e */ assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); + init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -646,7 +645,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); + init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); @@ -764,7 +763,6 @@ static void test_migrate_end(QTestState *from, QTestSta= te *to, bool test_dest) =20 qtest_quit(to); =20 - cleanup("bootsect"); cleanup("migsocket"); cleanup("src_serial"); cleanup("dest_serial"); @@ -2493,12 +2491,10 @@ static QTestState *dirtylimit_start_vm(void) QTestState *vm =3D NULL; g_autofree gchar *cmd =3D NULL; const char *arch =3D qtest_get_arch(); - g_autofree char *bootpath =3D NULL; =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + init_bootfile(x86_bootsect, sizeof(x86_bootsect)); =20 cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " @@ -2514,7 +2510,6 @@ static QTestState *dirtylimit_start_vm(void) static void dirtylimit_stop_vm(QTestState *vm) { qtest_quit(vm); - cleanup("bootsect"); cleanup("vm_serial"); } =20 @@ -2676,6 +2671,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); + bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2819,6 +2815,8 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 + cleanup("bootsect"); + g_free(bootpath); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400126; cv=none; d=zohomail.com; s=zohoarc; b=MiFmTeiQCCX/pBzWSki1wN6cLFblZbbuNTBxRZf/b5OanMiJVsJddS8L2HYPx14800QU5+xdjNSNWcv/4PA4po67Lx/3nozJeTq0Hf+bWyUXcFtJKZKpE7TCz783oBFnTlV35A2deZCcz52Wlw7PA0bxrjxAing0VUU+sOhuFPE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400126; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=n9TdMXOS+qjL+W5lDCLJHlY6rS6mQChhMxpnTbMZipM=; b=Q+qK82sjS1ruUSdi0qMT/OHAIHeuGfYtF7z96be4NqoJIvfP7r3Zmfxq5viDQqvOSNMAyAerYOn+B0tGHkaiG5aHQG4uVhaRs11iVeICl44HP/seZjPBxclAuSBphilyEJj9EeYKjrE++xgwXLQI9Hv+01xsoM0y8pOdVj6xbLU= 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 1687400126403919.9757363412398; Wed, 21 Jun 2023 19:15:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qo-0008TE-MV; Wed, 21 Jun 2023 22:15:10 -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 1qC9qK-00072A-Sj for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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 1qC9qH-00054u-4H for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:40 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-250-rgTzGs0MOqmKXeRI89MScQ-1; Wed, 21 Jun 2023 22:14:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8309D3C10152; Thu, 22 Jun 2023 02:14:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69C30112132C; Thu, 22 Jun 2023 02:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n9TdMXOS+qjL+W5lDCLJHlY6rS6mQChhMxpnTbMZipM=; b=C/lWDk7wJEJnuMRIT0H5xHuBBswkb0wQ9Ax6oMFmh3zjYIrkTUB+hrThiSDCITc1lvVKfr XKYV8OuWPAte9i4mhGEJ9DL1wAzRwDqbC8XFBUF2JzQsUb2iaLlLV4HDmNw9D4eT89Kx3T /ZoGcRB1zTUNnILuN5K15T+noZ7Mzj8= X-MC-Unique: rgTzGs0MOqmKXeRI89MScQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 17/30] migration-test: Add bootfile_create/delete() functions Date: Thu, 22 Jun 2023 04:13:07 +0200 Message-Id: <20230622021320.66124-18-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400128105100003 Content-Type: text/plain; charset="utf-8" The bootsector code is read only from the guest (otherwise we are going to have problems with it being read from both source and destination). Create a single copy for all the tests. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-10-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 50 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 0f80dbfe80..eb6a11e758 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -111,14 +111,47 @@ static char *bootpath; #include "tests/migration/aarch64/a-b-kernel.h" #include "tests/migration/s390x/a-b-bios.h" =20 -static void init_bootfile(void *content, size_t len) +static void bootfile_create(char *dir) { + const char *arch =3D qtest_get_arch(); + unsigned char *content; + size_t len; + + bootpath =3D g_strdup_printf("%s/bootsect", dir); + if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { + /* the assembled x86 boot sector should be exactly one sector larg= e */ + g_assert(sizeof(x86_bootsect) =3D=3D 512); + content =3D x86_bootsect; + len =3D sizeof(x86_bootsect); + } else if (g_str_equal(arch, "s390x")) { + content =3D s390x_elf; + len =3D sizeof(s390x_elf); + } else if (strcmp(arch, "ppc64") =3D=3D 0) { + /* + * sane architectures can be programmed at the boot prompt + */ + return; + } else if (strcmp(arch, "aarch64") =3D=3D 0) { + content =3D aarch64_kernel; + len =3D sizeof(aarch64_kernel); + g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); + } else { + g_assert_not_reached(); + } + FILE *bootfile =3D fopen(bootpath, "wb"); =20 g_assert_cmpint(fwrite(content, len, 1, bootfile), =3D=3D, 1); fclose(bootfile); } =20 +static void bootfile_delete(void) +{ + unlink(bootpath); + g_free(bootpath); + bootpath =3D NULL; +} + /* * Wait for some output in the serial output file, * we get an 'A' followed by an endless string of 'B's @@ -622,15 +655,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, got_src_stop =3D false; got_dst_resume =3D false; if (strcmp(arch, "i386") =3D=3D 0 || strcmp(arch, "x86_64") =3D=3D 0) { - /* the assembled x86 boot sector should be exactly one sector larg= e */ - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-drive file=3D%s,format=3Draw", boo= tpath); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { - init_bootfile(s390x_elf, sizeof(s390x_elf)); memory_size =3D "128M"; arch_opts =3D g_strdup_printf("-bios %s", bootpath); start_address =3D S390_TEST_MEM_START; @@ -645,14 +674,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, "until'", end_address, start_address= ); arch_opts =3D g_strdup("-nodefaults -machine vsmt=3D8"); } else if (strcmp(arch, "aarch64") =3D=3D 0) { - init_bootfile(aarch64_kernel, sizeof(aarch64_kernel)); memory_size =3D "150M"; arch_opts =3D g_strdup_printf("-machine virt,gic-version=3Dmax -cp= u max " "-kernel %s", bootpath); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; - - g_assert(sizeof(aarch64_kernel) <=3D ARM_TEST_MAX_KERNEL_SIZE); } else { g_assert_not_reached(); } @@ -2493,9 +2519,6 @@ static QTestState *dirtylimit_start_vm(void) const char *arch =3D qtest_get_arch(); =20 assert((strcmp(arch, "x86_64") =3D=3D 0)); - assert(sizeof(x86_bootsect) =3D=3D 512); - init_bootfile(x86_bootsect, sizeof(x86_bootsect)); - cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " @@ -2671,7 +2694,7 @@ int main(int argc, char **argv) g_get_tmp_dir(), err->message); } g_assert(tmpfs); - bootpath =3D g_strdup_printf("%s/bootsect", tmpfs); + bootfile_create(tmpfs); =20 module_call_init(MODULE_INIT_QOM); =20 @@ -2815,8 +2838,7 @@ int main(int argc, char **argv) =20 g_assert_cmpint(ret, =3D=3D, 0); =20 - cleanup("bootsect"); - g_free(bootpath); + bootfile_delete(); ret =3D rmdir(tmpfs); if (ret !=3D 0) { g_test_message("unable to rmdir: path (%s): %s", --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400239; cv=none; d=zohomail.com; s=zohoarc; b=H6V+HXxvzZZtSb6cPvIp/hctnHsXVOUUKcI5LErDw6eBJ0aQhC5QWdzZsaIKa+KPMlH3I9j9AQv43+UEl4DNn5pouGf5k6wVE4obfOqvGq7WZ30hjqhDZ9c0uuRO6C8i0OlJE/6OLI1pylr+spXn90EC0ERZjS7trY7Kawt5UvQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400239; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7C3D7iNM38aBqhdSOuDcDrLT+thUiibV5CBvo7gXvFw=; b=YBhAuN22B3e16g66bDckckowPQILdeKYAbv2ktt7UGolCl4iyB7gASSqH3SnjMJouwgTWXvhIJ1LOCAgp8cOkbVW3+8ADVrjcS5PB+QFecE38zQMhvynPV+cZne3t4j83/4/OJPlHKsK3aRLuC8SwfA+cOXP2IOmhENdB2wyb9Y= 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 1687400239560966.2007611183848; Wed, 21 Jun 2023 19: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 1qC9qb-00085T-0W; Wed, 21 Jun 2023 22:14: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 1qC9qL-00072O-F7 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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 1qC9qI-00055I-NB for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:41 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-VxIyhA7gMAyJo7Ue8WJ9Xw-1; Wed, 21 Jun 2023 22:14:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3B3C1C06EDE; Thu, 22 Jun 2023 02:14:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC0B0112132C; Thu, 22 Jun 2023 02:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7C3D7iNM38aBqhdSOuDcDrLT+thUiibV5CBvo7gXvFw=; b=HArC8Wv+sAdSid7L4Rszv/aSEPh4mR23Sc81X5PnCs+b0LBaQ31K3LNeQ1wdEBSFf/r9we t7G072E2ketaSRE9G95SgUc2Lvy3LxuXBwxiC2TmVW6MoBdjpZ3aR4wCzZW3Cy1kKBGZya Zs5xDgUIAplLMY0l/Mcm6D7M60otEys= X-MC-Unique: VxIyhA7gMAyJo7Ue8WJ9Xw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 18/30] migration-test: dirtylimit checks for x86_64 arch before Date: Thu, 22 Jun 2023 04:13:08 +0200 Message-Id: <20230622021320.66124-19-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400240548100001 Content-Type: text/plain; charset="utf-8" So no need to assert we are in x86_64. Once there, refactor the function to remove useless variables. Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-11-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index eb6a11e758..fbe9db23cf 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2515,10 +2515,7 @@ static int64_t get_limit_rate(QTestState *who) static QTestState *dirtylimit_start_vm(void) { QTestState *vm =3D NULL; - g_autofree gchar *cmd =3D NULL; - const char *arch =3D qtest_get_arch(); - - assert((strcmp(arch, "x86_64") =3D=3D 0)); + g_autofree gchar * cmd =3D g_strdup_printf("-accel kvm,dirty-ring-size=3D4096 " "-name dirtylimit-test,debug-threads=3Don " "-m 150M -smp 1 " --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400186; cv=none; d=zohomail.com; s=zohoarc; b=WZiWQM/xAOHVsy2H4EpM3K2cMv1emQr6XgPmT3sf6+lva6lqR1TI8rOUm49UQAumeXeNFWNeehS9qXW8ON2ckYO4mP3cCc6ln6boCAkdk1cWzCj3vqIGnj64hbr8FD50X/Zlf/8vIlJYsUV6/DY/UfvqqBTgkoLpoJwbBQzR8BA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400186; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MmcLRgrHOXaQzZw9raGtmDm+zXG9T1TLit/qoCr/HQ4=; b=WB9zMxWaqLhray9md5Y2OJZDiTKyqgtmpY8fOOtfbhJlO2ABa73uogj50aIkTEXPVP9Fz2YdACTOlbo5oqMwMZqXfNIMFs9Vw7QH7U/xOnIMBloQ2OPu63MNY/2Q0mtwSg5D/Kcg1Sv/hIXLJwGoN5KNxEDHv3qPBwVtmuchAJA= 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 1687400186076178.07169610033282; Wed, 21 Jun 2023 19:16:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9r5-0000au-UR; Wed, 21 Jun 2023 22:15:28 -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 1qC9qO-000786-QX for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qN-00056h-5n for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14: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-333-27WyVnVsP2C82q_YIvbrBA-1; Wed, 21 Jun 2023 22:14:37 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D85C88CC41; Thu, 22 Jun 2023 02:14:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1583D1121330; Thu, 22 Jun 2023 02:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MmcLRgrHOXaQzZw9raGtmDm+zXG9T1TLit/qoCr/HQ4=; b=gqQd4vy7ThEP9ZR5cvCXlHCmz/3K4xs7Jyl/ySlufkhJLBWv9FXPZp3SrBAENk4CcZoWbp AZlAd+o7PkmorbtYhGtMSLWumO0HHMDbVfdBt8m3ZUkzPfUAElnHoTZBaGca+SZpNBWgYq g3GKvHN8WE77wp6efDq1wpisOhxfybk= X-MC-Unique: 27WyVnVsP2C82q_YIvbrBA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 19/30] migration-test: simplify shmem_opts handling Date: Thu, 22 Jun 2023 04:13:09 +0200 Message-Id: <20230622021320.66124-20-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400186501100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Message-ID: <20230608224943.3877-4-quintela@redhat.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index fbe9db23cf..e3e7d54216 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -704,9 +704,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "-object memory-backend-file,id=3Dmem0,size=3D%s" ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", memory_size, shmem_path); - } else { - shmem_path =3D NULL; - shmem_opts =3D g_strdup(""); } =20 if (args->use_dirty_ring) { @@ -722,7 +719,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, arch_opts ? arch_opts : "", arch_source ? arch_source : "", - shmem_opts, + shmem_opts ? shmem_opts : "", args->opts_source ? args->opts_source : "= ", ignore_stderr); if (!args->only_target) { @@ -742,7 +739,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, memory_size, tmpfs, uri, arch_opts ? arch_opts : "", arch_target ? arch_target : "", - shmem_opts, + shmem_opts ? shmem_opts : "", args->opts_target ? args->opts_target : "= ", ignore_stderr); *to =3D qtest_init(cmd_target); --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400199; cv=none; d=zohomail.com; s=zohoarc; b=Ik9ttvP8DSioqFLs4dAhq9GaTXezQN3n5iQTf2rxqf+xtUcFIu3Bp8CDFFONHXf2BEL+FovUo8ZyPX0krDNLCzUdsafRospCqI8IrHjBaZUFCNFVZdxCipLQ209Qb2oYWxfbTmN4w0hUmuQkNSTltpV06n++9EribkvOnAmRxtk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400199; 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=T7C6DC1DapyCX9W5saulxxxdvO2uy+jKpkgi4dJoCCU=; b=dn60sPbNbhkK12k4IlDn2d30WlziqaNQ3W4ub48H+LPpFVgqqiJjbVGn3r1Fv3m0O3zYhuSJnQZhrU/GxHd7vRblVARs4tirTCnWGd553I9ueMNJUsSBPjRuidZiGUiuULPqvXaCBjnBgZgHLdwX2Ds6scgRkQh+xrArsyEEe/k= 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 1687400199766383.8828106644397; Wed, 21 Jun 2023 19:16:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9ql-0008KP-DR; Wed, 21 Jun 2023 22:15:07 -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 1qC9qS-0007OV-8H for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:48 -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 1qC9qQ-00057X-8H for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:47 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-470-s4oIb_nrN_qUJ1_ftMfVFA-1; Wed, 21 Jun 2023 22:14:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96FE73C1014E; Thu, 22 Jun 2023 02:14:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 53ABA112132C; Thu, 22 Jun 2023 02:14:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400085; 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=T7C6DC1DapyCX9W5saulxxxdvO2uy+jKpkgi4dJoCCU=; b=BMDEab8Sycxgs/YmmamTYA/e3WnQRBKNxzNs4saEG3Kqp314xdC7810e8EEf7cQzGZzUMG no54JW0b8+51oLFNZErhKQR1sIV9N8O25aNaebB1FwsG/JYrQeJo6HEdGBRY56KIenTI7k VuUSxLvsvlbsyeibehncLiRFLHHQtns= X-MC-Unique: s4oIb_nrN_qUJ1_ftMfVFA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Tejus GK Subject: [PULL 20/30] migration: Update error description whenever migration fails Date: Thu, 22 Jun 2023 04:13:10 +0200 Message-Id: <20230622021320.66124-21-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400201320100001 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 Acked-by: Peter Xu Signed-off-by: Tejus GK Message-ID: <20230621130940.178659-2-tejus.gk@nutanix.com> Signed-off-by: Juan Quintela --- migration/migration.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 719f91573f..e6bff2e848 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1679,7 +1679,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool = blk, if (!(has_resume && resume)) { yank_unregister_instance(MIGRATION_YANK_INSTANCE); } - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "uri", + error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); @@ -2066,7 +2066,7 @@ migration_wait_main_channel(MigrationState *ms) * Switch from normal iteration to postcopy * Returns non-0 on error */ -static int postcopy_start(MigrationState *ms) +static int postcopy_start(MigrationState *ms, Error **errp) { int ret; QIOChannelBuffer *bioc; @@ -2176,7 +2176,7 @@ static int postcopy_start(MigrationState *ms) */ ret =3D qemu_file_get_error(ms->to_dst_file); if (ret) { - error_report("postcopy_start: Migration stream errored (pre packag= e)"); + error_setg(errp, "postcopy_start: Migration stream errored (pre pa= ckage)"); goto fail_closefb; } =20 @@ -2213,7 +2213,7 @@ static int postcopy_start(MigrationState *ms) =20 ret =3D qemu_file_get_error(ms->to_dst_file); if (ret) { - error_report("postcopy_start: Migration stream errored"); + error_setg(errp, "postcopy_start: Migration stream errored"); migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, MIGRATION_STATUS_FAILED); } @@ -2720,6 +2720,7 @@ typedef enum { static MigIterateState migration_iteration_run(MigrationState *s) { uint64_t must_precopy, can_postcopy; + Error *local_err =3D NULL; bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; =20 qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy); @@ -2742,8 +2743,9 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) /* Still a significant amount to transfer */ if (!in_postcopy && must_precopy <=3D s->threshold_size && qatomic_read(&s->start_postcopy)) { - if (postcopy_start(s)) { - error_report("%s: postcopy failed to start", __func__); + if (postcopy_start(s, &local_err)) { + migrate_set_error(s, local_err); + error_report_err(local_err); } return MIG_ITERATE_SKIP; } @@ -3234,8 +3236,10 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) */ if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s, !resume)) { - error_report("Unable to open return-path for postcopy"); + error_setg(&local_err, "Unable to open return-path for postcop= y"); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); + migrate_set_error(s, local_err); + error_report_err(local_err); migrate_fd_cleanup(s); return; } @@ -3259,6 +3263,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) } =20 if (multifd_save_setup(&local_err) !=3D 0) { + migrate_set_error(s, local_err); error_report_err(local_err); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400149; cv=none; d=zohomail.com; s=zohoarc; b=fcKHJQg5zFcQa2huaoJ3JYWlU7Psgpy0NShyRNJbj0LfRh89pMm8ASEmbn5Qzx7oHTXr/2qNt8TJcAyy3pfAhqmtenBVuBNmeeFiytVvlZb65/oYmsuXY8MF49R1NM0kASnswsI2+9m8v3S3cYdP6ZJq2USKLb7SNepkHt5Pg3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400149; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+awb8Ji3T505TOieoRQAmSUv6J3qZyUkjLapOert/H8=; b=dKlmPTSfMEDvA0+iI7yHG9voB7WHjYPpXeNq5YYPYCgBQAyuTuer87NPkTfFVwVa2RsZAwkyaPeSfqviP6hbBGy1NnH18SFLNI/nxTe6Fg2JVoJq0uo3uBTb/y8+Ozi3t9iot7Ge2bqqbOUDM4yBnFyR86o6w66+KtssFJSEd6k= 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 1687400149659533.5529628654315; Wed, 21 Jun 2023 19:15:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rB-0000zx-5L; Wed, 21 Jun 2023 22:15:33 -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 1qC9qS-0007RX-KF for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:48 -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 1qC9qQ-00057o-VI for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:48 -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-368-Cfuu3GcdO7ucc2wUqNPfvg-1; Wed, 21 Jun 2023 22:14:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65FB98C586A; Thu, 22 Jun 2023 02:14:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0E57112132E; Thu, 22 Jun 2023 02:14:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+awb8Ji3T505TOieoRQAmSUv6J3qZyUkjLapOert/H8=; b=cYALmv9hqSM1vlF96ZnDW9B7fKomd8gVEUmB3Irzqb1c4QfRdn8joUlvZkQV7/V5yEIIzy TuFYlPPOMrgvzSm5/3hy58jvzHA3P9EkiT42kaNSOtZUrXNzoJN/kku4awKONnDVXhbg+1 +nVWvyGZCz0ZfxTR/iIqasC63+nprao= X-MC-Unique: Cfuu3GcdO7ucc2wUqNPfvg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Tejus GK , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PULL 21/30] migration: Refactor repeated call of yank_unregister_instance Date: Thu, 22 Jun 2023 04:13:11 +0200 Message-Id: <20230622021320.66124-22-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400150987100004 From: Tejus GK In the function qmp_migrate(), yank_unregister_instance() gets called twice which isn't required. Hence, refactoring it so that it gets called during the local_error cleanup. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Juan Quintela Acked-by: Peter Xu Signed-off-by: Tejus GK Message-ID: <20230621130940.178659-3-tejus.gk@nutanix.com> Signed-off-by: Juan Quintela --- migration/migration.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index e6bff2e848..7a4ba2e846 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1676,15 +1676,11 @@ void qmp_migrate(const char *uri, bool has_blk, boo= l blk, } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); } else { - if (!(has_resume && resume)) { - yank_unregister_instance(MIGRATION_YANK_INSTANCE); - } error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, MIGRATION_STATUS_FAILED); block_cleanup_parameters(); - return; } =20 if (local_err) { --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400277; cv=none; d=zohomail.com; s=zohoarc; b=aSf3ArWZ8xZcXqTPIp5vN1yof2eeCg0z/d9GLTtSY/H6wqrJTIWuUfRI68T1Z5gO2F95BtHduLmZGN+RK9ze4iAnPxyMIhj8WqI5596vjGOinvCWyv1u1uDbew+savmlts/40jH8tfVgxQKqfqLZH2Rvnt/2I2G12LW+jbZ0o04= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400277; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0gMyyCvbpsUehX6Zf+T7AT27ZzZCy47tR02v1S53cos=; b=gffTdYw6ks6KiTvLZtZKsOXsknNBmWOc6EfuBB+EuPJDmOrOP6u8GYLlBk7UCqp1dHq2+NoNlB4leLmLyVFb6SyfwG+Pz2vU0vEbLGZCxrpW+Yl0Q9/DAod5hSjf1sInur05l62UjVj2KZYkL+qr6JVu/7bdjyPcoFpRXUI52P4= 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 1687400277550203.5624407549892; Wed, 21 Jun 2023 19:17:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rL-0001UN-BT; Wed, 21 Jun 2023 22:15:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qX-0007w7-E8 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qV-00059E-Id for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:52 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-64-ViSvQLdpNHWIu2TWEr5OwA-1; Wed, 21 Jun 2023 22:14:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E302C3800524; Thu, 22 Jun 2023 02:14:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF6E6112132E; Thu, 22 Jun 2023 02:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0gMyyCvbpsUehX6Zf+T7AT27ZzZCy47tR02v1S53cos=; b=iXd1+MEbBiTlA21N8IO+IpPTLplftzjr5SNdIVAqovIuSiXAOa/vO/jE1oPHGP6w3eEmPc kuD4aMI+8GuR0s0U+SN4JhjjxHWW/7H5D2tHVe47ZZficXQ3AuM315G3GGOSM/J1aqVSj1 l8tzpUIbbPHLYvV9bj5OW0HEQegq/P0= X-MC-Unique: ViSvQLdpNHWIu2TWEr5OwA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Wei Wang Subject: [PULL 22/30] migration: enforce multifd and postcopy preempt to be set before incoming Date: Thu, 22 Jun 2023 04:13:12 +0200 Message-Id: <20230622021320.66124-23-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400278701100010 Content-Type: text/plain; charset="utf-8" From: Wei Wang qemu_start_incoming_migration needs to check the number of multifd channels or postcopy ram channels to configure the backlog parameter (i.e. the maximum length to which the queue of pending connections for sockfd may grow) of listen(). So enforce the usage of postcopy-preempt and multifd as below: - need to use "-incoming defer" on the destination; and - set_capability and set_parameter need to be done before migrate_incoming Otherwise, disable the use of the features and report error messages to remind users to adjust the commands. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-ID: <20230606101910.20456-2-wei.w.wang@intel.com> Signed-off-by: Juan Quintela Acked-by: Juan Quintela --- migration/options.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/migration/options.c b/migration/options.c index ba1010e08b..c072c2fab7 100644 --- a/migration/options.c +++ b/migration/options.c @@ -433,6 +433,11 @@ INITIALIZE_MIGRATE_CAPS_SET(check_caps_background_snap= shot, MIGRATION_CAPABILITY_VALIDATE_UUID, MIGRATION_CAPABILITY_ZERO_COPY_SEND); =20 +static bool migrate_incoming_started(void) +{ + return !!migration_incoming_get_current()->transport_data; +} + /** * @migration_caps_check - check capability compatibility * @@ -556,6 +561,12 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Postcopy preempt not compatible with compres= s"); return false; } + + if (migrate_incoming_started()) { + error_setg(errp, + "Postcopy preempt must be set before incoming start= s"); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { @@ -563,6 +574,10 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) error_setg(errp, "Multifd is not compatible with compress"); return false; } + if (migrate_incoming_started()) { + error_setg(errp, "Multifd must be set before incoming starts"); + return false; + } } =20 if (new_caps[MIGRATION_CAPABILITY_DIRTY_LIMIT]) { --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400150; cv=none; d=zohomail.com; s=zohoarc; b=PwZjWiebiV+5uf7Yg6b02JoIV8lQm69VnKb3tVv6hfJ6kD2tAUmRLF5j2IfU6Ec8aMqPPQWScxVyzg8gJugC4dIF5MW5o2TF4G4aaBM0Sl19HxruWcIqr2SEUXfxwcUt+PpQNC5EbJDmi1+GmJeD8tqHGwRqTKjCDwFQe4dGVVQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400150; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v7DDKZ7/PjEB7antlRml4N9xhWEjy/6LhCVbjHExS7o=; b=chUhPdi20xQ+intuI0YQPePBrHMQ2Z0PFbReW6YMnreh/fBksZSrd1v3PlerfuOzGZLQIhjqWP/4uHCwMNBxFB2AlkSiQ0X5ZYyO9jsQ38HJZmgTU7H9JjoXu5H024I0URnRs8i9nsas/h+pseEgtGkVIthzjRubBualnQrc1V0= 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 1687400150418449.84956365813673; Wed, 21 Jun 2023 19:15:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9r8-0000ke-Uu; Wed, 21 Jun 2023 22:15:31 -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 1qC9qY-0007wt-4Y for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:54 -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 1qC9qV-00059V-VW for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-297-jmw-uZOoOrWktY0awzB-bQ-1; Wed, 21 Jun 2023 22:14:47 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5656D8C5868; Thu, 22 Jun 2023 02:14:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3864C112132E; Thu, 22 Jun 2023 02:14:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400091; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v7DDKZ7/PjEB7antlRml4N9xhWEjy/6LhCVbjHExS7o=; b=honUO+0rEFaPHOyzUkGlees8XCMaVT59xGWAgmLqaQKN9BIe6f4mhHITQnjwLv3HknEh9v 9wknqIR2tB6YyQ5O9fsuYFRsVN50JlkEiwEJls+UKT4a42AHuMBFoR74Ti1NsEUHyGOqV5 VN69ZyeGXbTPcun8/BTZrogThjlwh+w= X-MC-Unique: jmw-uZOoOrWktY0awzB-bQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Wei Wang Subject: [PULL 23/30] qtest/migration-tests.c: use "-incoming defer" for postcopy tests Date: Thu, 22 Jun 2023 04:13:13 +0200 Message-Id: <20230622021320.66124-24-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400152370100007 Content-Type: text/plain; charset="utf-8" From: Wei Wang The Postcopy preempt capability is expected to be set before incoming starts, so change the postcopy tests to start with deferred incoming and call migrate-incoming after the cap has been set. Why the existing tests (without this patch) didn't fail? There could be two reasons: 1) "backlog" specifies the number of pending connections. As long as the server accepts the connections faster than the clients side connecting, connection will succeed. For the preempt test, it uses only 2 channels, so very likely to not have pending connections. 2) per my tests (on kernel 6.2), the number of pending connections allowed is actually "backlog + 1", which is 2 in this case. That said, the implementation of socket_start_incoming_migration_internal expects "migrate defer" to be used, and for safety, change the test to work with the expected usage. Signed-off-by: Wei Wang Reviewed-by: Peter Xu Reviewed-by: Juan Quintela Message-ID: <20230606101910.20456-3-wei.w.wang@intel.com> Signed-off-by: Juan Quintela --- tests/qtest/migration-test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index e3e7d54216..c694685923 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1161,10 +1161,10 @@ static int migrate_postcopy_prepare(QTestState **fr= om_ptr, QTestState **to_ptr, MigrateCommon *args) { - g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + g_autofree char *uri =3D NULL; QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, &args->start)) { + if (test_migrate_start(&from, &to, "defer", &args->start)) { return -1; } =20 @@ -1183,9 +1183,13 @@ static int migrate_postcopy_prepare(QTestState **fro= m_ptr, =20 migrate_ensure_non_converge(from); =20 + qtest_qmp_assert_success(to, "{ 'execute': 'migrate-incoming'," + " 'arguments': { 'uri': 'tcp:127.0.0.1:0' }}= "); + /* Wait for the first serial output from the source */ wait_for_serial("src_serial"); =20 + uri =3D migrate_get_socket_address(to, "socket-address"); migrate_qmp(from, uri, "{}"); =20 wait_for_migration_pass(from); --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400153; cv=none; d=zohomail.com; s=zohoarc; b=bv4CeBEU9lx5ES9PDYqf8Mw9IxPk+NyEqNieiA1EZFonHG+9C9Wh3Xbb/dihMfKyVq9aoo1EWjvdvdk7VAed30yhDzNVuJBhkQHkO+ohkqnsHUP6vdw7zurhT4QTXOgEtRkgKGjC37QC2TH6KM16+LTX1XmEhinNmald66hSUm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400153; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=hNhr+lvk0UfSlnFL6IyrepvjcA76XDl1n6kDTflTNL8=; b=AFRzkh156D+6sIBx3ZR6kp9HWnqDc/9huiBm7NE6sP79Qi1ZoVxwv0UFFojJud/htszJ92crsEVtvhn62XHmf30gHGx1oEYxBwMEnP1MKdLwjFthf/SqHzXe7O/WgvosIvzBd5sMH66WPo2b6NB0+dLaXx7bc+Od8uwN+DkEUjo= 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 1687400153363415.75024294932643; Wed, 21 Jun 2023 19:15:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9qr-00009v-Gq; Wed, 21 Jun 2023 22:15:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qa-00085k-Db for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qY-0005AS-IJ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:14:56 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-zcc6l4SEOZWicuKz1_XkWQ-1; Wed, 21 Jun 2023 22:14:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BA2253C1014E; Thu, 22 Jun 2023 02:14:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F00F112132C; Thu, 22 Jun 2023 02:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400094; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hNhr+lvk0UfSlnFL6IyrepvjcA76XDl1n6kDTflTNL8=; b=YXQj1ZEzpoR9e+ig/Uc+Qgvi0zth4+vOOTl47Uwc+tFZJt5Otu/ygtnP0gY+bAMzMjMfIc adGw/gzr4Vn/7btdtKs1dVAmZbtLAo7JijgLwuYOLcFBJsI0G/cAwOyVIyo1JJ7VZdcAX+ pr1u3cwuiQ4nzhTOszww420gy11IUco= X-MC-Unique: zcc6l4SEOZWicuKz1_XkWQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 24/30] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Thu, 22 Jun 2023 04:13:14 +0200 Message-Id: <20230622021320.66124-25-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400154287100009 Fast don't say much. Noflush indicates more clearly that it is like qemu_file_transferred but without the flush. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20230530183941.7223-2-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 11 +++++------ migration/qemu-file.c | 2 +- migration/savevm.c | 4 ++-- migration/vmstate.c | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index e649718492..aa6eee66da 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -86,16 +86,15 @@ int qemu_fclose(QEMUFile *f); uint64_t qemu_file_transferred(QEMUFile *f); =20 /* - * qemu_file_transferred_fast: + * qemu_file_transferred_noflush: * - * As qemu_file_transferred except for writable - * files, where no flush is performed and the reported - * amount will include the size of any queued buffers, - * on top of the amount actually transferred. + * As qemu_file_transferred except for writable files, where no flush + * is performed and the reported amount will include the size of any + * queued buffers, on top of the amount actually transferred. * * Returns: the total bytes transferred and queued */ -uint64_t qemu_file_transferred_fast(QEMUFile *f); +uint64_t qemu_file_transferred_noflush(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/qemu-file.c b/migration/qemu-file.c index acc282654a..fdf115b5da 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -694,7 +694,7 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -uint64_t qemu_file_transferred_fast(QEMUFile *f) +uint64_t qemu_file_transferred_noflush(QEMUFile *f) { uint64_t ret =3D f->total_transferred; int i; diff --git a/migration/savevm.c b/migration/savevm.c index bc284087f9..f26b455764 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,9 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *se) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - uint64_t old_offset =3D qemu_file_transferred_fast(f); + uint64_t old_offset =3D qemu_file_transferred_noflush(f); se->ops->save_state(f, se->opaque); - uint64_t size =3D qemu_file_transferred_fast(f) - old_offset; + uint64_t size =3D qemu_file_transferred_noflush(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); diff --git a/migration/vmstate.c b/migration/vmstate.c index af01d54b6f..31842c3afb 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -361,7 +361,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, void *curr_elem =3D first_elem + size * i; =20 vmsd_desc_field_start(vmsd, vmdesc_loop, field, i, n_elems= ); - old_offset =3D qemu_file_transferred_fast(f); + old_offset =3D qemu_file_transferred_noflush(f); if (field->flags & VMS_ARRAY_OF_POINTER) { assert(curr_elem); curr_elem =3D *(void **)curr_elem; @@ -391,7 +391,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, return ret; } =20 - written_bytes =3D qemu_file_transferred_fast(f) - old_offs= et; + written_bytes =3D qemu_file_transferred_noflush(f) - old_o= ffset; vmsd_desc_field_end(vmsd, vmdesc_loop, field, written_byte= s, i); =20 /* Compressed arrays only care about the first element */ --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400275; cv=none; d=zohomail.com; s=zohoarc; b=jY7HeSpDjke6V3azbDOniOvgiWIE7MBBpohXrc7NrHaAtHtX8peDDzkBThwNfrs5N2lcjwmlD5IfIimylKyTDg3/a7Nb0zZ+iAb9LNT4spgYOYV5pnsxpPTh+UaffvXVN3lZZjnuDk7yAaHjN8MsFmhyvSUcILG5ebQzEQ2Xe3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400275; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SGM9oDrMA/Qp+v4phUutbR6uhjgyVuEbgqQHcYuNgHY=; b=T7nIL9qLJBHyM+4AqXbQRkAWJdcQ0tQ8QxXa+55rrE/92QdGYwnoejf3ZxSU4zv9Pp9ryoLhsXrEBXKIKDWgjwynLMW1AWha38yAPyF7R07agVVahXzkqJdlu192NFkzOIrfrPTmKlCIukrYqw9Qd8X/SBWnP0vBmAmCSNZEnv0= 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 1687400275133377.7558274759152; Wed, 21 Jun 2023 19:17:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9r9-0000mT-5E; Wed, 21 Jun 2023 22:15:31 -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 1qC9qf-0008BQ-U4 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:03 -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 1qC9qd-0005Cg-Pu for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-131-Kk5Hplx-OaWuFTkuwfQ8_Q-1; Wed, 21 Jun 2023 22:14:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 316C63C025AD; Thu, 22 Jun 2023 02:14:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17263112132C; Thu, 22 Jun 2023 02:14:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SGM9oDrMA/Qp+v4phUutbR6uhjgyVuEbgqQHcYuNgHY=; b=dHwHkGw783MaNWOfRz5C/onGT23pP+4Vf1q/tl5Mqh8CDZ+ijk9ZcaD9unwo1p7SqOPMAR rZBvbdj7YtW3W1O3oqxJsmoT0fJtpqLX4s56wgzg37VJAsmS2tRHsb67rom0CAW/p1AErF LABb7GgMc386UVVtv2qZoDTI7jFSH3I= X-MC-Unique: Kk5Hplx-OaWuFTkuwfQ8_Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 25/30] migration: Change qemu_file_transferred to noflush Date: Thu, 22 Jun 2023 04:13:15 +0200 Message-Id: <20230622021320.66124-26-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-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.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400276819100007 We do a qemu_fclose() just after that, that also does a qemu_fflush(), so remove one qemu_fflush(). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20230530183941.7223-3-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/savevm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/savevm.c b/migration/savevm.c index f26b455764..b2199d1039 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2952,7 +2952,7 @@ bool save_snapshot(const char *name, bool overwrite, = const char *vmstate, goto the_end; } ret =3D qemu_savevm_state(f, errp); - vm_state_size =3D qemu_file_transferred(f); + vm_state_size =3D qemu_file_transferred_noflush(f); ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400247; cv=none; d=zohomail.com; s=zohoarc; b=gtpfcFOqf9VfCCDS0z7LLIkzeJOOuzWmXrTq0X1mLh5zo/vzy9XiEndAuGSNqxGzEWi+FSAHWa0KYSlnltGoCzLyxR/qwMBpjvT+ohq9RNJzyCfmX6aVjvwd/aqdIe3dztLQqmdkYH7jA8WTB267GJhcvbdrOWmyMPBJ46SO9aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400247; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZbmZd/0GUxBNkX2GKrDTd/Dukt5lTkWbqA7HJxboR+k=; b=cLlEBCh4+U3qjAWeLTnXx9Rj7RiqVgv16DDNxqOsv7WFuNEMEPCsM7/v2KRG6KddWS1l7o76AkMZVUsRL+fdU/+PCMeDEA8OJ0aL5njfJ2X/fS5IrULvrQEeuksfsCzFe/PDlfBtQ2sBMgFq1jY9JKnYXYLE/07aVGf/iXgfHmw= 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 1687400247571775.7938104025783; Wed, 21 Jun 2023 19:17:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rN-0001tr-Sv; Wed, 21 Jun 2023 22: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 1qC9qf-0008BR-UB for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:03 -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 1qC9qd-0005CU-Fu for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-434-bhtVvbNLPWWET1mXmwNFFw-1; Wed, 21 Jun 2023 22:14:55 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 983B73C10145; Thu, 22 Jun 2023 02:14:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C424112132C; Thu, 22 Jun 2023 02:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZbmZd/0GUxBNkX2GKrDTd/Dukt5lTkWbqA7HJxboR+k=; b=SW5TzrPnl/LThpv+IWTqscj1UoOuL5daygmJzjI1j0m5zudA6ZTja1KWkzqsn8ylNqtqiN TPFRlfleluUMZavUZzFVpBM4d+rKmFx8TK3rcBIxJlC5Z431sma7uJJpPAJsZ9u6oS7/ZB C4UU1AThn92U/BT4p1d+nlalRSMLyTo= X-MC-Unique: bhtVvbNLPWWET1mXmwNFFw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier , Fabiano Rosas Subject: [PULL 26/30] migration: Use qemu_file_transferred_noflush() for block migration. Date: Thu, 22 Jun 2023 04:13:16 +0200 Message-Id: <20230622021320.66124-27-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400248733100001 Content-Type: text/plain; charset="utf-8" We only care about the amount of bytes transferred. Flushing is done by the system somewhere else. Reviewed-by: Fabiano Rosas Signed-off-by: Juan Quintela Message-ID: <20230530183941.7223-4-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/migration/block.c b/migration/block.c index b9580a6c7e..b29e80bdc4 100644 --- a/migration/block.c +++ b/migration/block.c @@ -748,7 +748,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - uint64_t last_bytes =3D qemu_file_transferred(f); + uint64_t last_bytes =3D qemu_file_transferred_noflush(f); =20 trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -800,7 +800,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); - uint64_t delta_bytes =3D qemu_file_transferred(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_transferred_noflush(f) - last_bytes; return (delta_bytes > 0); } =20 --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400169; cv=none; d=zohomail.com; s=zohoarc; b=BOJSHM2J31lxqoPcjwsVUwkq8LNlEbrzVmslAQIzpZ3jgFovL8dDpOdDxIZ+NKPhsaGBG13xUm4rH7/9nAtJ3uYwFuafITNlEHz2mQaOKRbHgkj21eaURIKDjLZydtlCQqnvBoxPtZKjt7sKU3IBfGb7B6xaAsFA8CwYchp4+IE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400169; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=lxcZDT75JfMiZ7jNieV0K3/VHQQZjUWYPnzN6yxyDfOvslBmdlGEt80cuo4Ror53VFbNKVhQuhkHI4PqoQuWKpDHhONPE1sXnhjWTKpHPLiy6YzmhY/UCTFd3G9oA1LiwthXrFpxeyowI05zaBPIzNo2fWc75A5mBmhb/W2nELA= 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 1687400169495533.0430709185572; Wed, 21 Jun 2023 19:16:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rI-0001Ie-HU; Wed, 21 Jun 2023 22:15:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qi-0008F1-4C for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15: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 1qC9qg-0005Db-C9 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:03 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-329-_EC7QLSCMriej7bShKFPSA-1; Wed, 21 Jun 2023 22:14:57 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09F3528237D1; Thu, 22 Jun 2023 02:14:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0EBD112132C; Thu, 22 Jun 2023 02:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qoJqflG6p06UiyjXcBrP7XYz4oV4OR7b3C3zEc3gpTE=; b=SqfLirJgEuiQU+fLWlGKRgUhZTHPbkBdW5hiZINrlSr8fAfgTh7MCaMUxHhG4fw4MHehzG DBdPwnysT/daStJoXFnJ0AhLrMQwvpDoKjfaFikbbJYItCWk7Hut/9xStoo91fpr4krEoZ hH3OUBwsx7Saz/CbmkzxfBk/9I6DVpg= X-MC-Unique: _EC7QLSCMriej7bShKFPSA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 27/30] qemu_file: Make qemu_file_is_writable() static Date: Thu, 22 Jun 2023 04:13:17 +0200 Message-Id: <20230622021320.66124-28-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400170429100002 Content-Type: text/plain; charset="utf-8" It is not used outside of qemu_file, and it shouldn't. Signed-off-by: Juan Quintela Message-ID: <20230530183941.7223-19-quintela@redhat.com> Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/qemu-file.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index aa6eee66da..a081ef6c3f 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -103,7 +103,6 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f); void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, bool may_free); bool qemu_file_mode_is_not_valid(const char *mode); -bool qemu_file_is_writable(QEMUFile *f); =20 #include "migration/qemu-file-types.h" =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index fdf115b5da..9a89e17924 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -228,7 +228,7 @@ void qemu_file_set_error(QEMUFile *f, int ret) qemu_file_set_error_obj(f, ret, NULL); } =20 -bool qemu_file_is_writable(QEMUFile *f) +static bool qemu_file_is_writable(QEMUFile *f) { return f->is_writable; } --=20 2.40.1 From nobody Sat May 18 13:36:57 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=1687400256; cv=none; d=zohomail.com; s=zohoarc; b=d8EN/CQN4w62p2BBCV/Cs0++13ba7X34cdaHk4KpstAqUKbMjDZ/C8ZzY101F3FXZ+Vov2TN4hulEvfa/tewcoC4l+Lxp/9YVChfXjBqBphavvRG/txQL9Ahbf4lrWHJ2n0o++aQb8nFM9N9gaBz6VCaW7thOOrrLec9mau/i8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400256; 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=QjNYQXC70u+X2QpF4D3EpRgllVgRhL+4eD4eOFptpnI21dSMz1h255GiEinTZwbTmZYwNMDSjj/74hw/okWD0JV9MSlKlRDyYxNkr0Yjk7H7qamVrHy79xdyz2BpArsVQUX1gOd5sCXuOL/5AYUrfok+L+73/VRRhBRt0ytHMxs= 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 1687400256766450.83784577826145; Wed, 21 Jun 2023 19:17:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rM-0001eU-Bo; Wed, 21 Jun 2023 22: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 1qC9qi-0008Fq-8x for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9qg-0005Dt-Fk for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15: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-520-yXEJPV0wOpiF6r6T06BDXw-1; Wed, 21 Jun 2023 22:14:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 496F285A58A; Thu, 22 Jun 2023 02:14:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52404112132C; Thu, 22 Jun 2023 02:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400101; 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=d8EUDnla4YOS/2/BAKn7pFZIK4ZzEInxqUtMmUQzK1OEhBA8H3idPthtoubqNnKWHYsBzB kBte6n7VQTk3imH+9BucD81euuEfs+HlvAj2bsU0SGwJyOyJrTLipkGkbs81T/+BV6jVG8 vytFM/osZ4FhClt8Gb4jTsDXJAAd6EM= X-MC-Unique: yXEJPV0wOpiF6r6T06BDXw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 28/30] qemu-file: Simplify qemu_file_shutdown() Date: Thu, 22 Jun 2023 04:13:18 +0200 Message-Id: <20230622021320.66124-29-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400258773100011 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 Sat May 18 13:36:57 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=1687400279; cv=none; d=zohomail.com; s=zohoarc; b=hNLp6BrgWdbMD6wDWE7OgP7OVUAY+M6PPe4Z4n1s8IucwnSsfp/+4AhT1Lgn5wT3F/jLPtZffSWAS30El/2LGgddQ0ejd7cEeFgJDLkAwNWzCQx0YGABHB71Ehcpo28d/EmusAxCfjB3FiPsS1jyYyk8Tpm+sfN0//OUDuPrQV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400279; 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=nb7dFMviLEMpIAsVilvrt96jyiKUpIwqh8j3My4Jcrhf9ZbY873Id6080XkkEBtwCfKGzh7b88eh1yTh9FcA7mvJ6qYHF/8ksFqilDlfkOQRg42fW29ycq8JvK3k3zoaEx/dNw3nev1Q6xZBRVNJdyxMj/lgdKk5O00og8COQoA= 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 1687400279171214.01750728705326; Wed, 21 Jun 2023 19:17:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rO-0001ug-06; Wed, 21 Jun 2023 22:15:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qC9ql-0008MF-FX for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:08 -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 1qC9qj-0005Eu-IX for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-173-hFHSjvcyNLS11vOSDHQ3yQ-1; Wed, 21 Jun 2023 22:15:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 156A33806720; Thu, 22 Jun 2023 02:15:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91EAB112132C; Thu, 22 Jun 2023 02:14:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400104; 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=EFdf3p0hwElly4fIsRAdx6p4lg5j9Qwdms3SPTmjtmSjt1Lou75JMhFB9JoFuLaQJlIYcG eHMCbjPDC0g9oxErxu3N1i9vzPpXC0ZoVXfKlxd6tPfwaaIxcokke9tDgEOOwWDz5Oi8Fy s28lABZVmn+SCR7fz8r94F0XeV13bb8= X-MC-Unique: hFHSjvcyNLS11vOSDHQ3yQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 29/30] qemu-file: Make qemu_file_get_error_obj() static Date: Thu, 22 Jun 2023 04:13:19 +0200 Message-Id: <20230622021320.66124-30-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400280813100015 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 Sat May 18 13:36:57 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=1687400215; cv=none; d=zohomail.com; s=zohoarc; b=GqUa9UsI2zJYrXfG8HflOujtGv6wL4IHYSfqKgjopfuSY7IzCzqpPSAYTL4gFsemdCVgKd1jWXS2RMdmD2W8zxSwPW8U1cTXhEu8XBQIe6+Pmkdow1v45aGj1s6dBBaW46aNEAsq0a0XhloFaL9nx4DyDmeYGWE1Ico7z8piAb8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1687400215; 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=IWXAfev7URzu7YlcRF6HTGq6akftkh83ZHbWhQl/cE4UmfhY2XQDrPENKtFzdca5QF22Vy4mu7eNHePVDtLuMseilpzNEFJwiUVo0QBZJwCRYydzAw8ZRVY92wOGuEK6NNZudw44kkaAbMvWXz/NJu1DWs7uUxBTJXm8x5Mgyxg= 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 1687400215558832.5277886242195; Wed, 21 Jun 2023 19:16:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qC9rP-00028A-QC; Wed, 21 Jun 2023 22: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 1qC9qr-0000GA-2x for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:13 -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 1qC9qn-0005Fj-UV for qemu-devel@nongnu.org; Wed, 21 Jun 2023 22:15:11 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-634-FV47GfIbMFav2-_C0merOg-1; Wed, 21 Jun 2023 22:15:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5256229AA3BA; Thu, 22 Jun 2023 02:15:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B5AA112132C; Thu, 22 Jun 2023 02:15:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687400109; 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=iKiJwPUQMGFcWpU+vMHZjNm/KsVJAhJcvxnFL5quo/5elFrl6JyzpqEixPtsGdPhNrcQbp wgs4UScK7xiLxzAj5IHSyAW7YtP9SHBLvfnm+6HUF2T7bUgzILVK8ozvGHDrgWwQXiMoi9 n/THTxo354IFp/zQ8vX+LehNWdrlD1M= X-MC-Unique: FV47GfIbMFav2-_C0merOg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Thomas Huth , Juan Quintela , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, Eric Blake , Stefan Hajnoczi , Fam Zheng , Laurent Vivier Subject: [PULL 30/30] migration/rdma: Split qemu_fopen_rdma() into input/output functions Date: Thu, 22 Jun 2023 04:13:20 +0200 Message-Id: <20230622021320.66124-31-quintela@redhat.com> In-Reply-To: <20230622021320.66124-1-quintela@redhat.com> References: <20230622021320.66124-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1687400216619100003 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