From nobody Mon Feb 9 09:54:20 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1665395599; cv=none; d=zohomail.com; s=zohoarc; b=M3QOfnLWEcONv/vhR8FxoPe7nt5B+dgHNHnk9KrpHp134E0tadU+mJi7JqpTJaD90Nu6JPD6d8BnG6Jm68AvLQPWfNInJPiWQKMTtRKceHmzggve27VdBt1W2x2zb6G6bKQ6amPnUrwPcEpptWA8jxcn1ddbLrjqlr0pQlK8DKs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665395599; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DjnqLoFWF+yHwxBwVxnvFr12ux2UviK8LbxO0FkescM=; b=n3AwXjPSmR0rAGPhmwXknGolHm0+JPdGS+VCs05xf/mS088R6me+zojfqGJsPFPaHY1g3El8G70NTWn2QzXlZASoyQ+NwVRakIe2eVxGz7RhE1hnGZyezeJL9yeyCE7IVQSaQrM7DwSmeIM9hgW9dcqfUxQ27LzOo6b0eHseh7k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; 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 1665395599585331.2728104716052; Mon, 10 Oct 2022 02:53:19 -0700 (PDT) Received: from localhost ([::1]:42164 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohpTK-0007vN-IQ for importer@patchew.org; Mon, 10 Oct 2022 05:53:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohpJt-0001lS-K4 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 05:43:36 -0400 Received: from mga11.intel.com ([192.55.52.93]:48274) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohpJg-0005zz-CZ for qemu-devel@nongnu.org; Mon, 10 Oct 2022 05:43:33 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 02:43:15 -0700 Received: from duan-server-s2600bt.bj.intel.com ([10.240.192.143]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2022 02:43:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1665395000; x=1696931000; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=5GoalGxsiAXyC9ucd30gCeZ3dA9jnT4McT2ufdBWt1s=; b=UUkHsbuHwKjLchckomnR+iXwz4pHmXWu2z0MGaetIdMgKExnB1KCizon em7Beq9hsGy8Crofh1veBW4z5E3m8vaWW/e0JN7MWHmix/6utc0lQCu8p 7hfRU2KOT2q5vNWRovlLaHBLM55Soje4dNFQCH6kUHdwoNYEr0WG39Dw0 3XSjGRZ253WxWO/Fb5L8qmXGUSEeBJBDL0Eqpy1LwhM/6o3i/K2649SdM OEQAxu3O6zHsWI1z2SF3MSWnHyDlUpZEO4t7I25IQGExhEMVG6Y8Rrokj Z+sAPTe1PDAYZ+GFks6u25vabeg016/DYbndlHozVhGuuU/9uT7lvstMG g==; X-IronPort-AV: E=McAfee;i="6500,9779,10495"; a="301794925" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="301794925" X-IronPort-AV: E=McAfee;i="6500,9779,10495"; a="768327215" X-IronPort-AV: E=Sophos;i="5.95,173,1661842800"; d="scan'208";a="768327215" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: quintela@redhat.com, dgilbert@redhat.com Subject: [PATCH] migration: Fix the minus value for compressed_size Date: Mon, 10 Oct 2022 17:34:15 +0800 Message-Id: <20221010093415.2779165-1-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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=192.55.52.93; envelope-from=zhenzhong.duan@intel.com; helo=mga11.intel.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=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" X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1665395601314100003 Content-Type: text/plain; charset="utf-8" When update_compress_thread_counts() is called first time, there is no data stream yet. We see compression_counters.compressed_size becomes minus value shortly. Signed-off-by: Zhenzhong Duan --- migration/ram.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index dc1de9ddbc68..510db95cdc36 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1443,6 +1443,10 @@ static bool do_compress_ram_page(QEMUFile *f, z_stre= am *stream, RAMBlock *block, static void update_compress_thread_counts(const CompressParam *param, int bytes_xmit) { + if (bytes_xmit <=3D 0) { + return; + } + ram_transferred_add(bytes_xmit); =20 if (param->zero_page) { --=20 2.25.1