From nobody Tue May 14 16:13:52 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=1683200389; cv=none; d=zohomail.com; s=zohoarc; b=bUON8cFHhktNnq2BfQcatFKjR/+pixp0KN/Rz8wIaGf9o11eOvp9MjbkDISN8SrlIWfP2jS1HoqT79Sh99R5uHo6s+8+SmSDAIVT1bpP2ZID3nhbKJyKgACTk8QHMTIpTfdUU8nFrKOulwmakuUQOFEPB2Y+Xp8wh+CngRgBeag= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200389; 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=2LA39jyFu5OpB1kSfLhFb6OryEVC1JN71t+N7vfU8h0=; b=iOgaPyDT1hma0Mov0/Kio0yCh34XA7SnnpLlm8YAz6C7nlHuWHXjUM1sT0QUCoe4XJKLnjwem5pzR7cCTh7qLprdq3R7frZY08JHFHd86M7nmXwQ5I8HFVz0uZZr28Ibr0LrW65PaEqY7ypPQizRuRMULCr3haIpY5MUfvmgKe8= 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 1683200389579635.3158659227571; Thu, 4 May 2023 04:39:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIS-0005wh-Q2; Thu, 04 May 2023 07:38:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIR-0005vu-6F for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:51 -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 1puXIP-0003Ix-ME for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:50 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-630-qEaD6PZqPVK4KA7gTWl57w-1; Thu, 04 May 2023 07:38:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA4F3811E7E; Thu, 4 May 2023 11:38:45 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BF532166B33; Thu, 4 May 2023 11:38:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200329; 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=2LA39jyFu5OpB1kSfLhFb6OryEVC1JN71t+N7vfU8h0=; b=QRquQu17Gyw+PpwL16fKr5cmoM91jad7rhyohrMpdDZNUCRWo2YY049XBDmWSRNs3uc2Y+ 0zIwqN2M3/Jz2cUZnOmanYPkDlpLQtN8FpBoRV6Wy1UwH94+/C1BcXv0U5lMX3uw5dLIHN zktd3aTIoOgOeqb1DVHAN2GHbnvhAA8= X-MC-Unique: qEaD6PZqPVK4KA7gTWl57w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 1/9] migration: max_postcopy_bandwidth is a size parameter Date: Thu, 4 May 2023 13:38:33 +0200 Message-Id: <20230504113841.23130-2-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200391197100011 Content-Type: text/plain; charset="utf-8" So make everything that uses it uint64_t no int64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/migration.c | 4 ++-- migration/options.c | 2 +- migration/options.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index feb5ab7493..232e387109 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2056,7 +2056,7 @@ static int postcopy_start(MigrationState *ms) QIOChannelBuffer *bioc; QEMUFile *fb; int64_t time_at_stop =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); - int64_t bandwidth =3D migrate_max_postcopy_bandwidth(); + uint64_t bandwidth =3D migrate_max_postcopy_bandwidth(); bool restart_block =3D false; int cur_state =3D MIGRATION_STATUS_ACTIVE; =20 @@ -3176,7 +3176,7 @@ fail: void migrate_fd_connect(MigrationState *s, Error *error_in) { Error *local_err =3D NULL; - int64_t rate_limit; + uint64_t rate_limit; bool resume =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_PAUSED; =20 /* diff --git a/migration/options.c b/migration/options.c index 7395787960..2e759cc306 100644 --- a/migration/options.c +++ b/migration/options.c @@ -717,7 +717,7 @@ uint64_t migrate_max_bandwidth(void) return s->parameters.max_bandwidth; } =20 -int64_t migrate_max_postcopy_bandwidth(void) +uint64_t migrate_max_postcopy_bandwidth(void) { MigrationState *s =3D migrate_get_current(); =20 diff --git a/migration/options.h b/migration/options.h index 09841d6a63..5cca3326d6 100644 --- a/migration/options.h +++ b/migration/options.h @@ -85,7 +85,7 @@ int migrate_decompress_threads(void); uint64_t migrate_downtime_limit(void); uint8_t migrate_max_cpu_throttle(void); uint64_t migrate_max_bandwidth(void); -int64_t migrate_max_postcopy_bandwidth(void); +uint64_t migrate_max_postcopy_bandwidth(void); int migrate_multifd_channels(void); MultiFDCompression migrate_multifd_compression(void); int migrate_multifd_zlib_level(void); --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200388; cv=none; d=zohomail.com; s=zohoarc; b=Rs1VymqtOUexnfO+X9tGRBFYZkn7inPsu4bmiLpDp9mJ53aOoz+O+jl52AxeXht3DR1EEunXVeEwCNXz+SET32+bP3sTEgTfD/+CqJSn1geiG3g+iw7HuKzq6AY7z6qwMWRdVBY7vIr+d1yWvJAtpyF/MZuGO1YW5fCgH0BXkbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200388; 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=H/+BOLbI/ZzfDUtUCuJBkOTjQMSEoQDXiRSIlgIq4YI=; b=epuMnxg7M16G2CPkUlE2aOczqhU92643JAeEDTzzeB/e4UbaNd2YwoH2H/KZ6KrRjoA+dTjMQ0obw6ZE7eHirnQD8YzPRK4eEejFm6v8dlb4AbhwuECgYwdcAIUd9ps/HMtkCRsxY3GGhJZqc3TfTZ5AiBzIQ/ixj3NJt+mjtos= 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 1683200388165572.1101791809238; Thu, 4 May 2023 04:39:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIU-0005wt-FE; Thu, 04 May 2023 07:38:54 -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 1puXIS-0005wZ-G7 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:52 -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 1puXIR-0003JU-4H for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:52 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-28-sq0aa12cNPC4wdEpSO7KVA-1; Thu, 04 May 2023 07:38:47 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28373A0F38A; Thu, 4 May 2023 11:38:47 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id ECC0E2166B30; Thu, 4 May 2023 11:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200330; 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=H/+BOLbI/ZzfDUtUCuJBkOTjQMSEoQDXiRSIlgIq4YI=; b=HHhTbMvOvDzRRXzC4qqcT+jO1Olb79paUiEmG8GkFmjr/6TulbnmWkd19ixPu3LSZ0KIUf wVGJK0JVRTbr1BkaUoKrq6xwaVOzmlH3UMVaHXHBSm//3p2NwpFbnT/NcCqNOIEibxlMnW Wo1z2pYL3UCe8RzEMCQ61Iju6SlkA1M= X-MC-Unique: sq0aa12cNPC4wdEpSO7KVA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 2/9] migration: qemu_file_total_transferred() function is monotonic Date: Thu, 4 May 2023 13:38:34 +0200 Message-Id: <20230504113841.23130-3-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200389442100005 Content-Type: text/plain; charset="utf-8" So delta_bytes can only be greater or equal to zero. Never negative. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/block.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/migration/block.c b/migration/block.c index 6d532ac7a2..3499f75e37 100644 --- a/migration/block.c +++ b/migration/block.c @@ -801,13 +801,7 @@ static int block_save_iterate(QEMUFile *f, void *opaqu= e) =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; - if (delta_bytes > 0) { - return 1; - } else if (delta_bytes < 0) { - return -1; - } else { - return 0; - } + return (delta_bytes > 0); } =20 /* Called with iothread lock taken. */ --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200442; cv=none; d=zohomail.com; s=zohoarc; b=mxUKAv6TrLaHwaMmf4Nr4rjrNJQLZQ3hPyHYqKG+Hx/y7iN6F291Mu69rdHkLKvNaavwHYxo6jXDxEuQ3NNBy4g3QL/BwFAUbq5nFKm+RjmI32uCMH5LoUHF0vZsMDG3nGE2a1vcqbEpfqqIJIsBVUF3ibC6TM3nhNNYRT1ZjRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200442; 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=HNYP6gXWN4YEF8JQ67vf370brW7bveMPnAZ0ezFyvfE=; b=k9Y+uVQq+oSu5QinXz7y2NjFDxvnhuCTceWR94Nm3IY5lNF88DpQXJR1Pg9szSRP/yYW3LhOHOWXGvJHaFS8Fby/2ZeLyveffRVk6SuFsq0HUOZpgGL8EodKuqvnRpmotawcrCIQDqc+OfGVpy1AopfzfDMEEDDcpRTYc35H0jk= 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 1683200442702885.059045538008; Thu, 4 May 2023 04:40:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXId-000632-1s; Thu, 04 May 2023 07:39: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 1puXIa-00061X-Q5 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -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 1puXIY-0003M2-Li for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-86-t5uH05mPPrOTWSbUkZLvZQ-1; Thu, 04 May 2023 07:38:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A9EA800B35; Thu, 4 May 2023 11:38:48 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A1DB2166B32; Thu, 4 May 2023 11:38:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200338; 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=HNYP6gXWN4YEF8JQ67vf370brW7bveMPnAZ0ezFyvfE=; b=A300OfMHdwUr79jh9dScq3z9z1mKLrIdZOptiCTltQVlByyUp/vZiLRmqwhc+LM61aBLOU DTXaIJ8vK0PX1JIvWEe6OpxuSwP9wyZ5sqoHPRVHv7wxHZP3/wsAGcuYdlovHvDLrLHTXK TeLROLr6MHq8U8CDiWshMN4IA4XKLts= X-MC-Unique: t5uH05mPPrOTWSbUkZLvZQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 3/9] qemu-file: make qemu_file_[sg]et_rate_limit() use an uint64_t Date: Thu, 4 May 2023 13:38:35 +0200 Message-Id: <20230504113841.23130-4-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200444445100001 Content-Type: text/plain; charset="utf-8" It is really size_t. Everything else uses uint64_t, so move this to uint64_t as well. A size can't be negative anyways. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/migration.c | 6 +++--- migration/qemu-file.c | 8 ++++---- migration/qemu-file.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 232e387109..ee75c6cfbd 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -2119,7 +2119,7 @@ static int postcopy_start(MigrationState *ms) */ /* 0 max-postcopy-bandwidth means unlimited */ if (!bandwidth) { - qemu_file_set_rate_limit(ms->to_dst_file, INT64_MAX); + qemu_file_set_rate_limit(ms->to_dst_file, UINT64_MAX); } else { qemu_file_set_rate_limit(ms->to_dst_file, bandwidth / XFER_LIMIT_R= ATIO); } @@ -2301,7 +2301,7 @@ static void migration_completion(MigrationState *s) } if (ret >=3D 0) { s->block_inactive =3D !migrate_colo(); - qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX); + qemu_file_set_rate_limit(s->to_dst_file, UINT64_MAX); ret =3D qemu_savevm_state_complete_precopy(s->to_dst_file,= false, s->block_inactive= ); } @@ -3049,7 +3049,7 @@ static void *bg_migration_thread(void *opaque) rcu_register_thread(); object_ref(OBJECT(s)); =20 - qemu_file_set_rate_limit(s->to_dst_file, INT64_MAX); + qemu_file_set_rate_limit(s->to_dst_file, UINT64_MAX); =20 setup_start =3D qemu_clock_get_ms(QEMU_CLOCK_HOST); /* diff --git a/migration/qemu-file.c b/migration/qemu-file.c index ee04240a21..b322b363cf 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -43,7 +43,7 @@ struct QEMUFile { * Maximum amount of data in bytes to transfer during one * rate limiting time window */ - int64_t rate_limit_max; + uint64_t rate_limit_max; /* * Total amount of data in bytes queued for transfer * during this rate limiting time window @@ -748,18 +748,18 @@ int qemu_file_rate_limit(QEMUFile *f) if (qemu_file_get_error(f)) { return 1; } - if (f->rate_limit_max > 0 && f->rate_limit_used > f->rate_limit_max) { + if (f->rate_limit_used > f->rate_limit_max) { return 1; } return 0; } =20 -int64_t qemu_file_get_rate_limit(QEMUFile *f) +uint64_t qemu_file_get_rate_limit(QEMUFile *f) { return f->rate_limit_max; } =20 -void qemu_file_set_rate_limit(QEMUFile *f, int64_t limit) +void qemu_file_set_rate_limit(QEMUFile *f, uint64_t limit) { f->rate_limit_max =3D limit; } diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d16cd50448..9e158c00f6 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -138,8 +138,8 @@ void qemu_file_reset_rate_limit(QEMUFile *f); * need to be applied to the rate limiting calcuations */ void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len); -void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate); -int64_t qemu_file_get_rate_limit(QEMUFile *f); +void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate); +uint64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error_obj(QEMUFile *f, Error **errp); int qemu_file_get_error_obj_any(QEMUFile *f1, QEMUFile *f2, Error **errp); void qemu_file_set_error_obj(QEMUFile *f, int ret, Error *err); --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200421; cv=none; d=zohomail.com; s=zohoarc; b=iiQx26YysndhobYSAHHVpn3X2vA/q2c+q4IByPv5RQgOO+tjjOLdYeBtsgmDduXb3TWMCWq9RICDKnUv1TyZg1bHQikN0roxOGdK7Mw/NFTFqTSMvOlULSYRcMbrPuaKRXHpQh5buvH47EwYSK5MYLwRRfZ6+7VAUabaKJtKTBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200421; 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=fBxLXCUKQ1lqm8OSyhhYYOS1mnphvtYRXxmgOCvVVTY=; b=At0M1meKnLga19Z7gLsu+GsLLPEs1SaPmI99fcQs2PDYrsQKJPdvifiM6P1iq469xBMjvTwiUj/0Fyg+Ut6/am8ypF1wXCO28tJG6kkYa/5xmc0vurYitpy4ikHFJ40kIZfX9rZaw8I+glCV5vYBR9stPex8l13z4mrouSkbC0g= 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 1683200421596139.87189913094824; Thu, 4 May 2023 04:40:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIX-0005zf-7E; Thu, 04 May 2023 07:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIU-0005ws-0U for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIS-0003Jq-J2 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:53 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-304-rc3RWV_HOBKuHEXfXu_sXQ-1; Thu, 04 May 2023 07:38:50 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A7BA886462; Thu, 4 May 2023 11:38:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE7292166B30; Thu, 4 May 2023 11:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200332; 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=fBxLXCUKQ1lqm8OSyhhYYOS1mnphvtYRXxmgOCvVVTY=; b=dxhb5Ejp8OD1QRGZfwd4J6ck1mGF0MIKDmzc9n3SaT9NnUIr8+SqmmjaeYBNqwdIRr1ozV kfQXYBcQOc4i7c1JKJ5U+ndNEvnqKh6LJ1HUmA8269tHKS61oMlaPa3K4M3jZRynAoOOmw WDYHKW4vamEN8RkZXZRkamcUtq7vDh0= X-MC-Unique: rc3RWV_HOBKuHEXfXu_sXQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 4/9] qemu-file: Make rate_limit_used an uint64_t Date: Thu, 4 May 2023 13:38:36 +0200 Message-Id: <20230504113841.23130-5-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200423573100011 Content-Type: text/plain; charset="utf-8" Change all the functions that use it. It was already passed as uint64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/qemu-file.c | 4 ++-- migration/qemu-file.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index b322b363cf..5aa990b82a 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -48,7 +48,7 @@ struct QEMUFile { * Total amount of data in bytes queued for transfer * during this rate limiting time window */ - int64_t rate_limit_used; + uint64_t rate_limit_used; =20 /* The sum of bytes transferred on the wire */ int64_t total_transferred; @@ -769,7 +769,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f) f->rate_limit_used =3D 0; } =20 -void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len) +void qemu_file_acct_rate_limit(QEMUFile *f, uint64_t len) { f->rate_limit_used +=3D len; } diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 9e158c00f6..55ef5a2ac7 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -137,7 +137,7 @@ void qemu_file_reset_rate_limit(QEMUFile *f); * out of band from the main file object I/O methods, and * need to be applied to the rate limiting calcuations */ -void qemu_file_acct_rate_limit(QEMUFile *f, int64_t len); +void qemu_file_acct_rate_limit(QEMUFile *f, uint64_t len); void qemu_file_set_rate_limit(QEMUFile *f, uint64_t new_rate); uint64_t qemu_file_get_rate_limit(QEMUFile *f); int qemu_file_get_error_obj(QEMUFile *f, Error **errp); --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200433; cv=none; d=zohomail.com; s=zohoarc; b=nBIDtjhYGTLrw7RvGA2fiP03Jvrzm8v5y9ndZ1VNwO0iczOT7en0o4FPj8mc+TQuds2U1PF/1nEPA0dsc2RZohqGlWg/1VmW5AB1BA4MOVCpgBiG/NAoMRptm+4Yj413Q6CA4CDLxOc3Cz1MK2OWdNQPQsBOvfWppOuMVObY7t4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200433; 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=ugUqXn8zzO3HFtEPqUEUYtCfcqqf0/Xro9sDeDTFtKM=; b=T7+AaVjSWzO2NEcM4pOscdQPzaGA+HqllyQBuXBu1/5T6/WgER+R0IVjYjP2MUIQZhnOuKo6DyYInQz48UWF/A2/VglFLd4qNCyPRJDQFPT9yQ3qzXq1eiIZDJgJdSOorGkGMzFwW7nIJJyc37YcqSGlAdHJA/aP0QeVJk4qQxA= 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 1683200433281100.14839472286144; Thu, 4 May 2023 04:40:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIa-000613-1K; Thu, 04 May 2023 07:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIY-00060M-E7 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIW-0003L3-Vl for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:58 -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-262-ZAvgqIQ2Pg-nqPjStNTXWA-1; Thu, 04 May 2023 07:38:52 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7FF72A5954C; Thu, 4 May 2023 11:38:51 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CDAB2166B30; Thu, 4 May 2023 11:38:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200336; 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=ugUqXn8zzO3HFtEPqUEUYtCfcqqf0/Xro9sDeDTFtKM=; b=GJBpebpDwOFd1wqQd2YfcHBMAshr8ju8i9lx/1gga7l6dpjlGe390kN6Jdt3FkG5BkHSXb kdyMHY7Qy6+uNU+5NUif/dptBSZEcHx7TNhqXoNDc1RUziiKnWWK5RtblGQpwxoA71lBvH 8mH0jhz4QOY9zkzNQpeM+NufYTSHXmY= X-MC-Unique: ZAvgqIQ2Pg-nqPjStNTXWA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 5/9] qemu-file: No need to check for shutdown in qemu_file_rate_limit Date: Thu, 4 May 2023 13:38:37 +0200 Message-Id: <20230504113841.23130-6-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200434072100001 Content-Type: text/plain; charset="utf-8" After calling qemu_file_shutdown() we set the error as -EIO if there is no another previous error, so no need to check it here. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu --- migration/qemu-file.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 5aa990b82a..771aba7369 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -742,9 +742,6 @@ int64_t qemu_file_total_transferred(QEMUFile *f) =20 int qemu_file_rate_limit(QEMUFile *f) { - if (f->shutdown) { - return 1; - } if (qemu_file_get_error(f)) { return 1; } --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200422; cv=none; d=zohomail.com; s=zohoarc; b=ENW7+gho3q9H82LkooLRsDfcNodnV6Qv9BlRh0MSuGLCqZHYveZNeqK/UIozpXF5Y+G5y9oeCJWqk+vRB4vIRms+rPmt8exBFNCqfJZ3PdpZ/HfwAUTSuIPXosKQ0PMu2wpare339/zv1695r6+SSp++ajcfSTbtK6vSaPeMIJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200422; 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=zPjdX9HrhoF9f4wyXV9lCrCfM561XXgGOBZEPAW9fS8=; b=mJxUTLpwMARjncolDumxdE1MJ+2DLENWS5Lm228a3QqzcvUOUd3Wv+xYghZgFpReWRExvsAkJqykMpCQck210exMLIT75wIC1hPwKwaWSKPkx8gqb+DtLd2sMhsPshVTBHDNIbElc4t+fJzcUXZy8cy8BHIuQL7R7x21T4iSLo0= 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 16832004223156.567830108196972; Thu, 4 May 2023 04:40:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIa-00061J-EL; Thu, 04 May 2023 07:39:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIZ-00060q-EM for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:59 -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 1puXIX-0003LX-Sj for qemu-devel@nongnu.org; Thu, 04 May 2023 07:38:59 -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-263-ztZcLCgCPSCuHHR7kIXIgA-1; Thu, 04 May 2023 07:38:53 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25731101A531; Thu, 4 May 2023 11:38:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8AE72166B30; Thu, 4 May 2023 11:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200337; 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=zPjdX9HrhoF9f4wyXV9lCrCfM561XXgGOBZEPAW9fS8=; b=O02fAGSZYbjuOOO+GnIvL91PxafUTgB8/drt9flrflDt7utMI0+/dJObQxYwXl3L6Vl2BQ Dp2rhDu0tpEVpAmDVpNPrC0B2+iGoKbjAX9K84V5YCe3j+GssOvAtucMg/2LE5NaCoUWIp +MzJQ0rWUdXUPMqzhrr+PanelTz/xu0= X-MC-Unique: ztZcLCgCPSCuHHR7kIXIgA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 6/9] qemu-file: remove shutdown member Date: Thu, 4 May 2023 13:38:38 +0200 Message-Id: <20230504113841.23130-7-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200423360100007 Content-Type: text/plain; charset="utf-8" The first thing that we do after setting the shutdown value is set the error as -EIO if there is not a previous error. So this value is reduntant. Just remove it and use qemu_file_get_error() in the places that it was tested. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu --- migration/qemu-file.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 771aba7369..7b32ef45a9 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -63,8 +63,6 @@ struct QEMUFile { =20 int last_error; Error *last_error_obj; - /* has the file has been shutdown */ - bool shutdown; }; =20 /* @@ -78,8 +76,6 @@ int qemu_file_shutdown(QEMUFile *f) { int ret =3D 0; =20 - f->shutdown =3D true; - /* * We must set qemufile error before the real shutdown(), otherwise * there can be a race window where we thought IO all went though @@ -294,7 +290,7 @@ void qemu_fflush(QEMUFile *f) return; } =20 - if (f->shutdown) { + if (qemu_file_get_error(f)) { return; } if (f->iovcnt > 0) { @@ -407,7 +403,7 @@ static ssize_t coroutine_mixed_fn qemu_fill_buffer(QEMU= File *f) f->buf_index =3D 0; f->buf_size =3D pending; =20 - if (f->shutdown) { + if (qemu_file_get_error(f)) { return 0; } =20 @@ -496,7 +492,7 @@ static int add_to_iovec(QEMUFile *f, const uint8_t *buf= , size_t size, } else { if (f->iovcnt >=3D MAX_IOV_SIZE) { /* Should only happen if a previous fflush failed */ - assert(f->shutdown || !qemu_file_is_writable(f)); + assert(qemu_file_get_error(f) || !qemu_file_is_writable(f)); return 1; } if (may_free) { --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200420; cv=none; d=zohomail.com; s=zohoarc; b=oHcnP/k1Dy9bhfGJ/S9yeiuVTO3LzS5DUaJw8qSppIMvs0M1V5RJD5JeeZJcwb03oMyDy9XJYLQq5oQDtgnqDgnXzvMe5HFA3qUJOKIZfXtyp/OVSZEYTuNH3hMAbOoRVGccdaP79BPKprC9/pOzQhhjWMZaP/b2Vg8bTvTQTtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200420; 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=I7bnCvHPplp/VOFkHO6aBDrYgud8J2hfG1mFqO+Qfi8=; b=UFtibuUypyOid571aYtQ8Lct7+DwEw7lj6d0SvSzVifeEVkwemSF3CS69sK78CD65zhz6fLL0kQkJkrIq+8SbimnCu81lNq8jl837cbLDpxLk4Zs4+RrU5X2y2R7zgYxC59zlZGCxLggMaRmidfqu3/HecIt755u5kgcNAiwJmM= 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 1683200420738803.8141795206843; Thu, 4 May 2023 04:40:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXId-00063G-Dn; Thu, 04 May 2023 07:39: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 1puXIa-00061h-Ua for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXIY-0003Ly-Lh for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-JAdnwe9CPa-1NYSsYDMmfg-1; Thu, 04 May 2023 07:38:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99B0A85A5A3; Thu, 4 May 2023 11:38:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 696BB2166B30; Thu, 4 May 2023 11:38:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200338; 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=I7bnCvHPplp/VOFkHO6aBDrYgud8J2hfG1mFqO+Qfi8=; b=FrbbfUQhvkbkxmts4T9p3u4ilwi2oIbjmGtzrSY3ij5V0asiWFMYk1zXmc06uTlYuOpwAY MsHIuiG5nLrdthkAXVPU62/zc20EDBIWeJGjvGXz3Ut/JeJomC4SBkrV9QHKqk+0/HwsBC XNHAZa24EQrwJv+3itlDlffbv0+PjlQ= X-MC-Unique: JAdnwe9CPa-1NYSsYDMmfg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 7/9] qemu-file: Make total_transferred an uint64_t Date: Thu, 4 May 2023 13:38:39 +0200 Message-Id: <20230504113841.23130-8-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200421359100003 Content-Type: text/plain; charset="utf-8" Change all the functions that use it. It was already passed as uint64_t. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/block.c | 5 ++--- migration/qemu-file.c | 8 ++++---- migration/qemu-file.h | 4 ++-- migration/savevm.c | 6 ++---- migration/vmstate.c | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/migration/block.c b/migration/block.c index 3499f75e37..a37678ce95 100644 --- a/migration/block.c +++ b/migration/block.c @@ -747,8 +747,7 @@ static int block_save_setup(QEMUFile *f, void *opaque) static int block_save_iterate(QEMUFile *f, void *opaque) { int ret; - int64_t last_bytes =3D qemu_file_total_transferred(f); - int64_t delta_bytes; + uint64_t last_bytes =3D qemu_file_total_transferred(f); =20 trace_migration_block_save("iterate", block_mig_state.submitted, block_mig_state.transferred); @@ -800,7 +799,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque) } =20 qemu_put_be64(f, BLK_MIG_FLAG_EOS); - delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; + uint64_t delta_bytes =3D qemu_file_total_transferred(f) - last_bytes; return (delta_bytes > 0); } =20 diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 7b32ef45a9..e97d180f17 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -51,7 +51,7 @@ struct QEMUFile { uint64_t rate_limit_used; =20 /* The sum of bytes transferred on the wire */ - int64_t total_transferred; + uint64_t total_transferred; =20 int buf_index; int buf_size; /* 0 when writing */ @@ -718,9 +718,9 @@ int coroutine_mixed_fn qemu_get_byte(QEMUFile *f) return result; } =20 -int64_t qemu_file_total_transferred_fast(QEMUFile *f) +uint64_t qemu_file_total_transferred_fast(QEMUFile *f) { - int64_t ret =3D f->total_transferred; + uint64_t ret =3D f->total_transferred; int i; =20 for (i =3D 0; i < f->iovcnt; i++) { @@ -730,7 +730,7 @@ int64_t qemu_file_total_transferred_fast(QEMUFile *f) return ret; } =20 -int64_t qemu_file_total_transferred(QEMUFile *f) +uint64_t qemu_file_total_transferred(QEMUFile *f) { qemu_fflush(f); return f->total_transferred; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 55ef5a2ac7..d758e7f10b 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -83,7 +83,7 @@ int qemu_fclose(QEMUFile *f); * * Returns: the total bytes transferred */ -int64_t qemu_file_total_transferred(QEMUFile *f); +uint64_t qemu_file_total_transferred(QEMUFile *f); =20 /* * qemu_file_total_transferred_fast: @@ -95,7 +95,7 @@ int64_t qemu_file_total_transferred(QEMUFile *f); * * Returns: the total bytes transferred and queued */ -int64_t qemu_file_total_transferred_fast(QEMUFile *f); +uint64_t qemu_file_total_transferred_fast(QEMUFile *f); =20 /* * put_buffer without copying the buffer. diff --git a/migration/savevm.c b/migration/savevm.c index a9d0a88e62..032044b1d5 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -927,11 +927,9 @@ static int vmstate_load(QEMUFile *f, SaveStateEntry *s= e) static void vmstate_save_old_style(QEMUFile *f, SaveStateEntry *se, JSONWriter *vmdesc) { - int64_t old_offset, size; - - old_offset =3D qemu_file_total_transferred_fast(f); + uint64_t old_offset =3D qemu_file_total_transferred_fast(f); se->ops->save_state(f, se->opaque); - size =3D qemu_file_total_transferred_fast(f) - old_offset; + uint64_t size =3D qemu_file_total_transferred_fast(f) - old_offset; =20 if (vmdesc) { json_writer_int64(vmdesc, "size", size); diff --git a/migration/vmstate.c b/migration/vmstate.c index 83ca4c7d3e..351f56104e 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -349,7 +349,7 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDesc= ription *vmsd, void *first_elem =3D opaque + field->offset; int i, n_elems =3D vmstate_n_elems(opaque, field); int size =3D vmstate_size(opaque, field); - int64_t old_offset, written_bytes; + uint64_t old_offset, written_bytes; JSONWriter *vmdesc_loop =3D vmdesc; =20 trace_vmstate_save_state_loop(vmsd->name, field->name, n_elems= ); --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200388; cv=none; d=zohomail.com; s=zohoarc; b=W8cSI7Zx/o9GJee9FyBjQG7KgksqhcAB3RL6+XANH0uyrXKaGD9LiTZfn96bnH8E96E5zapDp8OYKNDAQsprQwW1iV8OPzyCbx6F1+CE5YeSJP8dtTHBjtkZTETGsyIENO8O/IQ2PD2XNJPhu7USfWjw6QEnTTbhogEKiyxuyiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200388; 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=JtbbZ51sXOA6tO1WisbkZFbC8+YuFKB34JucIFgCWAo=; b=PuskSiE99batjgY9hBLpRqTQpqCzPevByXHRi5bhyVobPUvGz6BxlP9BdnFLwhITGCZmy5zFiCeOoAWGveRP3aNdshylut/gL21xn0iUCRd0VvltcBho1rBk/SOxHxEZYRIaIalP0O7A7j67QC0Pf2I+CGnNreLin+YnJeN9Q9U= 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 1683200388061453.0779363613706; Thu, 4 May 2023 04:39:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXIe-00063r-Dp; Thu, 04 May 2023 07:39:04 -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 1puXIb-00062f-RW for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:01 -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 1puXIa-0003Nx-5R for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-387-AbsykLYYOk27jLcb__leoA-1; Thu, 04 May 2023 07:38:56 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16A761C0A58D; Thu, 4 May 2023 11:38:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCF912166B30; Thu, 4 May 2023 11:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200339; 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=JtbbZ51sXOA6tO1WisbkZFbC8+YuFKB34JucIFgCWAo=; b=g6eapC5iGJ3c6LMjRe4R3w3wLL1oJNHexiqyibaxFXS3oQsVDdBgeHsIJI5/RIzAPPQAwi 5cNWroNUgHrCC7uC2E06FVZmxQjFrAP0CQiSpqYsGp8tq8p4hTUnZsMFzFSQq2G4RBMQoE gZDSf3un8Nu4vEx/5bnOYS1so/jdoIA= X-MC-Unique: AbsykLYYOk27jLcb__leoA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 8/9] qemu-file: Make ram_control_save_page() use accessors for rate_limit Date: Thu, 4 May 2023 13:38:40 +0200 Message-Id: <20230504113841.23130-9-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200389865100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Peter Xu --- 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 e97d180f17..ddebfac847 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -362,7 +362,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t bl= ock_offset, int ret =3D f->hooks->save_page(f, block_offset, offset, size, bytes_sent); if (ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - f->rate_limit_used +=3D size; + qemu_file_acct_rate_limit(f, size); } =20 if (ret !=3D RAM_SAVE_CONTROL_DELAYED && --=20 2.40.0 From nobody Tue May 14 16:13:52 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=1683200422; cv=none; d=zohomail.com; s=zohoarc; b=oAjZXYhpJDhneASWOnhY5ql5F/ynfr8yrzXXxZVAhoqnjXYDYVpqxLkiVSaa9S4Os1myh/O11amG7Ay/h4mfhVo7vE6ymhB/osHXbqxqXR8Q9OShWJx8dZt+9nJRLMEfMisG6KeYBGYegaMzPwcqZVJ/5UouWaptZz4ywAW6FAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683200422; 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=7PcqtgyTxfXOfRPl50H0fhxTkC59Wdp8JZXgZI9Oui8=; b=V11sBDZiekA2MVCD4jYMrMIrW98cnUaK/senyk4xflEb+KLUT1otvEnq7tfMYy0Idm3uDlCCVhSBHFTsjFIrRSP97MgaOUuSP9U4WiUIkHuxeaJEYcTTndks75sgnllhIMw00oyc2xCjH95XgtaIrM0J/lHoKRZc7n2lGhBOlGM= 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 1683200422483337.2012270044529; Thu, 4 May 2023 04:40:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXId-00063B-Ax; Thu, 04 May 2023 07:39: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 1puXIb-00062R-IX for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:01 -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 1puXIZ-0003Ni-Rn for qemu-devel@nongnu.org; Thu, 04 May 2023 07:39:01 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-385-KrHXmkxWM5ailkGzDiw-WQ-1; Thu, 04 May 2023 07:38:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8810D3C0E215; Thu, 4 May 2023 11:38:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58C062166B30; Thu, 4 May 2023 11:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683200339; 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=7PcqtgyTxfXOfRPl50H0fhxTkC59Wdp8JZXgZI9Oui8=; b=fBDon1HjqO29xhUz5FSFfDOLCPxwzcSPc5s/yWjoFFyLF+jyPZrCR4xLlIfrI4XmpcYL0k bSMUrGOekQFSTfGpAz/LOzjmvDMfkiU97lmYIiFdlmFWkFDrM/3gifxvhdE1bddQzMZX2M 5NQ+5T0AQxbAm9Xzfce8f6WXD7YnE40= X-MC-Unique: KrHXmkxWM5ailkGzDiw-WQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Juan Quintela , Leonardo Bras , Fam Zheng , Peter Xu Subject: [PATCH 9/9] qemu-file: Account for rate_limit usage on qemu_fflush() Date: Thu, 4 May 2023 13:38:41 +0200 Message-Id: <20230504113841.23130-10-quintela@redhat.com> In-Reply-To: <20230504113841.23130-1-quintela@redhat.com> References: <20230504113841.23130-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683200423570100010 Content-Type: text/plain; charset="utf-8" That is the moment we know we have transferred something. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index ddebfac847..309b4c56f4 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -300,7 +300,9 @@ void qemu_fflush(QEMUFile *f) &local_error) < 0) { qemu_file_set_error_obj(f, -EIO, local_error); } else { - f->total_transferred +=3D iov_size(f->iov, f->iovcnt); + uint64_t size =3D iov_size(f->iov, f->iovcnt); + qemu_file_acct_rate_limit(f, size); + f->total_transferred +=3D size; } =20 qemu_iovec_release_ram(f); @@ -527,7 +529,6 @@ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *= buf, size_t size, return; } =20 - f->rate_limit_used +=3D size; add_to_iovec(f, buf, size, may_free); } =20 @@ -545,7 +546,6 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, s= ize_t size) l =3D size; } memcpy(f->buf + f->buf_index, buf, l); - f->rate_limit_used +=3D l; add_buf_to_iovec(f, l); if (qemu_file_get_error(f)) { break; @@ -562,7 +562,6 @@ void qemu_put_byte(QEMUFile *f, int v) } =20 f->buf[f->buf_index] =3D v; - f->rate_limit_used++; add_buf_to_iovec(f, 1); } =20 --=20 2.40.0