From nobody Fri May 17 11:59:09 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=1685472047; cv=none; d=zohomail.com; s=zohoarc; b=FghknTVtAoUHZ0lLlIf55Esz5HNelhsfwdlFSKaaZT0koI1smB3ZI/h0wanyE7dmB2lMQpuML/aWHS3hoDJk9AKmtKf2DJTHOXGqSanDI6WuE1XqA1NRNU8o7BkBK6vj8+7iflxKaVBKvlFwYShMheBg0XRWHBhar0RBZ8SvBW0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472047; 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=XEFt3snc/xjtvmBASOp0p2s2N9aBKm7nT1xbidgCows=; b=Zgo8mHmNOPBiTFmjxE33u10jmpfkt5An6VS/Nd45jlcpdpyS4uSccD14FLoDebxteMDh9B1OVrO0SlVpNIz+X8Jl1YWLZHnOfOgy31MOT7/A+PzJ9X711oGRaf+OM2owpjma70+VhAjLZAqNa5NYkyHxt6RMwEeI995u5G+ta+4= 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 1685472047850567.5088782842453; Tue, 30 May 2023 11:40:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GF-0000Qj-Gr; Tue, 30 May 2023 14:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GD-0000Nq-Ee for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GB-00048F-Gy for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:57 -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-502-DefJ96TkN26E2nZRFtpRaA-1; Tue, 30 May 2023 14:39:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21CD62A5957F; Tue, 30 May 2023 18:39:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE79DC154D1; Tue, 30 May 2023 18:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685471994; 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=XEFt3snc/xjtvmBASOp0p2s2N9aBKm7nT1xbidgCows=; b=L0wM77ydUr1cBdttnhRhCp68DlwxnGjSbFhxQRNgV0ZmI0sohhsF42gUrBsJFRuG88Qk9R ZxziI2O7x3zJ0wmhEVEvjqiwBcdlQrIhDjqTI5FKXCawiUjqL7j83B0NKMlQI3JHQTPijI XFI2k/oKipNcTJLjmQmDjTrJqVT4qEM= X-MC-Unique: DefJ96TkN26E2nZRFtpRaA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 01/20] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Tue, 30 May 2023 20:39:22 +0200 Message-Id: <20230530183941.7223-2-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472050011100015 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 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 83b8fb10de..21c3f34b84 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -52,16 +52,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 c94b667726..7a5c1a5e32 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -627,7 +627,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 Fri May 17 11:59:09 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=1685472047; cv=none; d=zohomail.com; s=zohoarc; b=QHd6R05ZPQbvMtE7rtN4i4MW3Hf1VsQgW3Pba5jnH8cJQgJBZqr5Z5aP9d+8AJcMRS+ZNCOno5IyVrNUjjZeGY4UO5UvHi6EbgJsr8S0YR5zSbfwXnYijn9ax3ZSrnjtU1g6XTdM2rQLBvStyirQh8WbJMxCsDXdPPD+CoX5aSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472047; 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=2ejhPQqES8jYTJTgHSfVfZuOoxCcUX2CyhYFytvVwPg=; b=b3v2pVkFWZn2xl4qJvkjh67HTpiBT32hPMLYsmL/rlm3LFY8RF7y77dw0eJA9czmZcS5Gpzvro/te48owcfaMdpEBsH6d18ZPlcLQTz1zi1Szg/o3EQ8bALyZnoxfmg1e4lEs5tEUr2eVKKTBawHPDQ81rAjzlbXNG7WyXv6/VQ= 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 168547204776415.15623163712894; Tue, 30 May 2023 11:40:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GF-0000Qg-6C; Tue, 30 May 2023 14:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GD-0000NX-87 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GA-000482-RD for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:57 -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-400-Zjizk832O7q-hAPc0Qt3Uw-1; Tue, 30 May 2023 14:39:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 239A8101A531; Tue, 30 May 2023 18:39:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A7AAC154D1; Tue, 30 May 2023 18:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685471994; 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=2ejhPQqES8jYTJTgHSfVfZuOoxCcUX2CyhYFytvVwPg=; b=B+dtc+VVAuejtedyUOHlxmssizNUFA7iXYvLN76YuiEsUkta14d6oOQ2dr8vvPUHMMjUZC kDIcul5pcIBnrIwaTSIF2cBZ1O0HjndqF3YmUTUYE3oJetgoaVWkn9QTb4tAtDDSpgC/NP X+hkzglQm38pbBD08m5AXWj0JFjHmrA= X-MC-Unique: Zjizk832O7q-hAPc0Qt3Uw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 02/20] migration: Change qemu_file_transferred to noflush Date: Tue, 30 May 2023 20:39:23 +0200 Message-Id: <20230530183941.7223-3-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472048437100001 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 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 Fri May 17 11:59:09 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=1685472209; cv=none; d=zohomail.com; s=zohoarc; b=RT0ot2LL0X6kohkF7dWG4+9BB4DHpufgWA4YEnNsCcZO9TaHtGi6p6gmctqQmK1vo1t6H+zO1APq9X1IcaX7vdYRwUmagiNF+2TX2ZhLTwxTfjc6J7R8Q193WMOOeTrpHuz9CFMF1c8X2YIxeLybAGgq764CnV4kGVoeeZNY5EY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472209; 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=wOlR0IeMVh9U6cyepoqPrMsmDK7fCeztkmWqq2XWTDE=; b=cf6ZCysjIO1Xs+MFf1g12mgLOHBABHrMuJC9297CD0o2CWp8uoUlbtGCfv+S8WN5Q86fgbMH72EIoozoS8zcle1wO7pW//YmT0B0ouEacIYtJXeWxBg1/CApiWINRS8LQIAVWhWHEk6lE1c3CRcKcxGmxzu/0mLyMjuR142rpbw= 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 1685472209129547.885105685965; Tue, 30 May 2023 11:43:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GD-0000O0-Ke; Tue, 30 May 2023 14:39: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 1q44GB-0000NA-WF for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GA-00047x-Hm for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:55 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-628-r75I5N3LPBuaawqWfpZuBQ-1; Tue, 30 May 2023 14:39:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 228FA29AA386; Tue, 30 May 2023 18:39:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A374C154D1; Tue, 30 May 2023 18:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685471993; 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=wOlR0IeMVh9U6cyepoqPrMsmDK7fCeztkmWqq2XWTDE=; b=aE23hvkwauuXYUGZSGHI5x9QcNp8bHGMhECBX1Cy5Tn17h88yRZDXg3eluZXVZMGwEP4uB HhPIYLms6ID+iYBA39iefeMwHiohasQcS2Z7LRM9oinNG0XebQBg7Kv51H9BvPm56AHdbn E43X6Nx2P793dwb12eFCxTy4sFFaJuc= X-MC-Unique: r75I5N3LPBuaawqWfpZuBQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , Fabiano Rosas Subject: [PATCH v2 03/20] migration: Use qemu_file_transferred_noflush() for block migration. Date: Tue, 30 May 2023 20:39:24 +0200 Message-Id: <20230530183941.7223-4-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472210994100003 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 --- 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 Fri May 17 11:59:09 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=1685472257; cv=none; d=zohomail.com; s=zohoarc; b=bg0ot5kXaZL56Ck2tHXcUsFQtKlbz5T9NSSt7XDIePdiRFZD1LnBVj6rKkv0GSdyv1CpFDxt4YRHkzjc1H2lYeGs/fyBef81dQgfMdslulDVcYXzzVuaXqaZSTNFtxMzVgmMDOA8CjWH1Tj7xyesxtrGTrZdbM9ygWOM47u2ojk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472257; 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=1YwXG5f3ncM0Xjakg0KJOZwETAUNV4nQ2cRcIhH4H40=; b=Kfwpjg95zfp/zTFlLQ3cvjNsiUGAh18hyw/ipqNwhSQ8aFM1R2250E/Uk83O9KZKzBYoIaFtQpKViR3MaLH/hGUntXFRM0EeTRIJr2SnA2w59J3Rqg2fanXTPrs2rbIYp0t8b1pmXuZG7ilrt8KwPq1Lv8ueNq0XDkBdlppxnNo= 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 1685472257437138.71983056786667; Tue, 30 May 2023 11:44:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GI-0000Te-7B; Tue, 30 May 2023 14:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GG-0000S7-59 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GD-00048r-QL for qemu-devel@nongnu.org; Tue, 30 May 2023 14:39:59 -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-517-zz3q8jZyPWiVSY2cKzSYgg-1; Tue, 30 May 2023 14:39:53 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01FE929AA386; Tue, 30 May 2023 18:39:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69404C154D1; Tue, 30 May 2023 18:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685471996; 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=1YwXG5f3ncM0Xjakg0KJOZwETAUNV4nQ2cRcIhH4H40=; b=i+adfJ8j1WV3mWlJkacf31hICis/j2JTlTXx6U63+hrVnus3Ko+yQCSefNNBVWL2RvR2Je fOsgRAMa4Bek/u/nZTOuAbS5ql6S/gkWNF0SbQmBhWDLpT0TB9lPALTfZ78FBDWNW6mEBl hlbWwEtz3usIBe2PH2vpWPmc9PxZb6I= X-MC-Unique: zz3q8jZyPWiVSY2cKzSYgg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 04/20] qemu-file: We only call qemu_file_transferred_* on the sending side Date: Tue, 30 May 2023 20:39:25 +0200 Message-Id: <20230530183941.7223-5-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472259578100003 Content-Type: text/plain; charset="utf-8" Remove the increase in qemu_file_fill_buffer() and add asserts to qemu_file_transferred* functions. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7a5c1a5e32..be3dab85cb 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -342,7 +342,6 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMU= File *f) =20 if (len > 0) { f->buf_size +=3D len; - f->total_transferred +=3D len; } else if (len =3D=3D 0) { qemu_file_set_error_obj(f, -EIO, local_error); } else { @@ -632,6 +631,8 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f) uint64_t ret =3D f->total_transferred; int i; =20 + g_assert(qemu_file_is_writable(f)); + for (i =3D 0; i < f->iovcnt; i++) { ret +=3D f->iov[i].iov_len; } @@ -641,6 +642,7 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f) =20 uint64_t qemu_file_transferred(QEMUFile *f) { + g_assert(qemu_file_is_writable(f)); qemu_fflush(f); return f->total_transferred; } --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472067; cv=none; d=zohomail.com; s=zohoarc; b=Uj9Kfi7hVUD6UprZGmk1vmWHXT6fkHd7Cuz9wEp40gbYGgc4Olpx4HPaIxYabO+OwO67EBQ/85DCRqTuneueNs75JrOlleoNg5zVrLKKghHdDGpNSDO+tUGHuTlR66B04cqOzTf98I34SnIe2YsyUtjlTOHUvDBHU9l40mRB7eY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472067; 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=/QGj8+f6K+aX6tT8r5VHQLGrwMiIpRZ389/546zCMoY=; b=eb4du6awzvVinitSkuvBI3/QvHCAyvCdvhYWdd7nMjlMSYqzWVpIxdprqkv/7eg5+goojgXGB0zOXIquqHLP2tBFZTCqMUbMTnEss2Xbuu7okh/Uk1EDPDnN2Pbu1mDule6+ZmzyQOr9Dw2C2NYEWnCOm38noFIxVelxvON+oek= 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 168547206758680.00994695986185; Tue, 30 May 2023 11:41:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GJ-0000V0-Nm; Tue, 30 May 2023 14:40:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GH-0000TP-WF for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:02 -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 1q44GG-00049j-Em for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:01 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-QUflfwupO2W0HWpGe--9xA-1; Tue, 30 May 2023 14:39:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D3FD7185A78B; Tue, 30 May 2023 18:39:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AB14C154D1; Tue, 30 May 2023 18:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685471999; 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=/QGj8+f6K+aX6tT8r5VHQLGrwMiIpRZ389/546zCMoY=; b=KdT8P0SFB7uIbMQP0OGq08sYWfaKUJvrUSSL0EjNnjEcES2RvWWjfpUmOQzXO75kTxFm/t TYgaSmADwbPq7iujT9i5DLQCKXZn/I1BpAIjJPwqvc66GfC2Ipe+xqBCot4UfIyejmbSUE IJdAqVw8d7cknOgCyaublW9P9nPezYs= X-MC-Unique: QUflfwupO2W0HWpGe--9xA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 05/20] qemu_file: Use a stat64 for qemu_file_transferred Date: Tue, 30 May 2023 20:39:26 +0200 Message-Id: <20230530183941.7223-6-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472068242100001 Content-Type: text/plain; charset="utf-8" This way we can read it from any thread. I checked that it gives the same value than the current one. We never use to qemu_files at the same time. Signed-off-by: Juan Quintela --- migration/migration-stats.h | 4 ++++ migration/qemu-file.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/migration/migration-stats.h b/migration/migration-stats.h index 2358caad63..b7795e7914 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -81,6 +81,10 @@ typedef struct { * Number of bytes sent during precopy stage. */ Stat64 precopy_bytes; + /* + * Number of bytes transferred with QEMUFile. + */ + Stat64 qemu_file_transferred; /* * Amount of transferred data at the start of current cycle. */ diff --git a/migration/qemu-file.c b/migration/qemu-file.c index be3dab85cb..eb0497e532 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -288,6 +288,7 @@ void qemu_fflush(QEMUFile *f) } else { uint64_t size =3D iov_size(f->iov, f->iovcnt); f->total_transferred +=3D size; + stat64_add(&mig_stats.qemu_file_transferred, size); } =20 qemu_iovec_release_ram(f); @@ -628,7 +629,7 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) =20 uint64_t qemu_file_transferred_noflush(QEMUFile *f) { - uint64_t ret =3D f->total_transferred; + uint64_t ret =3D stat64_get(&mig_stats.qemu_file_transferred); int i; =20 g_assert(qemu_file_is_writable(f)); @@ -644,7 +645,7 @@ uint64_t qemu_file_transferred(QEMUFile *f) { g_assert(qemu_file_is_writable(f)); qemu_fflush(f); - return f->total_transferred; + return stat64_get(&mig_stats.qemu_file_transferred); } =20 void qemu_put_be16(QEMUFile *f, unsigned int v) --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472237; cv=none; d=zohomail.com; s=zohoarc; b=f2urtpM74rs+20WfYGzmJknm+t+utE7zFv65ZUlEKjKEsSSrKiNND9wgQad/G0XXzff9AHaGPghDwFm4vlanUxmvB6KG8oJ4DKEoWLIGYV/cY7+crRU7PdOQyjrzvrNaKGhs4XIA692rRvVMg4l/gS+fGoazp+0YQ4T1ZPGj+JQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472237; 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=y+BpLfC101FZZsv/ZKAVrC3Noen0eUL2ciky+9NrHqE=; b=FhrNdwE8n957AgVZru+F0Qag6aVeveVu21/gcm1A0XoWs0VXS/JidFs13eJPoNfskjt+YtWsGRPv+7N3blDmHaN4w4pMb1Nq3Par3RLz+whVpYdwxyC7hQcPtCi7we1ZZ/kfVH4JX99Rw6CHPFYE/XZyggVzeMKl6GkZ23p6UW8= 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 1685472237637258.8473917091279; Tue, 30 May 2023 11:43:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GM-0000Vd-7d; Tue, 30 May 2023 14:40:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GJ-0000Ue-7x for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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 1q44GH-0004A0-GZ for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:02 -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-184-gfW_FIvtNe2jlieXVdWpWA-1; Tue, 30 May 2023 14:39:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AFB8A3C11A1E; Tue, 30 May 2023 18:39:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 263C4C154D1; Tue, 30 May 2023 18:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472000; 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=y+BpLfC101FZZsv/ZKAVrC3Noen0eUL2ciky+9NrHqE=; b=aMXznNFjMrGJqWjkxVuwsigugSPp8v/lZKB0TpAjyzgXsSSJDTED1Ycmgiv3CycfHUbQT7 JdtnWvNg8buyghceocSn46PfyU/Fexs6jUlANlc8yNNiROZfYXUw9YmRf46H0wLS0tZZC9 MjC1aZ/9Gxl/FrfGlX9rswxPkiTYSHI= X-MC-Unique: gfW_FIvtNe2jlieXVdWpWA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 06/20] qemu_file: total_transferred is not used anymore Date: Tue, 30 May 2023 20:39:27 +0200 Message-Id: <20230530183941.7223-7-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472239161100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/qemu-file.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index eb0497e532..6b6deea19b 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -41,9 +41,6 @@ struct QEMUFile { QIOChannel *ioc; bool is_writable; =20 - /* The sum of bytes transferred on the wire */ - uint64_t total_transferred; - int buf_index; int buf_size; /* 0 when writing */ uint8_t buf[IO_BUF_SIZE]; @@ -287,7 +284,6 @@ void qemu_fflush(QEMUFile *f) qemu_file_set_error_obj(f, -EIO, local_error); } else { uint64_t size =3D iov_size(f->iov, f->iovcnt); - f->total_transferred +=3D size; stat64_add(&mig_stats.qemu_file_transferred, size); } =20 --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472059; cv=none; d=zohomail.com; s=zohoarc; b=cUG+qbTA/7c4rb9272E2kiYMSH6Rz0QLII8tHBXr0Vlj9xTvQ9yKq4zaHjs0N/OipDO3Z8Ql/WK0NEMwsxnwCZTvx0iwQYh7sV50vduls74sfdHYkkWTDQXR21H+o0ZtiLJu0rd+3Ie4u3mMZcT4PTDD2KO6UK3nNMBzKD/p6eI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472059; 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=ZDTNI6jMSmjUnA1ZJis8o+rXfT66go9E6XExEz/hVZg=; b=JK9SfOeVJdCPCU6jCHJSXjHADdS7k1d3N6ZSQvKwQnn/jiTOFtXiSK4MvN5JPEu5wHFJBxWEGa0MJdSeJpJeA8oUN03nfssnTpmXC0ddGb8AWS9qBCjPU4xp8DOOCSv0JKIsK54DX/HCMErK8OCFsZpe19opyLlR+S54MKigbZI= 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 1685472059527918.3782215400407; Tue, 30 May 2023 11:40:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GM-0000WH-Qq; Tue, 30 May 2023 14:40:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GK-0000VJ-Ls for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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 1q44GJ-0004Dr-B3 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:04 -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-607-wJ-5FL8LPKyG7_W0scswPw-1; Tue, 30 May 2023 14:39:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B8AD380673C; Tue, 30 May 2023 18:39:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02A25C154D1; Tue, 30 May 2023 18:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472002; 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=ZDTNI6jMSmjUnA1ZJis8o+rXfT66go9E6XExEz/hVZg=; b=SBKwTSmZOZo+NHkbzA05oz3jZks8R9/xYC5I0HaNjWK4g3RfKmbhG12sTLLdGqynM11+Tu XPbbO91BqxkaG+awZINnz79bKvliCLxgLo6F618kV39xTkdg9k1sgaH4XXw/jaqs3+SgGV 5paZQJk1k+j2LtysQgk8r4bixN9e1WE= X-MC-Unique: wJ-5FL8LPKyG7_W0scswPw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 07/20] migration: Use the number of transferred bytes directly Date: Tue, 30 May 2023 20:39:28 +0200 Message-Id: <20230530183941.7223-8-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472061336100002 Content-Type: text/plain; charset="utf-8" We only use migration_transferred_bytes() to calculate the rate_limit, for that we don't need to flush whatever is on the qemu_file buffer. Remember that the buffer is really small (normal case is 32K if we use iov's can be 64 * TARGET_PAGE_SIZE), so this is not relevant to calculations. Signed-off-by: Juan Quintela --- migration/migration-stats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/migration-stats.c b/migration/migration-stats.c index 79eea8d865..1696185694 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -62,7 +62,7 @@ uint64_t migration_transferred_bytes(QEMUFile *f) { uint64_t multifd =3D stat64_get(&mig_stats.multifd_bytes); uint64_t rdma =3D stat64_get(&mig_stats.rdma_bytes); - uint64_t qemu_file =3D qemu_file_transferred(f); + uint64_t qemu_file =3D stat64_get(&mig_stats.qemu_file_transferred); =20 trace_migration_transferred_bytes(qemu_file, multifd, rdma); return qemu_file + multifd + rdma; --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472085; cv=none; d=zohomail.com; s=zohoarc; b=lQXqTvPfLhoQfzRwI7/MuA5AyXZUXXBhyU6IBw6XG9yRrBtbhVucp0OVL/UYoYV3OVclM0Mirdvjl96x38nkbLuPxawdEVPPstPvwOqtycapcWM9Ulhy/Tiqg5bGMtAfh40q//8QjmqDABkPJZKJSg/2Zd7eNb7vzNg+tDU5l6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472085; 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=g3jCwwECLTiUMbZpqGZ32HPNdGiGnO1NF8QlR3U4u/0=; b=K9u+UJNjdQBmOBW96wj/TFr40onjmoQYmh2PS5SMwPjwpRbs1A1Ly+OQ8NRhsgnZcAUXeOyIG7bw/qm8nRaZpAYICDyLNz3bMsDkLgJT9/ajeXn8glYXpHiwAnmzIxHaojir2+Wg8t8g1SfyImHn8sgFepB6QUsx6YtTfCxuG/o= 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 1685472085318767.9460601340991; Tue, 30 May 2023 11:41:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GQ-0000Xf-Lb; Tue, 30 May 2023 14:40: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 1q44GO-0000Wq-Ss for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:08 -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 1q44GM-0004Mu-2y for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:08 -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-496-wM8JcUOfNd6gJCKY_cez7A-1; Tue, 30 May 2023 14:40:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D93728078CC; Tue, 30 May 2023 18:40:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1DC2C154D1; Tue, 30 May 2023 18:39:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472005; 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=g3jCwwECLTiUMbZpqGZ32HPNdGiGnO1NF8QlR3U4u/0=; b=FgbH7Fv6BV6f3Vz4AwHWdWvn1LleEfx8A8xlNcO2gpEP2KPt1c4iRnAjF2+HNCOxJnctgU YbBZLws+H5lN64183TUfna6mf4jhG3nE1SOWkFUEkx1KWFAKHCdgWpDUdQjezxZ54RTo1R ZGe1lmRG9ZF6mFnxbEsVil7fGraHooI= X-MC-Unique: wM8JcUOfNd6gJCKY_cez7A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 08/20] qemu_file: Remove unused qemu_file_transferred() Date: Tue, 30 May 2023 20:39:29 +0200 Message-Id: <20230530183941.7223-9-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472086643100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/qemu-file.h | 18 ------------------ migration/qemu-file.c | 7 ------- 2 files changed, 25 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 21c3f34b84..b4fb872018 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -33,24 +33,6 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc); QEMUFile *qemu_file_new_output(QIOChannel *ioc); int qemu_fclose(QEMUFile *f); =20 -/* - * qemu_file_transferred: - * - * Report the total number of bytes transferred with - * this file. - * - * For writable files, any pending buffers will be - * flushed, so the reported value will be equal to - * the number of bytes transferred on the wire. - * - * For readable files, the reported value will be - * equal to the number of bytes transferred on the - * wire. - * - * Returns: the total bytes transferred - */ -uint64_t qemu_file_transferred(QEMUFile *f); - /* * qemu_file_transferred_noflush: * diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 6b6deea19b..1e6fafc245 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -637,13 +637,6 @@ uint64_t qemu_file_transferred_noflush(QEMUFile *f) return ret; } =20 -uint64_t qemu_file_transferred(QEMUFile *f) -{ - g_assert(qemu_file_is_writable(f)); - qemu_fflush(f); - return stat64_get(&mig_stats.qemu_file_transferred); -} - void qemu_put_be16(QEMUFile *f, unsigned int v) { qemu_put_byte(f, v >> 8); --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472128; cv=none; d=zohomail.com; s=zohoarc; b=SvzoJ+dN2TUe5WZbLGC3h7vYmnjV1NFiLS+9zIiLZBCyeyD0KSboudw7X/SY/XkUtxvO3N5rpiX2Onc7auRAy6CJ6EWW9qHCjPxfaIoyAztxdQMODmMH4C6LeUCWQtKnaBuHaSksbNhkMGFSJA+GIPjeB9nE/sswCWbMc58cufs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472128; 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=/MFfSBAQGLXsglEvf7M78QBWXN5LEXG1b5wvsbDTNiw=; b=eTy8lu1C1g2hLgbNT6+I1N31FkzaN9Bb5SoKaa0RYBvPM/qOUxj+R8G+GqHRetbuqPmN/pTej+xDBg5wFBu49PF6GtAg8F4TGcRJ/XqCJWfQrKLUwICfIk+NPOknLjNdNR6EfrikBpvQ97iTjxC7JfUWu8n4bFUEabU7W0Dztd4= 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 1685472128184667.0046802740729; Tue, 30 May 2023 11:42:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44GQ-0000Xi-MA; Tue, 30 May 2023 14:40: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 1q44GO-0000Ws-TQ for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:08 -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 1q44GM-0004N7-S3 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:08 -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-646-mTUG-g3aOrKWfUoQSZPx4A-1; Tue, 30 May 2023 14:40:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BE421C068C6; Tue, 30 May 2023 18:40:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id D4255C154D1; Tue, 30 May 2023 18:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472006; 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=/MFfSBAQGLXsglEvf7M78QBWXN5LEXG1b5wvsbDTNiw=; b=F1C85hXThBC+K0szl920YhQKLJQtFmaOKud3QHPTks82B6Sd0mTca9GhtV14waECB5MmhN Od5ErWXdd+rSbezsXjyaGBzrocCS2LygtZExkrdUthET8iC7JaU6hxTkKDwwIBMfqFkWsS FiPpMJIH3Dkj93pXg8eOJKtDK8trMF8= X-MC-Unique: mTUG-g3aOrKWfUoQSZPx4A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 09/20] qemu-file: Remove _noflush from qemu_file_transferred_noflush() Date: Tue, 30 May 2023 20:39:30 +0200 Message-Id: <20230530183941.7223-10-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472128677100005 Content-Type: text/plain; charset="utf-8" qemu_file_transferred() don't exist anymore, so we can reuse the name. Signed-off-by: Juan Quintela --- v2: Update the documentation (thanks fabiano) --- migration/qemu-file.h | 9 ++++----- migration/block.c | 4 ++-- migration/qemu-file.c | 2 +- migration/savevm.c | 6 +++--- migration/vmstate.c | 4 ++-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index b4fb872018..507f3bede4 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -34,15 +34,14 @@ QEMUFile *qemu_file_new_output(QIOChannel *ioc); int qemu_fclose(QEMUFile *f); =20 /* - * qemu_file_transferred_noflush: + * qemu_file_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. + * 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_noflush(QEMUFile *f); +uint64_t qemu_file_transferred(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/block.c b/migration/block.c index b29e80bdc4..b9580a6c7e 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_noflush(f); + uint64_t last_bytes =3D qemu_file_transferred(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_noflush(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_transferred(f) - last_bytes; return (delta_bytes > 0); } =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 1e6fafc245..94dd6d7fdd 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -623,7 +623,7 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -uint64_t qemu_file_transferred_noflush(QEMUFile *f) +uint64_t qemu_file_transferred(QEMUFile *f) { uint64_t ret =3D stat64_get(&mig_stats.qemu_file_transferred); int i; diff --git a/migration/savevm.c b/migration/savevm.c index b2199d1039..751b4a1e31 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_noflush(f); + uint64_t old_offset =3D qemu_file_transferred(f); se->ops->save_state(f, se->opaque); - uint64_t size =3D qemu_file_transferred_noflush(f) - old_offset; + uint64_t size =3D qemu_file_transferred(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); @@ -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_noflush(f); + vm_state_size =3D qemu_file_transferred(f); ret2 =3D qemu_fclose(f); if (ret < 0) { goto the_end; diff --git a/migration/vmstate.c b/migration/vmstate.c index 31842c3afb..fd8035ea32 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_noflush(f); + old_offset =3D qemu_file_transferred(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_noflush(f) - old_o= ffset; + written_bytes =3D qemu_file_transferred(f) - old_offset; 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 Fri May 17 11:59:09 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=1685472135; cv=none; d=zohomail.com; s=zohoarc; b=LZZRIR4ops920tkDPZKuPAuW5kP3E5inkpw7b9I1+NQd8f25odaKCv2j3N9t2Y49RjOwhEFJPpO5Humw+uIFKYnrw2vlYJCYdleo7AagVqDEqIMMM7ZwN8aQVGS45BwsF1MI5DdGdswlvzOaQlPXGccF2wXZxDXMOK629Bv65N0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472135; 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=d/WzPQ7VAzkgJMTZoSSX5UDZriHI8NBJXm5X3sdhp9c=; b=ONtf4sPbJMuDt/nsIuMrlA95vEF3SpBLbIKVuwbUqma7uVaSy40TVxSciG7P5ePciGZacr7vxFU9/QwNfrKjfu5L6L5O5FdJX+/k7OrTC8LlJV7kPJ6ePmm42PfRYXJ1uhRPOx+wT3ZYcsVL3M3rMSC09y4u2bm0QlhJJQV0/gU= 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 1685472135801220.09354792146974; Tue, 30 May 2023 11:42:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Go-0001CQ-K4; Tue, 30 May 2023 14:40:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GS-0000aI-FJ for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:12 -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 1q44GQ-0004OA-Po for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:12 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-407-FJYdyVv9Ohu4ex_jVOWbtg-1; Tue, 30 May 2023 14:40:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C4653C11A2A; Tue, 30 May 2023 18:40:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4D23C154D1; Tue, 30 May 2023 18:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472009; 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=d/WzPQ7VAzkgJMTZoSSX5UDZriHI8NBJXm5X3sdhp9c=; b=UdfJHLXt/+eavLei8kgeW7yV3a2akAqHGRJRkKtdsfYrpJJ8+UDGJTnw3pq55ui3m5TIqq hXaDwvU8I9Y4ZtAl/PVVIpEZdyuIgrFcoquZNeWk3TZ5eMDS4OYo2GmiVT52UJ1hpFfIZU Btwn149mRUEBLZe1p+Dw4vjCTV3EQTc= X-MC-Unique: FJYdyVv9Ohu4ex_jVOWbtg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 10/20] migration: migration_transferred_bytes() don't need the QEMUFile Date: Tue, 30 May 2023 20:39:31 +0200 Message-Id: <20230530183941.7223-11-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472136711100005 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Juan Quintela --- migration/migration-stats.h | 4 +--- migration/migration-stats.c | 6 +++--- migration/migration.c | 6 +++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/migration/migration-stats.h b/migration/migration-stats.h index b7795e7914..e3863bf9bb 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -137,11 +137,9 @@ void migration_rate_set(uint64_t new_rate); /** * migration_transferred_bytes: Return number of bytes transferred * - * @f: QEMUFile used for main migration channel - * * Returns how many bytes have we transferred since the beginning of * the migration. It accounts for bytes sent through any migration * channel, multifd, qemu_file, rdma, .... */ -uint64_t migration_transferred_bytes(QEMUFile *f); +uint64_t migration_transferred_bytes(void); #endif diff --git a/migration/migration-stats.c b/migration/migration-stats.c index 1696185694..a5f3fcc5ae 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -25,7 +25,7 @@ bool migration_rate_exceeded(QEMUFile *f) } =20 uint64_t rate_limit_start =3D stat64_get(&mig_stats.rate_limit_start); - uint64_t rate_limit_current =3D migration_transferred_bytes(f); + uint64_t rate_limit_current =3D migration_transferred_bytes(); uint64_t rate_limit_used =3D rate_limit_current - rate_limit_start; uint64_t rate_limit_max =3D stat64_get(&mig_stats.rate_limit_max); =20 @@ -55,10 +55,10 @@ void migration_rate_set(uint64_t limit) =20 void migration_rate_reset(QEMUFile *f) { - stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes(f)= ); + stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes()); } =20 -uint64_t migration_transferred_bytes(QEMUFile *f) +uint64_t migration_transferred_bytes(void) { uint64_t multifd =3D stat64_get(&mig_stats.multifd_bytes); uint64_t rdma =3D stat64_get(&mig_stats.rdma_bytes); diff --git a/migration/migration.c b/migration/migration.c index 31d30a2ac5..24e55c5bf3 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2628,7 +2628,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) =20 static void migration_calculate_complete(MigrationState *s) { - uint64_t bytes =3D migration_transferred_bytes(s->to_dst_file); + uint64_t bytes =3D migration_transferred_bytes(); int64_t end_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); int64_t transfer_time; =20 @@ -2654,7 +2654,7 @@ static void update_iteration_initial_status(Migration= State *s) * wrong speed calculation. */ s->iteration_start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); - s->iteration_initial_bytes =3D migration_transferred_bytes(s->to_dst_f= ile); + s->iteration_initial_bytes =3D migration_transferred_bytes(); s->iteration_initial_pages =3D ram_get_total_transferred_pages(); } =20 @@ -2669,7 +2669,7 @@ static void migration_update_counters(MigrationState = *s, return; } =20 - current_bytes =3D migration_transferred_bytes(s->to_dst_file); + current_bytes =3D migration_transferred_bytes(); transferred =3D current_bytes - s->iteration_initial_bytes; time_spent =3D current_time - s->iteration_start_time; bandwidth =3D (double)transferred / time_spent; --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472047; cv=none; d=zohomail.com; s=zohoarc; b=d7X4KpiGyH4dbDWTglv/X8DKhBF09Ed2H4TOR5IyTv8GmCnG7Zgphr8xpHHAXe4BOLnAdpUt9+33qUT903JktT3opDk4WZ+hjqCKch7y8fsq/JhTbTwaJnpx4n1vYaePpX0siMuKXShe1uAglTg3v1VPcwowJ1X9YxWlp0M8VsA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472047; 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=6uH0uhQhTSeDUjkdYsPVu9Bs0u9TD8o1Vvzto0saVKo=; b=Ok0tl2hPfl/WYUjXL6v9j96TNHHU2plvuqq3WBFdUgBPsc2Rq9IIp+z34BWYtn+3yyvjqkS+y9uUbA2tXY6zu4IK0G6JS6UnoZPVDW1CoprZLEJnSeyB76zcFoIEKEBWKkgAIJ7t4wvtnkA2Lj8mH4NMYfFjV3zg8cMN17iYXCo= 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 1685472047927933.5819259881092; Tue, 30 May 2023 11:40:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gc-0000eF-F7; Tue, 30 May 2023 14:40: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 1q44GR-0000Yn-58 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GP-0004O3-JV for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-207-USWqCWd3OeWB8n1wtUgE1Q-1; Tue, 30 May 2023 14:40:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B38685A5B5; Tue, 30 May 2023 18:40:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4D41C154D1; Tue, 30 May 2023 18:40:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472009; 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=6uH0uhQhTSeDUjkdYsPVu9Bs0u9TD8o1Vvzto0saVKo=; b=RBQpbXwtekdS/R+9JFjqrybSvlJ8xkrtkdo2unAPmETIfmk4ALKeED9TBNef+ex/rayiM7 B/XRci//LLcY6IbuNdhxEqfZjRFKgyeeWtsDjPHJx+zUYjgTOWwkFQOKGY8r0oewKUtjuu 1WZQtAreTuR5hvyYH1KqZ/jQgEtmliA= X-MC-Unique: USWqCWd3OeWB8n1wtUgE1Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 11/20] migration: migration_rate_limit_reset() don't need the QEMUFile Date: Tue, 30 May 2023 20:39:32 +0200 Message-Id: <20230530183941.7223-12-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472048908100004 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Juan Quintela --- migration/migration-stats.h | 4 +--- migration/migration-stats.c | 2 +- migration/migration.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/migration/migration-stats.h b/migration/migration-stats.h index e3863bf9bb..68f3939188 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -120,10 +120,8 @@ uint64_t migration_rate_get(void); * migration_rate_reset: Reset the rate limit counter. * * This is called when we know we start a new transfer cycle. - * - * @f: QEMUFile used for main migration channel */ -void migration_rate_reset(QEMUFile *f); +void migration_rate_reset(void); =20 /** * migration_rate_set: Set the maximum amount that can be transferred. diff --git a/migration/migration-stats.c b/migration/migration-stats.c index a5f3fcc5ae..df541fa904 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -53,7 +53,7 @@ void migration_rate_set(uint64_t limit) stat64_set(&mig_stats.rate_limit_max, limit / XFER_LIMIT_RATIO); } =20 -void migration_rate_reset(QEMUFile *f) +void migration_rate_reset(void) { stat64_set(&mig_stats.rate_limit_start, migration_transferred_bytes()); } diff --git a/migration/migration.c b/migration/migration.c index 24e55c5bf3..ab8254e433 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2693,7 +2693,7 @@ static void migration_update_counters(MigrationState = *s, stat64_get(&mig_stats.dirty_bytes_last_sync) / bandwidth; } =20 - migration_rate_reset(s->to_dst_file); + migration_rate_reset(); =20 update_iteration_initial_status(s); =20 --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472062; cv=none; d=zohomail.com; s=zohoarc; b=VoN/N9MKBL7U0uajxGoGv4WzXXnkPzeotT4wyJoQQMzoxP9vL9/qqpvPyamiUJl+RPccuIAH2l5lM8vgTwC5mENsw+b/5UdZUnCIBz6rKnfBgz+6YoRJy7IkLoLe2vE6HgLeAoy6bJfGdeEwHIZZwp2SD2LGfDr1kOocxoW/ZGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472062; 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=OSgtMYPjAQZNRxltoIAMAajw8mQUj4GwmaGTFJFk6no=; b=AnGKJNYegezhIM+PAD8NYNmWS7bCFahYDn1kzXlhhgTilTeXlpcxqSw1QtgeFzmEg6MUmArUm+RdrhNP7QWbL1KPovSnLG8snjikFEqaZU0M+JZAb0aicTUy7wo98OyE7YFonjDApy4TmbzWJ7ohwY9sADfJuDOkd0Cb/TVc8ts= 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 168547206280263.9593472450548; Tue, 30 May 2023 11:41:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Go-0001Bn-IT; Tue, 30 May 2023 14:40:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GZ-0000eA-Bo for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GV-0004PR-9c for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-272-e98byZlWPeu3AdIlyqi7wg-1; Tue, 30 May 2023 14:40:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C92598007D9; Tue, 30 May 2023 18:40:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1F654C154D1; Tue, 30 May 2023 18:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472013; 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=OSgtMYPjAQZNRxltoIAMAajw8mQUj4GwmaGTFJFk6no=; b=VVFU9osrrmybU6avYd3usOaUWayY9wL/akYF7TAam+GJ44mcbl9fNbIUZo8XedblhbSSL+ m9SzPS0FkbdrIUOAnxzpl4PLXNBPekpIX2XDfJdkpXFapvgXzVA0vAZEnYBOA+QRx6AYMy iFfFmpUyp0oUJUrdQ0ofyorCNWI2vig= X-MC-Unique: e98byZlWPeu3AdIlyqi7wg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , Fabiano Rosas Subject: [PATCH v2 12/20] qemu-file: Simplify qemu_file_get_error() Date: Tue, 30 May 2023 20:39:33 +0200 Message-Id: <20230530183941.7223-13-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472064246100007 Content-Type: text/plain; charset="utf-8" If we pass a NULL error is the same that returning dirrectly the value. Reviewed-by: Fabiano Rosas Signed-off-by: Juan Quintela --- migration/qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 94dd6d7fdd..7200f08ad5 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -209,7 +209,7 @@ void qemu_file_set_error_obj(QEMUFile *f, int ret, Erro= r *err) */ int qemu_file_get_error(QEMUFile *f) { - return qemu_file_get_error_obj(f, NULL); + return f->last_error; } =20 /* --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472072; cv=none; d=zohomail.com; s=zohoarc; b=RoE5BqFnXdxSGkB5FVa5LNIKAYcPSzuN7tvdCcDX3AKjc+4kVKTDZNYeskSGx6Azx02RywrIZQoJk19Fu+twm5bQzkGz0H5uqP2/R8qofboAy6C83yjjzP8gkdumS2SVYGU/2OkWl5vDPSFLWJCC5T59/OKOrTJU2y+1HnwFU5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472072; 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=lBy7DnnRDOpRwmwUlyk+/SRtpjv5VyW95uTcUoEaF7I=; b=U1D/1bWxTQjJeLWErA3eD9fK1pX3gIY3OHiCEtlj3mill/olrEW4A0zWV3IVsaIdIonVtNXiVBiSALkRS6dZMBLWfowhQ/DzI/sOtxKqy4UQIEb+Qm8IdsgsWf+aHYiy1Tp9TFLN6cRwJJpfqr6ea+nH1SbDdvVj0Uz/ufOkbKM= 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 1685472072517381.17580230015074; Tue, 30 May 2023 11:41:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gh-0000oV-7k; Tue, 30 May 2023 14:40:27 -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 1q44GV-0000b2-PG for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:20 -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 1q44GT-0004PD-68 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:14 -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-219-zaDOT5_OO_KPaTgxliHnyA-1; Tue, 30 May 2023 14:40:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2338811E86; Tue, 30 May 2023 18:40:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DD44C154D1; Tue, 30 May 2023 18:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472012; 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=lBy7DnnRDOpRwmwUlyk+/SRtpjv5VyW95uTcUoEaF7I=; b=e7N+/M92pYuJw3S1h2u2uDc4NkVj6whYa9pmzmVanKfNvKZNHBn6dvEE00tUYtaHAWB40Q AypQgufIiNQfEdMl0CjkHR+CYreg9PJAR8eLbq6wVRHho+7Zfr+cqZPeK8Hx9E60otFnhA nwMnBIQ4uDzNaqnSW0xYjFft7hhiTDQ= X-MC-Unique: zaDOT5_OO_KPaTgxliHnyA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 13/20] migration: Use migration_transferred_bytes() Date: Tue, 30 May 2023 20:39:34 +0200 Message-Id: <20230530183941.7223-14-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472074530100003 Content-Type: text/plain; charset="utf-8" There are only two differnces with the old value: - the amount of QEMUFile that hasn't yet been flushed. It can be discussed what is more exact, the new or the old one. - the amount of transferred bytes that we forgot to account for (the newer is better, i.e. exact). Notice that this two values are used to: a - present to the user b - calculate the rate_limit So a few KB here and there is not going to make a difference. Signed-off-by: Juan Quintela --- migration/migration.c | 2 +- migration/ram.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index ab8254e433..6ed55d618a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -912,7 +912,7 @@ static void populate_ram_info(MigrationInfo *info, Migr= ationState *s) size_t page_size =3D qemu_target_page_size(); =20 info->ram =3D g_malloc0(sizeof(*info->ram)); - info->ram->transferred =3D stat64_get(&mig_stats.transferred); + info->ram->transferred =3D migration_transferred_bytes(); info->ram->total =3D ram_bytes_total(); info->ram->duplicate =3D stat64_get(&mig_stats.zero_pages); /* legacy value. It is not used anymore */ diff --git a/migration/ram.c b/migration/ram.c index 87fc504674..0675421f4e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -552,7 +552,7 @@ void mig_throttle_counter_reset(void) =20 rs->time_last_bitmap_sync =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&mig_stats.transferred); + rs->bytes_xfer_prev =3D migration_transferred_bytes(); } =20 /** @@ -988,7 +988,7 @@ static void migration_trigger_throttle(RAMState *rs) { uint64_t threshold =3D migrate_throttle_trigger_threshold(); uint64_t bytes_xfer_period =3D - stat64_get(&mig_stats.transferred) - rs->bytes_xfer_prev; + migration_transferred_bytes() - rs->bytes_xfer_prev; uint64_t bytes_dirty_period =3D rs->num_dirty_pages_period * TARGET_PA= GE_SIZE; uint64_t bytes_dirty_threshold =3D bytes_xfer_period * threshold / 100; =20 @@ -1051,7 +1051,7 @@ static void migration_bitmap_sync(RAMState *rs, bool = last_stage) /* reset period counters */ rs->time_last_bitmap_sync =3D end_time; rs->num_dirty_pages_period =3D 0; - rs->bytes_xfer_prev =3D stat64_get(&mig_stats.transferred); + rs->bytes_xfer_prev =3D migration_transferred_bytes(); } if (migrate_events()) { uint64_t generation =3D stat64_get(&mig_stats.dirty_sync_count); --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472211; cv=none; d=zohomail.com; s=zohoarc; b=QssHAbSYtlz41W+gZH3W0UEBMywcLnPNebv2PRzDbgrIRmaunKBHS9Kb02we/Y5p7GJzDcCLLhC2xeFrEZXZgBDJ/oYxn4sy21qPqtW/1qJNbWO3JIwLrwweul+c3RRHFSxY0MQGYHHYlaN7AcJS5Tu4Vhf6PyZhrQRYOcoHzCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472211; 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=rvR5bgkmZDgLIWYppPBjRPR0iSGa5MAU0MoILu94rXA=; b=Dnx6GvGZU2rdtbQ7kYsAPYZeJcTF3vwPASqrbd3id3zTqTGViTYdLzK3G8I/5tGYE77rlAPB73Ktn5oJ/SMdeTaiBMH4j3iz+YEWFpPbYV9h+uzeP9Du/qhjql0JpTO39xl26F3sFpw0HBCwxUi4ajCDrH++YHPHvIKq0V8EfLI= 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 1685472211308377.4677786421677; Tue, 30 May 2023 11:43:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gl-00011F-3e; Tue, 30 May 2023 14:40: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 1q44GZ-0000eB-CD for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44GV-0004Pf-Ir for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:17 -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-110-AIAj6u49MTiZfMt7oPYLfA-1; Tue, 30 May 2023 14:40:13 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 84D56800B35; Tue, 30 May 2023 18:40:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id E763FC154D1; Tue, 30 May 2023 18:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472014; 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=rvR5bgkmZDgLIWYppPBjRPR0iSGa5MAU0MoILu94rXA=; b=MQB3RN+RSuQGVZQhRXxAfmmQcYeT+iXteS/pX1uVa2hNDyjKhaTS6a3pEtVEy2Epuu/tpp rGq1AyZ393ckXamTXu+DVqCHCzOZEXWqM3E/4PyZHnSm3XDnU+6kUQBpxNOb1YAWfBHr/c 3M3KWPsJgQqHANSuJwTdbsFnENnXCkA= X-MC-Unique: AIAj6u49MTiZfMt7oPYLfA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 14/20] migration: Remove transferred atomic counter Date: Tue, 30 May 2023 20:39:35 +0200 Message-Id: <20230530183941.7223-15-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472212525100005 Content-Type: text/plain; charset="utf-8" After last commit, it is a write only variable. Signed-off-by: Juan Quintela --- migration/migration-stats.h | 4 ---- migration/multifd.c | 3 --- migration/ram.c | 1 - 3 files changed, 8 deletions(-) diff --git a/migration/migration-stats.h b/migration/migration-stats.h index 68f3939188..05290ade76 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -97,10 +97,6 @@ typedef struct { * Number of bytes sent through RDMA. */ Stat64 rdma_bytes; - /* - * Total number of bytes transferred. - */ - Stat64 transferred; /* * Number of pages transferred that were full of zeros. */ diff --git a/migration/multifd.c b/migration/multifd.c index 0bf5958a9c..b297d1cb62 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -188,7 +188,6 @@ static int multifd_send_initial_packet(MultiFDSendParam= s *p, Error **errp) return -1; } stat64_add(&mig_stats.multifd_bytes, size); - stat64_add(&mig_stats.transferred, size); return 0; } =20 @@ -715,7 +714,6 @@ static void *multifd_send_thread(void *opaque) break; } stat64_add(&mig_stats.multifd_bytes, p->packet_len); - stat64_add(&mig_stats.transferred, p->packet_len); } else { /* Send header using the same writev call */ p->iov[0].iov_len =3D p->packet_len; @@ -729,7 +727,6 @@ static void *multifd_send_thread(void *opaque) } =20 stat64_add(&mig_stats.multifd_bytes, p->next_packet_size); - stat64_add(&mig_stats.transferred, p->next_packet_size); qemu_mutex_lock(&p->mutex); p->pending_job--; qemu_mutex_unlock(&p->mutex); diff --git a/migration/ram.c b/migration/ram.c index 0675421f4e..cdf7783d65 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -443,7 +443,6 @@ void ram_transferred_add(uint64_t bytes) } else { stat64_add(&mig_stats.downtime_bytes, bytes); } - stat64_add(&mig_stats.transferred, bytes); } =20 struct MigrationOps { --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472132; cv=none; d=zohomail.com; s=zohoarc; b=YrY9lWq6OuSfYlpNi0dF0/pgIISfenaRhVvefPiQv94e57cXGQEGHtnWnCTu6WyAl51Oja6DlykyvJu+1ivvrcleLrWt5aEfHyhfCYcC08PeTxBVdYrgpz2NJWux5h3NCctVgq/zpxPWYr2Yz/YJ4B6IkoaPVx4JHrjqYCf2Esw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472132; 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=EzWKPO2njnOTREWa2luvhGS6auBTKDYimcd7voBKQ78=; b=Ao+yQAiAwytfX7Rrb2aKFWSILNHqihSe0Tmd4fd71Jb9jbR3w4JXb/f5iC/SLqLTDAnhFDCjmhU0SC/MQAQu7GGh+80QRJuHyXHwnJjf2ZYec9vNR1mikBpRjBrRwjvss30ss+RJHwE1pKk2ACgotQqzaOxxM+hPATYpcctq/JA= 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 1685472132555145.33602658207633; Tue, 30 May 2023 11:42:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gq-0001QV-GJ; Tue, 30 May 2023 14:40:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44Gc-0000ef-1r for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:22 -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 1q44Ga-0004Rz-2U for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:21 -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-655-ik8KJTJrN72ncMn1NGlEtg-1; Tue, 30 May 2023 14:40:15 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7E07C1C068D9; Tue, 30 May 2023 18:40:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9EFAC154D1; Tue, 30 May 2023 18:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472019; 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=EzWKPO2njnOTREWa2luvhGS6auBTKDYimcd7voBKQ78=; b=eQklrTxNVVRThgvrXN0pGeNZfd7BDxBVz9RpaelPRMEWykQGznBHVvmbzuxqZTuaDLV3bE 45ajCrV00XXhBJaVM8qjMRvT3kRXs6K4s0IMzSdUExB4Cc3aBF8yrVIFNHvzKpenLPrekz S2PDSpWXdHUYLa8Ucd3iLI7r6c6A9y0= X-MC-Unique: ik8KJTJrN72ncMn1NGlEtg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v2 15/20] qemu-file: Make qemu_fflush() return errors Date: Tue, 30 May 2023 20:39:36 +0200 Message-Id: <20230530183941.7223-16-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472134712100003 This let us simplify code of this shape. qemu_fflush(f); int ret =3D qemu_file_get_error(f); if (ret) { return ret; } into: int ret =3D qemu_fflush(f); if (ret) { return ret; } I updated all callers where there is any error check. qemu_fclose() don't need to check for f->last_error because qemu_fflush() returns it at the beggining of the function. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Juan Quintela --- In v2: Now that we call always qemu_fflush() for all files, we can simplify qemu_fclose() --- migration/qemu-file.h | 2 +- migration/colo.c | 11 +++-------- migration/migration.c | 7 +------ migration/qemu-file.c | 23 +++++++---------------- migration/ram.c | 22 +++++++--------------- migration/rdma.c | 4 +--- migration/savevm.c | 3 +-- 7 files changed, 21 insertions(+), 51 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 507f3bede4..f2c118f342 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -74,7 +74,7 @@ void qemu_file_set_error_obj(QEMUFile *f, int ret, Error = *err); void qemu_file_set_error(QEMUFile *f, int ret); int qemu_file_shutdown(QEMUFile *f); QEMUFile *qemu_file_get_return_path(QEMUFile *f); -void qemu_fflush(QEMUFile *f); +int qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =20 diff --git a/migration/colo.c b/migration/colo.c index 72f4f7b37e..4447e34914 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -314,9 +314,7 @@ static void colo_send_message(QEMUFile *f, COLOMessage = msg, return; } qemu_put_be32(f, msg); - qemu_fflush(f); - - ret =3D qemu_file_get_error(f); + ret =3D qemu_fflush(f); if (ret < 0) { error_setg_errno(errp, -ret, "Can't send COLO message"); } @@ -335,9 +333,7 @@ static void colo_send_message_value(QEMUFile *f, COLOMe= ssage msg, return; } qemu_put_be64(f, value); - qemu_fflush(f); - - ret =3D qemu_file_get_error(f); + ret =3D qemu_fflush(f); if (ret < 0) { error_setg_errno(errp, -ret, "Failed to send value for message:%s", COLOMessage_str(msg)); @@ -483,8 +479,7 @@ static int colo_do_checkpoint_transaction(MigrationStat= e *s, } =20 qemu_put_buffer(s->to_dst_file, bioc->data, bioc->usage); - qemu_fflush(s->to_dst_file); - ret =3D qemu_file_get_error(s->to_dst_file); + ret =3D qemu_fflush(s->to_dst_file); if (ret < 0) { goto out; } diff --git a/migration/migration.c b/migration/migration.c index 6ed55d618a..0195105c59 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -297,12 +297,7 @@ static int migrate_send_rp_message(MigrationIncomingSt= ate *mis, qemu_put_be16(mis->to_src_file, (unsigned int)message_type); qemu_put_be16(mis->to_src_file, len); qemu_put_buffer(mis->to_src_file, data, len); - qemu_fflush(mis->to_src_file); - - /* It's possible that qemu file got error during sending */ - ret =3D qemu_file_get_error(mis->to_src_file); - - return ret; + return qemu_fflush(mis->to_src_file); } =20 /* Request one page from the source VM at the given start address. diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7200f08ad5..4f9fb1fbd0 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -267,14 +267,14 @@ static void qemu_iovec_release_ram(QEMUFile *f) * This will flush all pending data. If data was only partially flushed, it * will set an error state. */ -void qemu_fflush(QEMUFile *f) +int qemu_fflush(QEMUFile *f) { if (!qemu_file_is_writable(f)) { - return; + return f->last_error; } =20 - if (qemu_file_get_error(f)) { - return; + if (f->last_error) { + return f->last_error; } if (f->iovcnt > 0) { Error *local_error =3D NULL; @@ -292,6 +292,7 @@ void qemu_fflush(QEMUFile *f) =20 f->buf_index =3D 0; f->iovcnt =3D 0; + return f->last_error; } =20 /* @@ -358,22 +359,12 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QE= MUFile *f) */ int qemu_fclose(QEMUFile *f) { - int ret, ret2; - qemu_fflush(f); - ret =3D qemu_file_get_error(f); - - ret2 =3D qio_channel_close(f->ioc, NULL); + int ret =3D qemu_fflush(f); + int ret2 =3D qio_channel_close(f->ioc, NULL); if (ret >=3D 0) { ret =3D ret2; } g_clear_pointer(&f->ioc, object_unref); - - /* If any error was spotted before closing, we should report it - * instead of the close() return value. - */ - if (f->last_error) { - ret =3D f->last_error; - } error_free(f->last_error_obj); g_free(f); trace_qemu_file_fclose(); diff --git a/migration/ram.c b/migration/ram.c index cdf7783d65..26baa54d98 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -301,17 +301,15 @@ int64_t ramblock_recv_bitmap_send(QEMUFile *file, =20 qemu_put_be64(file, size); qemu_put_buffer(file, (const uint8_t *)le_bitmap, size); + g_free(le_bitmap); /* * Mark as an end, in case the middle part is screwed up due to * some "mysterious" reason. */ qemu_put_be64(file, RAMBLOCK_RECV_BITMAP_ENDING); - qemu_fflush(file); - - g_free(le_bitmap); - - if (qemu_file_get_error(file)) { - return qemu_file_get_error(file); + int ret =3D qemu_fflush(file); + if (ret) { + return ret; } =20 return size + sizeof(size); @@ -3034,9 +3032,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, RAM_SAVE_FLAG_EOS); - qemu_fflush(f); - - return 0; + return qemu_fflush(f); } =20 /** @@ -3155,10 +3151,8 @@ out: } =20 qemu_put_be64(f, RAM_SAVE_FLAG_EOS); - qemu_fflush(f); ram_transferred_add(8); - - ret =3D qemu_file_get_error(f); + ret =3D qemu_fflush(f); } if (ret < 0) { return ret; @@ -3235,9 +3229,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) qemu_put_be64(f, RAM_SAVE_FLAG_MULTIFD_FLUSH); } qemu_put_be64(f, RAM_SAVE_FLAG_EOS); - qemu_fflush(f); - - return 0; + return qemu_fflush(f); } =20 static void ram_state_pending_estimate(void *opaque, uint64_t *must_precop= y, diff --git a/migration/rdma.c b/migration/rdma.c index f912a31b45..3ef35fc635 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3886,9 +3886,7 @@ int rdma_registration_start(QEMUFile *f, uint64_t fla= gs) =20 trace_rdma_registration_start(flags); qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); - qemu_fflush(f); - - return 0; + return qemu_fflush(f); } =20 /* diff --git a/migration/savevm.c b/migration/savevm.c index 751b4a1e31..1dc46b0967 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1536,8 +1536,7 @@ int qemu_savevm_state_complete_precopy(QEMUFile *f, b= ool iterable_only, } =20 flush: - qemu_fflush(f); - return 0; + return qemu_fflush(f); } =20 /* Give an estimate of the amount left to be transferred, --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472125; cv=none; d=zohomail.com; s=zohoarc; b=G9rOgE0NisZCzvoB00sTAXiKrEvGMGGfg2bM4WpNa0bTZ0daxoq/rwnTBpTuZYJ/SUYeK0yOg+Guy2qokFwFQwDU1bcQk9BlD/MJqkT20/I+Jtmu92Bz7n4XK5v/2IcZ1oDLUjtw3oXICtH8DUbrJk8nTXSzVIM8DdUeR13haio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472125; 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=9BRH7ZrNSb4xru9M4VnOUEfVp5yJ3S6DwScW9Xb9j8g=; b=Gf02pOrDVi+0zBFIxsewRLDqEmjQKXUnXgQKt5aYzaCB3f76Zoe+WRttc3XtDJbyhS4G/bvxOU1/AnoihjqQhhzokUfBVJMc2hbHwmaEdCvsd9n50P8T0BnnSPm/OelL3mOta4GTdOMs8sF3L7fcWhMrD5IsPOi2cAWdzRrbMZA= 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 1685472125331926.7193862772344; Tue, 30 May 2023 11:42:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gu-0001UN-JZ; Tue, 30 May 2023 14:40: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 1q44Gl-00013M-1n for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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 1q44Gi-0004Yb-Au for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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-592-iA0BjsGVOA6YzPcs1ekwNw-1; Tue, 30 May 2023 14:40:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 55FC21C068C6; Tue, 30 May 2023 18:40:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2D07C154D2; Tue, 30 May 2023 18:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472027; 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=9BRH7ZrNSb4xru9M4VnOUEfVp5yJ3S6DwScW9Xb9j8g=; b=IAKNBE0uY3bC4o/JbiveJ0tMpY1cgwihISQNuuZIbgd8QHc2yeKNVWlziGSddXS/yb5dhF l3Cql50CFXssTfIxrhoX9zTMcfeFEzBlVmDQJEghAononBs2zIFKOC2IkWRq4vc/PGcwW1 ozMgTcokoI0S6/9IJ0oCMbgRveUeq1k= X-MC-Unique: iA0BjsGVOA6YzPcs1ekwNw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 16/20] migration/rdma: Split qemu_fopen_rdma() into input/output functions Date: Tue, 30 May 2023 20:39:37 +0200 Message-Id: <20230530183941.7223-17-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472126894100003 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. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/rdma.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 3ef35fc635..606837bd45 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4046,25 +4046,22 @@ 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)); + rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); + rioc->rdmain =3D rdma; + rioc->rdmaout =3D rdma->return_path; =20 - if (qemu_file_mode_is_not_valid(mode)) { - return NULL; - } + return rioc->file; +} =20 - rioc =3D QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA)); - - 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; - } else { - rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); - rioc->rdmain =3D rdma; - rioc->rdmaout =3D rdma->return_path; - } +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; =20 return rioc->file; } @@ -4090,9 +4087,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; } @@ -4217,7 +4214,7 @@ void rdma_start_outgoing_migration(void *opaque, trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 s->rdma_migration =3D true; - 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 From nobody Fri May 17 11:59:09 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=1685472238; cv=none; d=zohomail.com; s=zohoarc; b=FZMbrp0jWrchyBH06Xm9nQlu+GaMh99kC21OY6OC2QKvsDYFlprj6eNJeETQxIla09Sjvn9VZRFWrrgLCK8RXKmsAddxuhB5zRxYXJGnaDQFJs0R/mldzxE3ksEfU0ftjXcnhk7nl4ADV7XmxgJK2xiYUFaGJWMjZJYKuzrvQg4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472238; 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=NQnQw2s+9RRrMMBT9+0GKoH+btHmqaTjHpbiTnyDYHQ=; b=DpG0SC0X10+LRX8F+7tWzMYzvZHjS14bjK1fz0BH27g1fwAyk8q9y/tdLRwKB55UHTW/rCav4U6hYAXg6ZdtxSCWIrLx5Ah7gM491EyucSKbL9lTU2p4Iz1oZs+WJofdo6dMfFme1ym5/WHgMsLeNH9LTYjfM4XgrV8yuuTCLIk= 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 1685472238713618.2517867056827; Tue, 30 May 2023 11:43:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44In-00075z-Av; Tue, 30 May 2023 14:42:37 -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 1q44IX-0006lY-EQ for qemu-devel@nongnu.org; Tue, 30 May 2023 14:42: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 1q44IV-00054o-U5 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:42:21 -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-29-7ZMivxOdP3Cjj00_UTBAAw-1; Tue, 30 May 2023 14:40:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4097385A5BA; Tue, 30 May 2023 18:40:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B3B1C154D1; Tue, 30 May 2023 18:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472139; 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=NQnQw2s+9RRrMMBT9+0GKoH+btHmqaTjHpbiTnyDYHQ=; b=E2Mvg6S2aw5am6THjy1ZOFcGPOQ1NJTO+tZ9A4VGDoDcuZ09JRu5pmAtKhQhl7u6rMl2+i 0uaqKC9QNbfSMk39jWM8bYYQbAsFGF8de5lMxXn0tNSxw4RI/mJtfe+ZuQaIMxGKgHkjD+ koGaSF/K98IzlD+zw2wBXY6ZIIGjKNA= X-MC-Unique: 7ZMivxOdP3Cjj00_UTBAAw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 17/20] qemu-file: Remove unused qemu_file_mode_is_not_valid() Date: Tue, 30 May 2023 20:39:38 +0200 Message-Id: <20230530183941.7223-18-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472239179100004 Content-Type: text/plain; charset="utf-8" It is not used after previous commit. Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/qemu-file.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index f2c118f342..4d5b999fa8 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -49,7 +49,6 @@ uint64_t qemu_file_transferred(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" diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 4f9fb1fbd0..76f10fe5c4 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -99,18 +99,6 @@ int qemu_file_shutdown(QEMUFile *f) return ret; } =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; --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472240; cv=none; d=zohomail.com; s=zohoarc; b=aVXosyU8e+UTWPX4DHByZ3y3r50/rnggCk8H8+PdfjGj/eZp9MC1I9THE0a4RbyRcG+1FG72VPMm5SGHQEbc+zvTtDu1JDJBrASK9WK+iK8zEkEBq50FRS+o+4OysPx+NIXcDHDcqWfu+n5PikYYrTu2cLDzmty+nZ4HcCuAxG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472240; 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=EXOXVgb0my3abuDMefNxroRWrPUx0QI6neZKfEX1Xlg=; b=BmopR1jTi2LUeZycViIdZemyjCgz63gb3Q7Z8bjSK/HgDhWjRZVRzgrBSLi4vv8UNwBJ46gHIWbRCovwlBGj8dRjx228dOaIvAy9GU+Xug0z6SbQ2w3mKS1X82+k609/RxP5jp06N69lqDG7GRknYXVY+PKTDwdbrRD49akz6l8= 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 1685472240453995.516358133312; Tue, 30 May 2023 11:44:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gs-0001Tk-MQ; Tue, 30 May 2023 14:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44Ge-0000lG-51 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44Gc-0004Uj-Ma for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:23 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-U2SA0Hr6PrO5S6eTOPuzLg-1; Tue, 30 May 2023 14:40:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1577C802A55; Tue, 30 May 2023 18:40:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85C36C154D1; Tue, 30 May 2023 18:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472022; 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=EXOXVgb0my3abuDMefNxroRWrPUx0QI6neZKfEX1Xlg=; b=iG9ji9cs4GBiFIiVIANN2IRJV/6LebX20iIOUnVNq1R9o6ebrGY3OVYA5Gn5TEeLElYy79 SMhKvRAEVEdzgjm0q7oC+3V3hnsMiOHv+kIBTAMmQQWXyG4UTegH5797dT2uJHWWJrP0J8 9Jx55BP1JXsftI67D0qAOM4vfZUQiUY= X-MC-Unique: U2SA0Hr6PrO5S6eTOPuzLg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 18/20] qemu_file: Make qemu_file_is_writable() static Date: Tue, 30 May 2023 20:39:39 +0200 Message-Id: <20230530183941.7223-19-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472241174100009 Content-Type: text/plain; charset="utf-8" It is not used outside of qemu_file, and it shouldn't. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- 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 4d5b999fa8..e3dba9f385 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -49,7 +49,6 @@ uint64_t qemu_file_transferred(QEMUFile *f); */ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size, bool may_free); -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 76f10fe5c4..01616d159c 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -208,7 +208,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 Fri May 17 11:59:09 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=1685472047; cv=none; d=zohomail.com; s=zohoarc; b=aaYOfxSGkz0U4quq8/f0mUwUde3AnXuhNCF0q+WaXae5zpWNqSA0P8XrXEA5BoOZM7pZT7apcDZEVvvtz0z9CHJdIWILdniTvy7rh7wxfjUJYUT0pS+yeI+cHySbczIUtqRmQNoHZBVzuTujDdUgNiCfghGbMCTaynEVfttdnME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472047; 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=Q/JTgQs32CuocWsEP1DFUS8PQ26IybTY4KdYejI0Ogs=; b=j3fCahw/Q2UIO3qYJvUl2F5NYa1HJgBmGreUXfmTIbENq8XkzXFBxrI8fNaZDWoIF+1/wjGCxbBMk2KKQqa3V42QE26ZmXZwyMwNEbg5rVpTiHYa74dvC813jiT+SbGeBIMQeInSaog+GfDtUSY0+CGCqMkgDZbQxwI37s2FuiM= 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 1685472047912994.5300743272052; Tue, 30 May 2023 11:40:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gu-0001UO-Ka; Tue, 30 May 2023 14:40: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 1q44Gi-0000ql-4H for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:28 -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 1q44Gg-0004Y9-RN for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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-30-UjYAfn7aO1WM6_DfpEBLMw-1; Tue, 30 May 2023 14:40:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E02C0811E78; Tue, 30 May 2023 18:40:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B085C154D1; Tue, 30 May 2023 18:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472026; 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=Q/JTgQs32CuocWsEP1DFUS8PQ26IybTY4KdYejI0Ogs=; b=IIfFu6CnB6MDtQ1PmZn0ctcTOujRdkmuh8wkygy72t1NkzAsKIOCn4CBPeqj0came45i7o CampBpqJv7bp14IP3xOGIwu37EK/xhdkbnhcRSGpT/spRVkVpuK4l51iH0YX3pHDhGnpWP 9zjXeFG6pvSIN945pFZJ3zhecibMDec= X-MC-Unique: UjYAfn7aO1WM6_DfpEBLMw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 19/20] qemu-file: Simplify qemu_file_shutdown() Date: Tue, 30 May 2023 20:39:40 +0200 Message-Id: <20230530183941.7223-20-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472048899100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- 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 01616d159c..e4923ab3a0 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -62,8 +62,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 @@ -93,10 +91,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 static QEMUFile *qemu_file_new_impl(QIOChannel *ioc, bool is_writable) --=20 2.40.1 From nobody Fri May 17 11:59:09 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=1685472069; cv=none; d=zohomail.com; s=zohoarc; b=kHM+JBuH6lpngGRS5uqWyfNroSlbGzyyhBCdR2s8VmTfd836XKaJsKvphgVMppegQW2taZxelmvCq+MGJZLDSKs+2esYW1L11I2AZCuVW6OSEhJDFBx5jD53Jb//DOefBRjUImXKCPzQWr5LrkwQ5W1hLApo7EUmlw5sNx0/V0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685472069; 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=QeeB5dQi3coD9xZvx54z0l7k8064LXlY91dEakXbBJU=; b=f96UwC4mLXWq9m/9S9DgvmORyaxNLqZjZL3DeDR4c7GS4RnVtDKyWmK2IWaNYAGPV6V39I/V4VYHqsDif3jwY5sXFMmpSYZFsqFhy6oKSI+yEysgDdqPk0A4TqHt4cznMqpI7pcZRg8TyrCPYNFw0yY2Kyf2ojV8WnStqQmtY2M= 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 1685472069008702.6938588032732; Tue, 30 May 2023 11:41:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44Gs-0001Tp-Mc; Tue, 30 May 2023 14:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q44Gh-0000qH-Q0 for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40:28 -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 1q44Gg-0004Xr-Ae for qemu-devel@nongnu.org; Tue, 30 May 2023 14:40: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-580-l4quSGxuNryEdWQ_4_U_Fw-1; Tue, 30 May 2023 14:40:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C37E4802A55; Tue, 30 May 2023 18:40:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E925C154D1; Tue, 30 May 2023 18:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685472025; 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=QeeB5dQi3coD9xZvx54z0l7k8064LXlY91dEakXbBJU=; b=Bq370fCNt7+FAFfXF+inT79M+M+mR3A3ZEG2vZf56Hucprcp7vRqSh87vR66a7JBhCB/15 v1u7S7nYmO0LyKpNlOnJAz/9uNPikfzw8XVtrmDtRchlp2CBf9WjlwnGP4vkv9gLrVb1NE 0gorFr0+DtbqyVyVv71kqe/NeDt7UCU= X-MC-Unique: l4quSGxuNryEdWQ_4_U_Fw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Hailiang Zhang , Fiona Ebner , Peter Xu , Stefan Hajnoczi , qemu-block@nongnu.org, Juan Quintela , Fam Zheng Subject: [PATCH v2 20/20] qemu-file: Make qemu_file_get_error_obj() static Date: Tue, 30 May 2023 20:39:41 +0200 Message-Id: <20230530183941.7223-21-quintela@redhat.com> In-Reply-To: <20230530183941.7223-1-quintela@redhat.com> References: <20230530183941.7223-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.167, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1685472070257100007 Content-Type: text/plain; charset="utf-8" It was not used outside of qemu_file.c anyways. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- 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 e3dba9f385..1774116f79 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -66,7 +66,6 @@ bool qemu_file_buffer_empty(QEMUFile *file); */ int coroutine_mixed_fn qemu_peek_byte(QEMUFile *f, int offset); void qemu_file_skip(QEMUFile *f, int 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 e4923ab3a0..c06a7bed07 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -138,7 +138,7 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc) * 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