From nobody Mon May 20 21:31:18 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=1685449783; cv=none; d=zohomail.com; s=zohoarc; b=ONrWmYho6N3hIiKKTH5nu5/3+L3qbyYBZy7vsK6+SEqHFSPl792rnQaJAs44I7B9zofl+CWtZITdQZP2mQ/H4XooUAW/7x73h1M26kbSeRRY/EA4vvBnHxCD0+t4VyfBVCDC/tQNLktD43m7Khc9PQ+1gfEdrdfLfoANf1Up73Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449783; 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=7hLL6zgWaW72VnV1iDZH5rMDjlhJtnoEYSkFj+6Hg3Y=; b=gGPVacBdVK5fR0V46k3TJhjmDzjfxB6bWC25Vgi8dz2XZDEAqvBojja71gf/U1s669SozGtJgxrSqF6wITsiTNcyZaFutytxxBXc/MSMsqLLiV24zsVeAqQ+Jq/oQdPDz56wlQCo+/jz4rvuZDDOAxgUq6uPJb2VAdFnKI40Jug= 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 1685449783595805.7606021358499; Tue, 30 May 2023 05:29:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yTH-0001g5-8L; Tue, 30 May 2023 08:29: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 1q3ySf-0001L7-5B for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySc-0000e5-Ac for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:24 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-98-F7T2Dca8OBaeGb14GjG26g-1; Tue, 30 May 2023 08:28:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3F408032E4; Tue, 30 May 2023 12:28:17 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80F5740CFD46; Tue, 30 May 2023 12:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449700; 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=7hLL6zgWaW72VnV1iDZH5rMDjlhJtnoEYSkFj+6Hg3Y=; b=RH67xOt7Q/iVmYSVyOk8HlU1+jcEr0LBgWETbeTkkgizTtgEaAuKKu0S1rEKn0B3pifdn0 wXQDJCo7e9zOy9yFPyTQliuiyoY+Lu/5ToRgbxa5LMO6JEwy6qQBglUOdAhiKuzWBWtK1h XWr5SrSkmz2ZBLa4Udepl2sBcQX7iHg= X-MC-Unique: F7T2Dca8OBaeGb14GjG26g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 01/16] qemu-file: Rename qemu_file_transferred_ fast -> noflush Date: Tue, 30 May 2023 14:27:58 +0200 Message-Id: <20230530122813.2674-2-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449785188100002 Content-Type: text/plain; charset="utf-8" Fast don't say much. Noflush indicates more clearly that it is like qemu_file_transferred but without the flush. Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Mon May 20 21:31:18 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=1685449967; cv=none; d=zohomail.com; s=zohoarc; b=LPPrVw6wswZqXU2M58RL7P1x9DFI0PL5w8sDnNxSmjPolRLC9gcUMVyGEqgCFKWoL/FXF+ziCSvLZDn/83WrwdJoLQj4v9RpBEY1QK7lleAz0yswG2DRMG/UYCck/ikHo4zeBuyRL1JpLzIKoliYyXy2BOepOsbwBfkvK2bSFy4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449967; 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=zFgGTRzGfhCURle2CPDKZtUjAwep5ESftv2jFSKLG80=; b=PbgUPjJGebYuklztSmqIOad+kidIUDXkimAQWYjPsGx/3UKe2xpk1izrWuuUTQAy5FIVCdNnK34W4VSlRemcatH1lktsP9MnTTd3Lhenk0GYKo55+K//4kt15TLo7Pw38Rd4LEgu8Ita+hEPc/KYeQT0uEx2UKIoLdJguplWOZs= 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 168544996716161.35690074923616; Tue, 30 May 2023 05:32:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001ST-50; Tue, 30 May 2023 08:28:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySi-0001LZ-AF for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28: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 1q3ySf-0000f1-Ri for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28: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-160-1UJK1z8UPma_3_iALAtZIQ-1; Tue, 30 May 2023 08:28:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 988FD801182; Tue, 30 May 2023 12:28:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 383E240CFD45; Tue, 30 May 2023 12:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449704; 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=zFgGTRzGfhCURle2CPDKZtUjAwep5ESftv2jFSKLG80=; b=JU/LVa4HHX/nujP5xj0KpcYH6nsD79gWY3UZR7FocppGiAsYPTxJHFpVE988UupZYRN/xc Elu8bKkF9kNg40tRAoQRCNvSxU1Fgm+jPvS3MJHVJJIbAgpxQQCv/r37cCYBaLthXB/RCw DCV71E92FFmPp+ztkFqIub2YPDQ8NR0= X-MC-Unique: 1UJK1z8UPma_3_iALAtZIQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 02/16] migration: Change qemu_file_transferred to noflush Date: Tue, 30 May 2023 14:27:59 +0200 Message-Id: <20230530122813.2674-3-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449968137100002 Content-Type: text/plain; charset="utf-8" We do a qemu_fclose() just after that, that also does a qemu_fflush(), so remove one qemu_fflush(). Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Mon May 20 21:31:18 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=1685450031; cv=none; d=zohomail.com; s=zohoarc; b=Fh7uFfygp2pgl99e8yPBEGIkegu4PyQGhzh4bIBSQ8jmj5cXbBKWsHJ0OTL+OOamJOzRUkrPDn+Awgwz5tu8qQ+NplbzizjxOC7KHQHWnkLmoIX2l/rEsaFveDe3tuW87pGb88d2gOaOdoCPjnINT+JUJLSo0h5gcpMZleu0RGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450031; 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=4qCFY8+/+m7rOhewGH2kOg0mpy7GBOwqRfnGal3TayQ=; b=EcVNAHR8fdGxwtE+oDsbn52BWGKIK4hpB/oVEHkW2S0BXnp/B55vjbq+Fc1iwJJDxUHwcENHGRA1Ls3g9AmwxwC8V7FEzkZK3lBPyWj3Anwe2RuK/fr2HHwkuCXOCjWU9ZN/wfAszSqX1rbnYzHGxo0XiAGC8+D2s1ymHtjFeUA= 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 1685450031631246.2648820587293; Tue, 30 May 2023 05:33:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001SM-4R; Tue, 30 May 2023 08:28:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySm-0001Lt-4a for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySh-0000f7-46 for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:29 -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-358-jCz1VMwEPl2bwMubSrcxZg-1; Tue, 30 May 2023 08:28:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49D6E3825BAB; Tue, 30 May 2023 12:28:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEB7740CFD45; Tue, 30 May 2023 12:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449704; 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=4qCFY8+/+m7rOhewGH2kOg0mpy7GBOwqRfnGal3TayQ=; b=Cu8pQCDb4yJtGI1t+AnAahIcdqfCMS/FMQJpYwCp39uJbDsregHT+lNKVR0Nxb1DaLlE3q lZBiCWSpplTSEeLkkeKAWHkgpiYF9Mrwc7E6WOHtQFeZr7EZhOGcUtQDFja+fjnTYVCyob elrw893D5fBhoYXpwuEsOMcMy60EuHw= X-MC-Unique: jCz1VMwEPl2bwMubSrcxZg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 03/16] migration: Use qemu_file_transferred_noflush() for block migration. Date: Tue, 30 May 2023 14:28:00 +0200 Message-Id: <20230530122813.2674-4-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450032548100002 Content-Type: text/plain; charset="utf-8" We only care about the amount of bytes transferred. Flushing is done by the system somewhere else. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- 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 Mon May 20 21:31:18 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=1685450051; cv=none; d=zohomail.com; s=zohoarc; b=XfIvoXdMuIiIxlnQ/Xgj5KCUgQvlUTDMnsrjzW5EZBQK7lifi+5ucOqtuO5i7acce2Bugq27Fepp/TNdZxi8eQWqjSKrvF8U81OOCrw3iO5Pb+HPY0KN0UjZ1oqc2C8GJO6rYnMIY7DoWg7Y4RvXwQfY9F+AMze4iPj6LbcIer0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450051; 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=M56eFowLFlHdg/kgdTQ9K+fHVrYtrKWrwr5Szf0KV1A=; b=TSsWWB0WlQf/orU/5Df9oI8lUWYYCXjFsAQsFENhBwkADPSClEo92FPWd6Trl3Dv77MRJFz1IrcHblFjY5560iYG690+ffeSHuoovK68bTWhEGLDzj9PgAPnzaa77o7xKgsp0yTCNJLe/a06DKP4nC6mTkYvjjB97N1SOQ2iaLg= 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 1685450051781967.7420795741073; Tue, 30 May 2023 05:34:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001Ts-PW; Tue, 30 May 2023 08:28:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySp-0001MT-SE for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:41 -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 1q3ySk-0000fy-0A for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-81-fFGMcCe_OdKQ3UXrDHhH-g-1; Tue, 30 May 2023 08:28:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1ED1F101A52C; Tue, 30 May 2023 12:28:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 904C840CFD45; Tue, 30 May 2023 12:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449707; 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=M56eFowLFlHdg/kgdTQ9K+fHVrYtrKWrwr5Szf0KV1A=; b=RF0mKLiSoNj3uNSxEKSKxNcaUpTX86Way6lWtiG3JXnongvFFzR5tSZiCG7mfDNxVXIRum /41ccqOoyvYf729p25E0pwqmDg5lRl0Kj3UA7Yxp5lAyNyvprDpRLyrcQoZuwK+npWUAFZ FrXJHdjUTLLrBpJBUhuJi4qTludstO0= X-MC-Unique: fFGMcCe_OdKQ3UXrDHhH-g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files Date: Tue, 30 May 2023 14:28:01 +0200 Message-Id: <20230530122813.2674-5-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450052658100002 Content-Type: text/plain; charset="utf-8" This was the only caller for read only files. So change the test for an assert in qemu_fflush(). Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/qemu-file.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7a5c1a5e32..38984504ba 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -272,9 +272,7 @@ static void qemu_iovec_release_ram(QEMUFile *f) */ void qemu_fflush(QEMUFile *f) { - if (!qemu_file_is_writable(f)) { - return; - } + g_assert(qemu_file_is_writable(f)); =20 if (qemu_file_get_error(f)) { return; @@ -363,7 +361,9 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMU= File *f) int qemu_fclose(QEMUFile *f) { int ret, ret2; - qemu_fflush(f); + if (qemu_file_is_writable(f)) { + qemu_fflush(f); + } ret =3D qemu_file_get_error(f); =20 ret2 =3D qio_channel_close(f->ioc, NULL); --=20 2.40.1 From nobody Mon May 20 21:31:18 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=1685449906; cv=none; d=zohomail.com; s=zohoarc; b=kg1U2C/h4aN19F2NUE+Z3nsyoVVeNvc/B6KQkKMmg9/IJ0BVApQQVIInYd+SZUS6gVDvJRWlz3m1bpgXV4PDxIyagm1EhKN+Uce4rNvIfjx+4DOTsSgJ0zxw+i7z6qfd6rBqDgxN7GopuqLLdgJ8M5Mxz9ugd1ZXvuAKWFXK+A0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449906; 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=QRtgCokLxlMoeW0y14J1huOV25q24XINE+YvHmiPK60=; b=WO6k+BO01j8/FQHSu1yIbWf1ga/o7zSUKMV1xrRccI+cn137lzb66JinGM7aoRhLUgEXPmbfReYiI/OhR+ksScLGOTXopmk9O5RIuzFg9g2bJcrVI+EaBwJ+uK1U7zJUjZMd34ZRFwDppp+fOXKJc17yHAJRJt2nHtj3us1lmr0= 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 1685449906035704.2316700862265; Tue, 30 May 2023 05:31:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ySz-0001UJ-CJ; Tue, 30 May 2023 08:28:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySv-0001Qu-MN for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySm-0000gX-0w for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:37 -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-540-cb0FhRGzPL2am4MFl68d2g-1; Tue, 30 May 2023 08:28:25 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C51B23825BA5; Tue, 30 May 2023 12:28:24 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6543E40CFD45; Tue, 30 May 2023 12:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449709; 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=QRtgCokLxlMoeW0y14J1huOV25q24XINE+YvHmiPK60=; b=BhDpounnlwwa8EQ9jtmGyfpGjqNHu9IzAxKh9vTFYDkfFU9vB5xUAh8lHp/X6Zs5Zr8DOu wyT29bA1NXBK2wN/rFWB7mUMs419VvcuJ8flAJFnvgj54pEagkNsMEnnhDCThLneNgIyTA S5HIWy8eF97iif3dCJW6HUqWywilTUQ= X-MC-Unique: cb0FhRGzPL2am4MFl68d2g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 05/16] qemu-file: We only call qemu_file_transferred_* on the sending side Date: Tue, 30 May 2023 14:28:02 +0200 Message-Id: <20230530122813.2674-6-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449908283100006 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 --- 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 38984504ba..5ff3bc40fd 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -340,7 +340,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 Mon May 20 21:31:18 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=1685449906; cv=none; d=zohomail.com; s=zohoarc; b=EerHS17LlXHOp3USKGU+SXm8Z6jDXIIuH9kqtqKzmmmIRCXrNd/kscT8cmXfiIxqoDN/yUUHaHoCN5EDlZx3Yl1vCrL2TPYiX9I1Z+xUqY/L32b5RRvtmy2B7yMig+C57p02hPLgUDqyLQ1WfWR5q0drQCFj1WY24CDsDGbYG+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449906; 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=VDtFey+ZTmtNcB+HUHyNurCy6qQRYHksRYSDgfGv/Z8=; b=ak/ffwwJI+bpbTs3x0bydaaxnL5HsvG2/9fTYOr5PEk1pU1brOVFObrjah4Dg/Eto4tR+0cdqATN17ukAzWlXNDi46Bt0zEMRCqnX44AbnfmAZF/vgPD1Tx/PAH22ae203Mx4c5jrvHOjb9sqJniJStRKsQ2p122ES1fRJC9a24= 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 1685449906565973.8798859646589; Tue, 30 May 2023 05:31:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ySz-0001Ub-J1; Tue, 30 May 2023 08:28:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySs-0001Nk-Rn for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:41 -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 1q3ySl-0000g9-HA for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:34 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-673-VtoWSckxO82GEpYgbqZClw-1; Tue, 30 May 2023 08:28:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 78BF1811E78; Tue, 30 May 2023 12:28:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1768240CFD4A; Tue, 30 May 2023 12:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449708; 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=VDtFey+ZTmtNcB+HUHyNurCy6qQRYHksRYSDgfGv/Z8=; b=LMHEKXfsBE/wnBbei+73s5NBchdgEoc2tmvI5p+Ojm2xR7+dBwlrk4mZDc3nBkW6+PyXg/ i3zLUI5LVOrAniUD654ExAQ520cQSBDQrXzLsv/SnqnkY5djsl+uagWDopfRA8DYD+whZm trpOdQEzustl5iXb5FTuIwb62ZcNnxM= X-MC-Unique: VtoWSckxO82GEpYgbqZClw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 06/16] qemu_file: Use a stat64 for qemu_file_transferred Date: Tue, 30 May 2023 14:28:03 +0200 Message-Id: <20230530122813.2674-7-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449908280100005 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 5ff3bc40fd..ac7a303142 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -286,6 +286,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 Mon May 20 21:31:18 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=1685449955; cv=none; d=zohomail.com; s=zohoarc; b=aPG0RAzSY9Y4+JD+wW0Fy0DcWgzRLehADkOrZoTRdjMywih2tcwlVC4NjNBI36DL2f/jarJt61rohuPWMCF9aO2Nzlti9aWrgoIJ45NvJC3MTHG9NSwUe2LGgp5w5GnjFPNwEN9ErPpskFunUYfTA+JlE5EOZ6ic/NlWV5zXRe4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449955; 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=9KXc7hIvY8BaaANDRggV33+T6WZoQY7XTE5eKMsb++8=; b=S6JPmB2c+lcQnmJDXvvj29N/fZqtnubnzfseAalgr0BDrSWdtQCKTqFpoP4LR9ryVRZjaqWz3x3egg3eM3+/CVdOGKW++dkaerZM1Fy236m3Zy6DlyroKs6l3AI0roLPOQufqOuWXoXmUkYgLJ8S84MShmP7aRwnfNk4GC9sKXQ= 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 1685449955057682.4333177469931; Tue, 30 May 2023 05:32:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT2-0001XO-Ky; Tue, 30 May 2023 08:28:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001SP-1D for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -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 1q3ySv-0000i4-ES for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:43 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-48-Fj9GxWLhPHue7RlFWWpRcg-1; Tue, 30 May 2023 08:28:28 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3006A8028B2; Tue, 30 May 2023 12:28:28 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id C068840CFD45; Tue, 30 May 2023 12:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449714; 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=9KXc7hIvY8BaaANDRggV33+T6WZoQY7XTE5eKMsb++8=; b=LUPZfkQ6LM2WGHLTu27vyqXPjjjbaByofStCqWwMQqv/0BFszkH95Vvf6yV8qbJeWoOEo4 3r+p4WCR46snyzK2z1hASZNn/l0ksF3lxSv5re6UL+ePXpMnFWyKshbu+XlMeWUwN9+5Mb s6Vhir1fjjBdqXuwB0Bqod1rKupdBHw= X-MC-Unique: Fj9GxWLhPHue7RlFWWpRcg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 07/16] qemu_file: total_transferred is not used anymore Date: Tue, 30 May 2023 14:28:04 +0200 Message-Id: <20230530122813.2674-8-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449956086100001 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 ac7a303142..a8420dd734 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]; @@ -285,7 +282,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 Mon May 20 21:31:18 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=1685449954; cv=none; d=zohomail.com; s=zohoarc; b=cJKKd3H+a/PZkb4GjFjQoYHd1sl0Gs91nNgJD+zFvQZEdl5vPLAl64oHGDppahzLhSx8w0FRuSeuXSiCAW96NSz/EE8EQWQDxnm3LFMCeECOWLqEmqeSV4L488uEBpw+SRvuPFKy/5mXZTyc3cDYal1Ug8lTWLxaGL5Yyv3n+W0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449954; 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=SlCj01oUNXs+Y3Ink+JBCSJHatIvhGRD1Fu3tnPZ6vqazMEBYRCTFEtCmdvAtEk/aaS9ZVmDQ/fJP6J023q0WlTqbZj1YNBiBoe1USl7+Lk16Yp/cHL60+wv/4IyU10ID+Lvp4ee//3vcPeJVkcavwUtmKmFnxS4S7tfmyN0Tcs= 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 1685449954987220.06831722542915; Tue, 30 May 2023 05:32:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT0-0001Uj-5s; Tue, 30 May 2023 08:28:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySv-0001Qq-LY for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySn-0000h4-PW for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:37 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-I-2gFNppO2aKHow7ynQwBA-1; Tue, 30 May 2023 08:28:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D92A58007D9; Tue, 30 May 2023 12:28:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 794B340CFD45; Tue, 30 May 2023 12:28:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449711; 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=cqJXw1y+eqXsbQAYbw7Nat5gA3r9Z54AMReIYeeG7RnPL4nH7pT4RWQuPOhNOdyQI/u1Ea jeeIDpi1/NeLcsqhHyqCjGn23ZwDomj8MXfdpBqAmo3th+522OWdCyy4FzNZl4kGgaM2VJ D1dyVbzBKAPFizK/AnoHl8kKaHZf1Hw= X-MC-Unique: I-2gFNppO2aKHow7ynQwBA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 08/16] migration: Use the number of transferred bytes directly Date: Tue, 30 May 2023 14:28:05 +0200 Message-Id: <20230530122813.2674-9-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449956151100004 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 Mon May 20 21:31:18 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=1685450035; cv=none; d=zohomail.com; s=zohoarc; b=VOqjRoslecHtdK5jyYw01ZIj/sbBZnWzZaGVKkhNJkV6F+uIUmsBiTr1e9mG2C8IpKQ5JpixuYE/WaOypaqR4i1fCSEZU1hRscbKcyf8lV4bgpgUxh5+BqlWau9xiGFyujizqU9FPxj0Mwi53NhQz+PIKWHXIGtwMEEh7G2i+9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450035; 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=Jsu5TgJNVrUJXO0bXsXrpThzVU0kVpMTORXps14yM+g=; b=gX1fAvZkuXbIBL0wruhbfRAcWg/TMCZO25g6eINf1RERGUIDZ8foXLzqWOhQ4S5ZKBLRWDJtPOd/Jwc+6NSXeAAQcLyyuyDRhATaPOq9nKvpxSnEA9NAGUIWTmzcdeQ7ZGN4IHZnql4z50LLLMBL4cvFpspDKhlVDMPHvJVkAn4= 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 1685450034993231.38111398230262; Tue, 30 May 2023 05:33:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT4-0001ZE-CT; Tue, 30 May 2023 08:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001SS-2I for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -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 1q3ySv-0000iZ-CZ for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:42 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-304-Q3Z7xb8kOtiC73yEpIWwUQ-1; Tue, 30 May 2023 08:28:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C44A185A793; Tue, 30 May 2023 12:28:32 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B95340CFD45; Tue, 30 May 2023 12:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449715; 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=Jsu5TgJNVrUJXO0bXsXrpThzVU0kVpMTORXps14yM+g=; b=JvFv7D5aNZ4ropO08kgSi7I8yFCNT3t/RsAQ9lP94slF1/o7eYNZAeqeMgILw+DD6g2Zof 7ICnXaAsjCr6VUoeKlwFrRtqojLo5fI9pknPsetK0TlLHql+iSmP7Sl0CfWekLMOcwJAxq cPTvVfUN0k7oYksNOrs35WfpVgEdYK0= X-MC-Unique: Q3Z7xb8kOtiC73yEpIWwUQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 09/16] qemu_file: Remove unused qemu_file_transferred() Date: Tue, 30 May 2023 14:28:06 +0200 Message-Id: <20230530122813.2674-10-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450036981100003 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 a8420dd734..2da092ab77 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 Mon May 20 21:31:18 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=1685450030; cv=none; d=zohomail.com; s=zohoarc; b=O79OpEIHQaOrIXyOmp95eY7S6/5IZLHofuKegoiBzd//FC1ma+t16PlEnDNbiB53guhl2Gg1AYEFbP3/6qbl4rZCw2p9ccx4XPzmpJykmTHeS77Zrej6HJjKDGlyQbHFUCuaMNTWmKYj96WYjfHIz0AhiS3jC+3XhdQ5EQgDCkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450030; 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=K1WSwWaMSTduaL5zhG+ggnr7CY5C1uzMgTqkV4rCW64=; b=SWD0CgUnDI4PoSdOlxRXcVGbkPmk8ikYSJetl9c7IfygOBEbUJDP5zLFiQQZdIPHAX/HLcuzR8z1pa7hmp8AaEwC7jcr9uf++A5MWRzANhUipPk15Ditcj8mdRy0ya9ZXjgBqF7yRNh+a50YpZV7m9Q4v1GX7On1LtAzYuFCqNw= 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 1685450030919813.0182710656766; Tue, 30 May 2023 05:33:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yTL-0001ih-2k; Tue, 30 May 2023 08:29:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001Tv-Tx for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -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 1q3ySv-0000kO-F8 for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-100-bJ9ybFKZMPqZfuPvvHUNLg-1; Tue, 30 May 2023 08:28:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 01A5E8032F5; Tue, 30 May 2023 12:28:34 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9354240CFD45; Tue, 30 May 2023 12:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449718; 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=K1WSwWaMSTduaL5zhG+ggnr7CY5C1uzMgTqkV4rCW64=; b=Qy7G3n3bsdwsPLN6Sv+cuShh3h9b5bhUSmbMT6JSTnr0XYjkj423I4M5Sbb7+bTwG1gMbo UEajZ9XSHvisYwL6+52pvl16iaHhjiCMHkwudcvYzBikGBB35JwqNcUdAKXo9WpD0q0DqI iogxBIimclJbRD3+HBOW4tMZs3FrJEY= X-MC-Unique: bJ9ybFKZMPqZfuPvvHUNLg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 10/16] qemu-file: Remove _noflush from qemu_file_transferred_noflush() Date: Tue, 30 May 2023 14:28:07 +0200 Message-Id: <20230530122813.2674-11-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450033000100007 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 --- migration/qemu-file.h | 4 ++-- migration/block.c | 4 ++-- migration/qemu-file.c | 2 +- migration/savevm.c | 6 +++--- migration/vmstate.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index b4fb872018..3575dfa5ff 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -34,7 +34,7 @@ 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 @@ -42,7 +42,7 @@ int qemu_fclose(QEMUFile *f); * * 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 2da092ab77..a3d0412b5f 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 Mon May 20 21:31:18 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=1685449787; cv=none; d=zohomail.com; s=zohoarc; b=QqXRCSgl5ASbyrKb9LNOENgf6c8qkrG37zjfEDDNTA/vf13ntvd6RcJSchhFLkhiW3mRWq9+VZ1lOCqncJOKZj1VDt5jgvA9uziJDj8UHGUW+iubkjqaadBDhcEOMo4z+Ns/yvXO+kcdn0pmBkzWpjLUQT3+qirwHorega3wdsI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449787; 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=cL/0U57kkRIgivtOFW7jOzbBjF+YL+aWLufgO6oHXKQ=; b=ax5PbXOdJw217y728vNmeejBNuQAW4R26ORQBfjAS/RjmrxhhaEoPC4fxSLRkB/MlnHxt2J+lb+cs1svYbvV83OMqqlKXCelJFqmXD/AV+HNzpMdvvC9WvSbPGVm9odsP+D/MyZBjAdcK/F9/ti0bIq9MVeMpguOHhNj49nZaSI= 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 1685449787351471.7280526712559; Tue, 30 May 2023 05:29:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yTJ-0001gu-6o; Tue, 30 May 2023 08:29:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001T6-93 for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -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 1q3ySv-0000kx-Eo for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-542-2p9NOXE_N42jYYln0v0P1w-1; Tue, 30 May 2023 08:28:36 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AEA27800969; Tue, 30 May 2023 12:28:35 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4912740CFD45; Tue, 30 May 2023 12:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449719; 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=cL/0U57kkRIgivtOFW7jOzbBjF+YL+aWLufgO6oHXKQ=; b=hLWtnmbqkcLh4lIF2ZlW7iuh95tKaEH2flQWi3yzCVKJ54ZIeau0hB7IFdqmztKKzGzSdM Z3ejANA1Ru70CvY9YG79ccxQVGUVDJ2RpqiCD6l/mS6UwlCtiP98Rp06MuwnnmSlObZBzT Ky6ceenPu4GRvdgJoJtyKYXNGrLUKkI= X-MC-Unique: 2p9NOXE_N42jYYln0v0P1w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 11/16] migration: migration_transferred_bytes() don't need the QEMUFile Date: Tue, 30 May 2023 14:28:08 +0200 Message-Id: <20230530122813.2674-12-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449789302100002 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Mon May 20 21:31:18 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=1685449792; cv=none; d=zohomail.com; s=zohoarc; b=EnTY9MaUflRpXfHXzXJWp+6lTdi+yiQYF5gBKNUe0KfBLSP5XpYaZys1GJhCo0yYGXGb3FJfuHTYNhMT9uPQWd6rEacOVY/q+6Zj95vQQ5vi7a12IU8sYVRXu90TG+d+HKnFu+db8ugkqqhyq3qMFrWDIIzlGxxALJDhZ8Ogywg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449792; 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=N9n/azO1ejXnUZjh9UbQIWQFdiTsbqyKPWvih6P+jZM=; b=g7fDve10kJTZIU+hfAHebl7dQkhi2Qdr/obpe6C1XDBI1roQXZ1g1W+LneaC+ipU9dK9qM5RHThPCYNRc8WhyqHTplO1UJqpORDDcNmOMpJan03UCas6ra6wHKRtHcsdnKng1vDXOvRvcZKj5jJTFl5UBdefgK1VG5poWcrAUKo= 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 1685449792658580.012680735689; Tue, 30 May 2023 05:29:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yTJ-0001gy-7k; Tue, 30 May 2023 08:29:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySy-0001Tt-Ph for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ySv-0000kv-Eg for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:44 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-665-aiu-2T4_P7CYiErEfvvIOQ-1; Tue, 30 May 2023 08:28:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6ED52101A531; Tue, 30 May 2023 12:28:37 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04A0E40CFD45; Tue, 30 May 2023 12:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449719; 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=N9n/azO1ejXnUZjh9UbQIWQFdiTsbqyKPWvih6P+jZM=; b=A6NanEMwVB/Wij4P/aSUSibSYQ/hJkrnitWF6WobyMGPMhz61+y8OEoHCXSKj3GN7R5ReS jfn/OULERqtm7DcxRqMASz7pjebvo7oRKox9A+lDrjj2/JAuT3MI7iOWtGu3UNyOgv3Hdy HAQNR4rqxaWMWks+TJjjNl1Nv0D8tWY= X-MC-Unique: aiu-2T4_P7CYiErEfvvIOQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 12/16] migration: migration_rate_limit_reset() don't need the QEMUFile Date: Tue, 30 May 2023 14:28:09 +0200 Message-Id: <20230530122813.2674-13-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449793123100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Mon May 20 21:31:18 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=1685449756; cv=none; d=zohomail.com; s=zohoarc; b=V7rxPyZREvFNj8XRbEdH0vEkexx1qtH+1ipdqeIXo/9QY3HwouwrLbWbuT9j/sDRn2eb92+HSuelufW7k5iCbkHfPHriGNwTW0CKJPOuNZnxfgemsUfIHfC3w7MjOx9SeoCmc1c44fVuhqcQgcGGHn4l+FLJYxIj4fK1w2x35Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449756; 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=oyifBfvyqk2KlS8dEBK3QaQlzwx6IL0Wp3YOHipJHSI=; b=g1dxwiUB4wnei+oERVeE3vMNFrWlPt5lUNW03ZF5EK6oDNQ59TpNAw7fYSCDr7ZwL/eCJvs9NYfyRu2mv+15XxcCnh+BSnApH8u8i2XdCDJZ6GVqyyKPSCvY8uKCA6r+rknv126StbBeE8IhWUkCv1fuHu5Yi/hHUk5JTkiarAY= 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 1685449756535673.2679339786796; Tue, 30 May 2023 05:29:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT9-0001bi-6j; Tue, 30 May 2023 08:28:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yT8-0001bP-8x for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yT6-0000sS-HQ for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-2TbfHbJCMEGG4SdnakwzXQ-1; Tue, 30 May 2023 08:28:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20939801182; Tue, 30 May 2023 12:28:39 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id B53C940CFD46; Tue, 30 May 2023 12:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449731; 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=oyifBfvyqk2KlS8dEBK3QaQlzwx6IL0Wp3YOHipJHSI=; b=OxiRS3QpIpsT1JmUfeklA4FV/L7ZuOSn0fU9H7GKcViiUc2g+LtAor8kmv4qJ7psxVP9Yz iqEKX+/WLr//kjWSF7+TON/3dGepe+zXhmo2CzxX/QypTcQHzgV0Zno1+UJQ6JByGBsRMa WM6R0FdwDG4GN2FQ8VxB2F2GwtuY3kg= X-MC-Unique: 2TbfHbJCMEGG4SdnakwzXQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 13/16] qemu-file: Simplify qemu_file_get_error() Date: Tue, 30 May 2023 14:28:10 +0200 Message-Id: <20230530122813.2674-14-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449757052100002 Content-Type: text/plain; charset="utf-8" If we pass a NULL error is the same that returning dirrectly the value. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- 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 a3d0412b5f..7cf457a981 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 Mon May 20 21:31:18 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=1685450023; cv=none; d=zohomail.com; s=zohoarc; b=R0YAaBeR5Wk3bXR+Z+tIkgi/vpm4XGCIlKg7kmhvA/tRWHe9Y5KZQHJcC3UHjJ3+hq5A+jDoAPF5btZGQvdzDWkfTVBN5s7q/aBnXuoYZBUoK8HF2VR2AZn/2KS3aEPCAPhfbm515ej4LzjMldam72cgToxziS3D3O7x0aEzv5g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450023; 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=dRasDnLuQUpp5vT0Mcxpnpx0V9WUf7nda9ywbfD2sgKLX1c1CM3JbQG8wbiv6RROiJK/wIYMXG2ht3Bnr/GAWolORFljwb+zwfxzUdm0cBQUHR4Hr5hVkZ3z1Wd9JNBPheKCTBsD82F440WuELFaIEDk1fI4AYdpHteYaLK1rPI= 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 1685450023881268.74144436881215; Tue, 30 May 2023 05:33:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT4-0001ZD-5c; Tue, 30 May 2023 08:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yT2-0001Wb-3Z for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:48 -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 1q3yT0-0000p6-G0 for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:47 -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-249-me0H1BM7NfmCJ5V74Jkd4w-1; Tue, 30 May 2023 08:28:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C86C7858F1D; Tue, 30 May 2023 12:28:40 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66E6C40CFD45; Tue, 30 May 2023 12:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449725; 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=ZYE4HvL7RYWh8J8maKMzIeMF87WDhMch3/v0gPz5g1Wd2qJ4VvJ1S6aIQrurH3Rm6Cj38l HFPdNIosXK7LC9bcWMWeau0k26SWWfQQun93VwFnZKr6e7E1aGy45F7me6KslElloKre7F GpC1LCaaJtkxbxl/bdBYRFPIjNswohI= X-MC-Unique: me0H1BM7NfmCJ5V74Jkd4w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 14/16] migration: Use migration_transferred_bytes() Date: Tue, 30 May 2023 14:28:11 +0200 Message-Id: <20230530122813.2674-15-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450024520100006 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 Mon May 20 21:31:18 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=1685449778; cv=none; d=zohomail.com; s=zohoarc; b=h5zWXOFBEyOaAC3HjiSo48ZQuuQSpHBiHRcF0ilN7pCMrZFeG6yoPM1+DnQTWWYuXYgWJh+b9SOmnvBC+kjP2KMqU5A3DVvp4TiLEhz7nosuz5FiuPtSfAxuCEQRj+WhMK3mYpW/HOefhM7aBV4hnhAWlM8UJ3F8/EkDo8aeMq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685449778; 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=WV6cDFENhndk5PDjvTczaDHPfIbsuDx4yd0IWk3ICdE6IVb3iN1Q9682kKsKrRGBIQvjhwVzDugU7bqIwyLkeNlJkMYN6d2CMWruGjHSP6WAB+gOtngNIg9dcFooJbpx7hJ1NvrtnqH1xe6QOMgEoNEfR+BuUf1iNwVgrtipfpg= 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 16854497781001008.6712833677751; Tue, 30 May 2023 05:29:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yTJ-0001he-QL; Tue, 30 May 2023 08:29:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yT3-0001Z0-Tu for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:49 -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 1q3yT2-0000py-El for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:49 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-480-tMihpy6YN8y4O50JhL07nw-1; Tue, 30 May 2023 08:28:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9CE79856F75; Tue, 30 May 2023 12:28:42 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C72740CFD46; Tue, 30 May 2023 12:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449727; 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=ObTYlSf7rdchpO37eLPbkB3L83PAn7YaoNbTfk6UqNTF+9dr7+Hl9U/Vd6nsjGizfhdHeB MpYItkjlcSI4GnEcVTcRC+YV8SaocxyL65e2SiqLBLHIN1Z1uCqucjUpGJlwUQqMpDnkZi dHM3wvXjBmrXKS43vcNbE3tBJZ+WI58= X-MC-Unique: tMihpy6YN8y4O50JhL07nw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 15/16] migration: Remove transferred atomic counter Date: Tue, 30 May 2023 14:28:12 +0200 Message-Id: <20230530122813.2674-16-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685449779043100001 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 Mon May 20 21:31:18 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=1685450044; cv=none; d=zohomail.com; s=zohoarc; b=lCF6qLltRrOsPgA+ZjbRjU/bv+tqcPMvbKi76oDtN9vnbsCNrcQtElTwPb15xtwvwebMeinBq9JsSW0hrndJKJd9Jwm7sPNR+tp7fFQyR6OqtJKYkaKzwMhI/T30BsRbqXWEQp+vnzib1uU1faOiNKSROXgkS62qd9C0zjyzn1I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685450044; 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=XCAlv2PGkZ7dCIZOlUMqkzGTILQq1mWFxmvnqrzO9UI=; b=Y04sgPvOa2YJJgAGdK8I/SPmaKn/N7ktgu+6xlv9dcF2Tj6XSO6HE+7IOb2iQDuACj+bo8MRUQ2z6ZYqLi5Dwj+8E+wpYueLXhqLaXN/+FS/arMJZyZoB/hJgPCqCoUtIPtzHhxQPs1eSecUKGxwBYZN2RmVQqI+JlZx2glQBIg= 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 1685450044699819.0687745561817; Tue, 30 May 2023 05:34:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3yT5-0001ZR-8c; Tue, 30 May 2023 08:28:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3yT3-0001Yt-KC for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:49 -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 1q3yT1-0000pl-Ap for qemu-devel@nongnu.org; Tue, 30 May 2023 08:28:49 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-518-4WZVDHeoOPux-tSo-owM5g-1; Tue, 30 May 2023 08:28:45 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7539381B48F; Tue, 30 May 2023 12:28:44 +0000 (UTC) Received: from secure.mitica (unknown [10.39.195.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id E053340CFD4C; Tue, 30 May 2023 12:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685449726; 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=XCAlv2PGkZ7dCIZOlUMqkzGTILQq1mWFxmvnqrzO9UI=; b=FLgZBmy8UTxH4jIgFDJMgKIAccmvVhrOrQEskLiaE36ZLAfmyKiAWs6dN+0dhbFc9BUfQO GU/EvIGJeH/IN+u3qwZJ/7cM4yclKUHGOedOcP3PUxE9DCc5OYB9PnDXf9oBSyV7mWsL4V KXj+4pCHqUZv8ak7RZIvt07MoQxSQ/8= X-MC-Unique: 4WZVDHeoOPux-tSo-owM5g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Leonardo Bras , Hailiang Zhang , Peter Xu , Fam Zheng , Juan Quintela , Stefan Hajnoczi Subject: [PATCH 16/16] qemu-file: Make qemu_fflush() return errors Date: Tue, 30 May 2023 14:28:13 +0200 Message-Id: <20230530122813.2674-17-quintela@redhat.com> In-Reply-To: <20230530122813.2674-1-quintela@redhat.com> References: <20230530122813.2674-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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: 1685450045060100001 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- migration/qemu-file.h | 2 +- migration/colo.c | 11 +++-------- migration/migration.c | 7 +------ migration/qemu-file.c | 7 ++++--- migration/ram.c | 22 +++++++--------------- migration/rdma.c | 4 +--- migration/savevm.c | 3 +-- 7 files changed, 18 insertions(+), 38 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 3575dfa5ff..bc9128d333 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -75,7 +75,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 7cf457a981..3e8df20c55 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -267,12 +267,12 @@ 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) { g_assert(qemu_file_is_writable(f)); =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; @@ -290,6 +290,7 @@ void qemu_fflush(QEMUFile *f) =20 f->buf_index =3D 0; f->iovcnt =3D 0; + return f->last_error; } =20 /* 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