From nobody Sat May 18 16:47:02 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=1686668344; cv=none; d=zohomail.com; s=zohoarc; b=XbOAXDcFRoiXJOieEuBptEveJxyObAuu1j8rroNV48ZqgxImtdjxC4FU/vc2OTzhQ0PIG3R2MuUVINy2gWmwgvyR26ZbwLP21RSABPQLBpnV+6QQiHTyP6S18Dr+04psnZ1n3d9gRoNtQeo1wpWaMyY4FOpz3Ld1U1G9fgfO+6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668344; 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=iqQ1Jj/Ln5VLyhMCA//NvQ21r3Qsfybj2P+onhlxemY=; b=YJC4VdfUSSeO77P9I76RbitrLma1n2S7YodijMNpK3+AL1oHbrt7DRaVWmB550DQRZw2mQwEWSvmYXRTzCBwau7HI2I7/jGwsDewLXr5rNsa2CWSHIHtYr2i+2ri4Q59cigbbwxQ6+B05i0t90Z6aUt1s6xETvoRR4tMrbE7dhM= 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 1686668344859787.5201219967007; Tue, 13 Jun 2023 07:59:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TN-00069q-8J; Tue, 13 Jun 2023 10:58:19 -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 1q95TC-00067I-Fq for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:06 -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 1q95TA-0007Vu-Nd for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:06 -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-492-XyPnRIpeOyWUM1bX1qLusQ-1; Tue, 13 Jun 2023 10:58:01 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A81448007D9; Tue, 13 Jun 2023 14:58:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9D0A40C6F5C; Tue, 13 Jun 2023 14:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668283; 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=iqQ1Jj/Ln5VLyhMCA//NvQ21r3Qsfybj2P+onhlxemY=; b=J+55MZ2EEeKAtoa6qEHvRhLtKTFSGGMEZ9zk9c0yxuIX+b/y5yXtOUxyE9D15Mussw4qXK 2u7cAgPYrpxHI9AhVk+5dAsWkNXwrgGCEFZFhNzftozX9i1OlWCK7VYvkoP/kEM6TowpBo WFQqFFUiDdgzxcLEci6yC9mAJw3j8lk= X-MC-Unique: XyPnRIpeOyWUM1bX1qLusQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 01/18] migration: Give one error if trying to set MULTIFD and XBZRLE Date: Tue, 13 Jun 2023 16:57:40 +0200 Message-Id: <20230613145757.10131-2-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668345037100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/options.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migration/options.c b/migration/options.c index b62ab30cd5..c6674a4753 100644 --- a/migration/options.c +++ b/migration/options.c @@ -547,6 +547,13 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + if (new_caps[MIGRATION_CAPABILITY_MULTIFD]) { + if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + error_setg(errp, "Multifd is not compatible with xbzrle"); + return false; + } + } + return true; } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668468; cv=none; d=zohomail.com; s=zohoarc; b=Oxa8/1EjDcByuZmjwVcYkx6D1BRqo+V88J4MY1KMXh4urXUPRceimKETsgW1c0eCTxHNYwh3/qg1nwU3HQg7UcMIsrA4u23WQBThv7WqyxhBCOqwaA819FI+zK713S29CaN2hb6RHGswu0BhljhzODz8z+EEDpKq26DExmDKD9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668468; 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=A+Zov8Eerhvh8dhQLVLPGVXhWpilFKYN4DDJ9IJc8Ko=; b=JHF3zBuiNhOhsOK4rz2RuQSWX1Qd4LJ0zAuHv3RW5PYBjikjTZzldpx4PTx3AYgNWijSnv3egsyh+VWhPy2o6O0SdjXuoN2m8Mum3My+2RUzLGQ1kpMVfx6NtlmTyK2tVXBLGAh1QOSTEBLlAo2bMmotc7qAlYtKutjiunDvv6k= 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 1686668468804690.066786473994; Tue, 13 Jun 2023 08:01:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TP-0006A8-5E; Tue, 13 Jun 2023 10:58:20 -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 1q95TD-00067Z-HU for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:07 -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 1q95TC-0007WD-5T for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:07 -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-357-HWNhFt7bMF-2Zm8EGLsoUw-1; Tue, 13 Jun 2023 10:58:03 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 10CEB801182; Tue, 13 Jun 2023 14:58:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED82A40C6F5C; Tue, 13 Jun 2023 14:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668285; 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=A+Zov8Eerhvh8dhQLVLPGVXhWpilFKYN4DDJ9IJc8Ko=; b=RWJEgQlwh642vtWqtssR43z/ZS8hoL4DnJSy+Enioln1FhUM8WH+RiNuGmIY7QYQamDEwD OGqHbH79CMKVOTW8x4AskX4OTYrwMoU21i84nB/UQ7/JjwGD71psTr1IZrXPL3IvPEaVFe 2fLUIVPdIPpeNAYLQWY3FxswP7uY5zY= X-MC-Unique: HWNhFt7bMF-2Zm8EGLsoUw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 02/18] migration: Give one error if trying to set COMPRESSION and XBZRLE Date: Tue, 13 Jun 2023 16:57:41 +0200 Message-Id: <20230613145757.10131-3-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668479737100004 Content-Type: text/plain; charset="utf-8" As we have disable to use both together in the previous patch, we can remove this check. Signed-off-by: Juan Quintela --- migration/options.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migration/options.c b/migration/options.c index c6674a4753..a18689c314 100644 --- a/migration/options.c +++ b/migration/options.c @@ -554,6 +554,13 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + if (new_caps[MIGRATION_CAPABILITY_COMPRESS]) { + if (new_caps[MIGRATION_CAPABILITY_XBZRLE]) { + error_setg(errp, "Compression is not compatible with xbzrle"); + return false; + } + } + return true; } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668407; cv=none; d=zohomail.com; s=zohoarc; b=brAXr1qOzhChli4gBlvm16nuzdRwrM3QMbjiKSfYFG0pRCwGImhg98YWn/Gi1mFjul1DUsb0zW4ZJbJyAlypNglMdhYyG81Z1bECsX2GmGKBpH9erKXX11XhMD3nXc1ZRtlX9RTMgh6IGzWxcnzCKLpKAZwG+ttvzAJg3qIOQ0U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668407; 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=yi6cfiQqHrautoexJvzspiQZwl1p1IbaRwRH/PcKw00=; b=C9r3/0PMPHfFzIbapErBa5N6PoPrvZXj1QwjcYDecZMQcWQytpZUBIVNOmgq/pTv0foyNZdvK088ycU1qZWwLAPQrPkxy0zedX+hE47rKiQ1W+OQ5KDEf6+4FyMUWecL95GWWcRed5P/n3+Y9W2EvW75pyHDqUI0q3WvZ8aBAWY= 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 1686668407930717.9331858906885; Tue, 13 Jun 2023 08:00:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TU-0006Cg-9m; Tue, 13 Jun 2023 10:58:24 -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 1q95TG-00068D-5m for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:11 -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 1q95TE-0007XC-QC for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-196-J-gKYKH2OA665-4CEKTo8w-1; Tue, 13 Jun 2023 10:58:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E82A858F15; Tue, 13 Jun 2023 14:58:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5791440C6F5E; Tue, 13 Jun 2023 14:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668288; 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=yi6cfiQqHrautoexJvzspiQZwl1p1IbaRwRH/PcKw00=; b=EzFm1X8M8KQF2oeNndXW4qHGIb13gI2NOw/fPaWenPhQL3TzeGz9hkghaLaxjrnA9HIRlX tJudJGR5n+Ad6XgebW5oaPHcH6dYvtI313dEpUg6gOhx8/xbhnRQRWJUUvMpCPS92I+9Wz 8WjnyqkNsIXqiv2LJUdqRjPSRCbuc54= X-MC-Unique: J-gKYKH2OA665-4CEKTo8w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 03/18] migration: RDMA is not compatible with anything else Date: Tue, 13 Jun 2023 16:57:42 +0200 Message-Id: <20230613145757.10131-4-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668410260100001 Content-Type: text/plain; charset="utf-8" So give an error instead of just ignoring the other methods. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/migration.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index dc05c6f6ea..84551f040c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -436,6 +436,18 @@ static void qemu_start_incoming_migration(const char *= uri, Error **errp) socket_start_incoming_migration(p ? p : uri, errp); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { + if (migrate_compress()) { + error_setg(errp, "RDMA and compression can't be used together"= ); + return; + } + if (migrate_xbzrle()) { + error_setg(errp, "RDMA and XBZRLE can't be used together"); + return; + } + if (migrate_multifd()) { + error_setg(errp, "RDMA and multifd can't be used together"); + return; + } rdma_start_incoming_migration(p, errp); #endif } else if (strstart(uri, "exec:", &p)) { --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668469; cv=none; d=zohomail.com; s=zohoarc; b=FPgP7f/UiV0TOCZ8whbvkcPcDBIBBf1IouhtegF0jUvKIibQuibjPrJ/MYEX9UabHTLL4Xo28JzznLMC9k7LUFinmmg3mcVUyAFMHmnKXcr5RLpuzi8CH1MEpxNxknVC/scixvOYuqGp33/Mm7JcXlU/O/qq3ePdfM/XXkEUvp8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668469; 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=C6yxy1+QPusVaX/KeEp2OOi+RCNSn5LXBnmxFqvZF/g=; b=nnO68Zc1WxZjvJMuDCNUjw6rxL0feJ+MVZVF/xYCx0YwvKPzpKTObARalghIirUZjwXUfC8JK8SVKupis3XAUs6xomcHDG+8y7RCGJrQ/U87bSFps9Ffuw+vFDyc+EaOb+7Hc5hKujkJouydWwX9nOEOLgzsWVX14kDXA+LpSp8= 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 1686668469578887.9835971515599; Tue, 13 Jun 2023 08:01:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TT-0006Bm-5t; Tue, 13 Jun 2023 10:58:23 -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 1q95TJ-00069V-2O for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TH-0007XT-ER for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:12 -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-67-WwSCVexKOlCVSeZmOdTiig-1; Tue, 13 Jun 2023 10:58:07 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4E448030D3; Tue, 13 Jun 2023 14:58:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9537A40C6F5C; Tue, 13 Jun 2023 14:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668289; 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=C6yxy1+QPusVaX/KeEp2OOi+RCNSn5LXBnmxFqvZF/g=; b=c0758YnxgiXsTAMkQ0qB8deV9gQtkmt/W+8CkXKMXN6CGsA9ZsVP/qxXjQqVZ4e4/5J/Ai N+jmqVVrGuyR7FUJlU1PL302DbpNcas06+JypVPTJcISLsFS3bJmtOlvKICj5FMaT0y40I PqtVLmqGODry7MU4suda+MKxTaZWybY= X-MC-Unique: WwSCVexKOlCVSeZmOdTiig-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 04/18] migration: Remove save_page_use_compression() Date: Tue, 13 Jun 2023 16:57:43 +0200 Message-Id: <20230613145757.10131-5-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668488150100001 Content-Type: text/plain; charset="utf-8" After previous patch, we disable the posiblity that we use compression together with xbzrle. So we can use directly migrate_compress(). Once there, now we don't need the rs parameter, so remove it. Signed-off-by: Juan Quintela --- migration/ram.c | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 88a6c82e63..d4943b982f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1274,8 +1274,6 @@ update_compress_thread_counts(const CompressParam *pa= ram, int bytes_xmit) compression_counters.pages++; } =20 -static bool save_page_use_compression(RAMState *rs); - static int send_queued_data(CompressParam *param) { PageSearchStatus *pss =3D &ram_state->pss[RAM_CHANNEL_PRECOPY]; @@ -1312,9 +1310,9 @@ static int send_queued_data(CompressParam *param) return len; } =20 -static void ram_flush_compressed_data(RAMState *rs) +static void ram_flush_compressed_data(void) { - if (!save_page_use_compression(rs)) { + if (!migrate_compress()) { return; } =20 @@ -1375,7 +1373,7 @@ static int find_dirty_block(RAMState *rs, PageSearchS= tatus *pss) * Also If xbzrle is on, stop using the data compression at th= is * point. In theory, xbzrle can do better than compression. */ - ram_flush_compressed_data(rs); + ram_flush_compressed_data(); =20 /* Hit the end of the list */ pss->block =3D QLIST_FIRST_RCU(&ram_list.blocks); @@ -2024,24 +2022,6 @@ int ram_save_queue_pages(const char *rbname, ram_add= r_t start, ram_addr_t len) return 0; } =20 -static bool save_page_use_compression(RAMState *rs) -{ - if (!migrate_compress()) { - return false; - } - - /* - * If xbzrle is enabled (e.g., after first round of migration), stop - * using the data compression. In theory, xbzrle can do better than - * compression. - */ - if (rs->xbzrle_started) { - return false; - } - - return true; -} - /* * try to compress the page before posting it out, return true if the page * has been properly handled by compression, otherwise needs other @@ -2050,7 +2030,7 @@ static bool save_page_use_compression(RAMState *rs) static bool save_compress_page(RAMState *rs, PageSearchStatus *pss, RAMBlock *block, ram_addr_t offset) { - if (!save_page_use_compression(rs)) { + if (!migrate_compress()) { return false; } =20 @@ -2065,7 +2045,7 @@ static bool save_compress_page(RAMState *rs, PageSear= chStatus *pss, * much CPU resource. */ if (block !=3D pss->last_sent_block) { - ram_flush_compressed_data(rs); + ram_flush_compressed_data(); return false; } =20 @@ -3115,7 +3095,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) * page is sent in one chunk. */ if (migrate_postcopy_ram()) { - ram_flush_compressed_data(rs); + ram_flush_compressed_data(); } =20 /* @@ -3210,7 +3190,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) } qemu_mutex_unlock(&rs->bitmap_mutex); =20 - ram_flush_compressed_data(rs); + ram_flush_compressed_data(); ram_control_after_iterate(f, RAM_CONTROL_FINISH); } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668520; cv=none; d=zohomail.com; s=zohoarc; b=B4DI+UAQNXscMA3qbKmi2lEXsUtlsqCExWYi1hxRFQLHvPixvOs+hnT4Mqg6Hv3/ix7WrLLY/ZmuXopJ2qoCyRwlUcX59ymRu8O+Ot6xryV5521gJ5LXJRy9fDKfe1jPm/pN8J/EnCFRNrvnTDRuLJXXhr4rC1hXf7/H5Sgl09w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668520; 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=Km9j3t3TIEx5XuWqRvHZVsalsYUdrZyIS+jcGvqmWn4=; b=W/m4aLVEozjWRKj9teaOLKlsO1gMWh3XWyJQOV2P6V6EOENCYVNPtbQDuNzIgc9v2IP6hDq3R1GbSOlRjjbEUyiiYi1Qt/bDdolRhTW9gQ8QuUxiuy8Hni5T38VRHltgosGxIpbieM5PBhquqkOQhCPMNgIyfKYvSnJQL+6I7Ys= 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 1686668520921357.8709357374921; Tue, 13 Jun 2023 08:02:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TZ-0006Ga-PZ; Tue, 13 Jun 2023 10:58:29 -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 1q95TN-0006AF-E8 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TK-0007Y4-7m for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:15 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-380-Xge9b1u4N9qxJzXmSS7oCg-1; Tue, 13 Jun 2023 10:58:09 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D9F763C11CD5; Tue, 13 Jun 2023 14:58:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB6C540C6F5C; Tue, 13 Jun 2023 14:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668293; 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=Km9j3t3TIEx5XuWqRvHZVsalsYUdrZyIS+jcGvqmWn4=; b=b7P2eU+0ENYGs7r4iyLC3U+ERVNmI+tUcXnUiQRToJa188Pd8dJLa4SNmcarDRhPDjZMjq hb8Mbp8Zumm47xNq1pOYaXTmDDoJXvB5MuOi4gr1wyDN/R8UWSeWLF3kb4Prao1evWuLFX Eocw9utlzVRu+39MvsZocV3Fxf8wGpw= X-MC-Unique: Xge9b1u4N9qxJzXmSS7oCg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 05/18] migration: Move compression_counters cleanup ram-compress.c Date: Tue, 13 Jun 2023 16:57:44 +0200 Message-Id: <20230613145757.10131-6-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668530104100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/migration.c | 4 +--- migration/ram-compress.c | 5 +++++ migration/savevm.c | 1 - 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 84551f040c..5105ad6825 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1628,11 +1628,9 @@ static bool migrate_prepare(MigrationState *s, bool = blk, bool blk_inc, =20 migrate_init(s); /* - * set mig_stats compression_counters memory to zero for a - * new migration + * set mig_stats memory to zero for a new migration */ memset(&mig_stats, 0, sizeof(mig_stats)); - memset(&compression_counters, 0, sizeof(compression_counters)); =20 return true; } diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 06254d8c69..a0f6a56470 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -430,6 +430,11 @@ int compress_threads_load_setup(QEMUFile *f) return 0; } =20 + /* + * set compression_counters memory to zero for a new migration + */ + memset(&compression_counters, 0, sizeof(compression_counters)); + thread_count =3D migrate_decompress_threads(); decompress_threads =3D g_new0(QemuThread, thread_count); decomp_param =3D g_new0(DecompressParam, thread_count); diff --git a/migration/savevm.c b/migration/savevm.c index bc284087f9..aa31d29f23 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1621,7 +1621,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) =20 migrate_init(ms); memset(&mig_stats, 0, sizeof(mig_stats)); - memset(&compression_counters, 0, sizeof(compression_counters)); ms->to_dst_file =3D f; =20 qemu_mutex_unlock_iothread(); --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668754; cv=none; d=zohomail.com; s=zohoarc; b=gBt4/TZv48NmoP72j0GKFcdmlEf4yvEpGk00lXIyjrScj3GJayx5L16iYcSGa4GAF4bn3uguBApfkeUIOSS2G2SyH9yZmgi2MZlhA5Rz4DSA9MZJBfp6m8FOmNkoqDOC0BZ6DsGx2e87CbB7uD0qTHqbvZNHbmM18svv96b4lgQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668754; 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=kZ9uIFneLmm4zIFFZcUoN4vRknP1r2UoRBjOP23rXjM=; b=JpAeuG4gvj0gXu10ithav2Isu0laQ4Pzmsh3j3aKNQyx5HxV2xP7b6QdcKdtm3eDtP2XbND1yxu3ig4U0KgrCAf9etGg7z+cETKUv9mv09GWZ/qOdh5Xe1A+/Bvh4UtCUcYugjGCA16bPn3e7GFuiUkwjom75DP1dPUfvpbChLQ= 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 1686668754019886.3496300357966; Tue, 13 Jun 2023 08:05:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TX-0006EZ-3v; Tue, 13 Jun 2023 10:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TN-0006AE-DX for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TJ-0007Xj-Ch for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:15 -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-584-5gnIECDkPliPcMsTbjINMw-1; Tue, 13 Jun 2023 10:58:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3BB5080120A; Tue, 13 Jun 2023 14:58:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B3D640C6F5C; Tue, 13 Jun 2023 14:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668292; 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=kZ9uIFneLmm4zIFFZcUoN4vRknP1r2UoRBjOP23rXjM=; b=dya45858l5buj1QIj3JIfv2prm7BkYUGBJSTdJEmglwt/VxBy2JzX6+GkLQ5WC8Yc4Kiff nGDzfWGB9Vb2D4gn9Km1RRZm/xThsMAYuWsFvYK2Jgrez5o6EGAt5raoTFGvzJm3ncDqk9 DFYNheC12vhnh1dnixL2Q87bnMr0XYo= X-MC-Unique: 5gnIECDkPliPcMsTbjINMw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 06/18] migration: Create populate_compress() Date: Tue, 13 Jun 2023 16:57:45 +0200 Message-Id: <20230613145757.10131-7-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668756588100001 Content-Type: text/plain; charset="utf-8" So we don't have to access compression_counters from outside ram-compress.c. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.h | 3 +++ migration/migration.c | 11 +---------- migration/ram-compress.c | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/migration/ram-compress.h b/migration/ram-compress.h index 6f7fe2f472..43ff44c0ba 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -30,6 +30,7 @@ #define QEMU_MIGRATION_COMPRESS_H =20 #include "qemu-file.h" +#include "qapi/qapi-types-migration.h" =20 enum CompressResult { RES_NONE =3D 0, @@ -67,4 +68,6 @@ void compress_threads_load_cleanup(void); int compress_threads_load_setup(QEMUFile *f); void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len); =20 +void populate_compress(MigrationInfo *info); + #endif diff --git a/migration/migration.c b/migration/migration.c index 5105ad6825..402bcd0d67 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -956,16 +956,7 @@ static void populate_ram_info(MigrationInfo *info, Mig= rationState *s) info->xbzrle_cache->overflow =3D xbzrle_counters.overflow; } =20 - if (migrate_compress()) { - info->compression =3D g_malloc0(sizeof(*info->compression)); - info->compression->pages =3D compression_counters.pages; - info->compression->busy =3D compression_counters.busy; - info->compression->busy_rate =3D compression_counters.busy_rate; - info->compression->compressed_size =3D - compression_counters.compressed_size; - info->compression->compression_rate =3D - compression_counters.compression_rate; - } + populate_compress(info); =20 if (cpu_throttle_active()) { info->has_cpu_throttle_percentage =3D true; diff --git a/migration/ram-compress.c b/migration/ram-compress.c index a0f6a56470..a91c32588e 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -488,3 +488,17 @@ void decompress_data_with_multi_threads(QEMUFile *f, v= oid *host, int len) } } } + +void populate_compress(MigrationInfo *info) +{ + if (migrate_compress()) { + info->compression =3D g_malloc0(sizeof(*info->compression)); + info->compression->pages =3D compression_counters.pages; + info->compression->busy =3D compression_counters.busy; + info->compression->busy_rate =3D compression_counters.busy_rate; + info->compression->compressed_size =3D + compression_counters.compressed_size; + info->compression->compression_rate =3D + compression_counters.compression_rate; + } +} --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668327; cv=none; d=zohomail.com; s=zohoarc; b=detPfE/hN2ft+ICudhrz9qUZDe/lnOKPsNKQAOtnZ/REj6hw/axzw2uc7PXtAnsxaP/D1tPtx7sIFePPSjU5cq7Uv1YwVc7tBiHaX0oTG1HGfxNcjOGVQUvUrESkmlBlfhUe//hVMwSLg1DZQVDAKDu3hGftNkEWhsIoiGWLW4U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668327; 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=B66OyZWraloKoaqmH//a5C0BcnJ9X2mYESHtKhjcz4o=; b=H9nxVnTlwbtIH8LgiO/jzoxKTGOC9valfu6fx9rBOFukkk9Hon7wE4YtPmQlON3nZog2mnD3OCKBloDIy/3Q41oTV67wPBWMW7+G2N6GdSCJpVlJmiUVhCtHN8J1EXe4gCBJn/hcxJ7VPGld7ib2iy7fEQYyR3QvjXstQ6DeDRw= 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 1686668327057879.8526787093659; Tue, 13 Jun 2023 07:58:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TU-0006Dg-RT; Tue, 13 Jun 2023 10:58:24 -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 1q95TN-0006AD-Df for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TJ-0007Xp-FB for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:15 -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-548-6Yj00K8oMG2UDagZCiAo6A-1; Tue, 13 Jun 2023 10:58:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D9FF185A78E; Tue, 13 Jun 2023 14:58:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 819FE40C6F5C; Tue, 13 Jun 2023 14:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668292; 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=B66OyZWraloKoaqmH//a5C0BcnJ9X2mYESHtKhjcz4o=; b=Z4xDbD2pfjrGD1+efFf5/h/MU+5AyFQIPsWd309EYjdGve6XglFBGSCBB/mb1ISIf6iPgU cTUalmsQoTVxeLLhy1ZtP3lTW7K965+0g64AQDDWPUVUGvKBrFUdcwWCNEhK9tH5VdQuyT hwqNMPlChzGo/ONhyaF3/ffgP3TcX7s= X-MC-Unique: 6Yj00K8oMG2UDagZCiAo6A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 07/18] migration: Create ram_compressed_pages() Date: Tue, 13 Jun 2023 16:57:46 +0200 Message-Id: <20230613145757.10131-8-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668329009100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela fix ram_compress Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.h | 1 + migration/ram-compress.c | 6 ++++++ migration/ram.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/migration/ram-compress.h b/migration/ram-compress.h index 43ff44c0ba..77465dad4b 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -69,5 +69,6 @@ int compress_threads_load_setup(QEMUFile *f); void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len); =20 void populate_compress(MigrationInfo *info); +uint64_t ram_compressed_pages(void); =20 #endif diff --git a/migration/ram-compress.c b/migration/ram-compress.c index a91c32588e..c48d5c53f6 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -502,3 +502,9 @@ void populate_compress(MigrationInfo *info) compression_counters.compression_rate; } } + +uint64_t ram_compressed_pages(void) +{ + return compression_counters.pages; +} + diff --git a/migration/ram.c b/migration/ram.c index d4943b982f..13c518f81a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -927,7 +927,7 @@ uint64_t ram_get_total_transferred_pages(void) { return stat64_get(&mig_stats.normal_pages) + stat64_get(&mig_stats.zero_pages) + - compression_counters.pages + xbzrle_counters.pages; + ram_compressed_pages() + xbzrle_counters.pages; } =20 static void migration_update_rates(RAMState *rs, int64_t end_time) --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668621; cv=none; d=zohomail.com; s=zohoarc; b=H7GKfaAMyaI8Y9WEQQjZZvwIthnSNswG4dOe5hmVWY+c3DFieg72hym5ZOqpZkE1tQyBHQVY/qiTmx1+69twril9Af4aUDWHs4RZqoKieTuVQ1z5Xd6oV1+k5DtqjCFJguCl0hP714hTxXTSG0EK3SG20GixLnFLFcutuQj9uao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668621; 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=qbjXMEFHjLeeCQ+bgtWRo9/HwYhqwSaOT2Sv9lsS9+k=; b=TowTjZBGLgsWnsxUA3qCKnZ3Ynf19yi++a/s9tf7A6R+TIfcy3WbQZvyB1XEZU3KZT/sac3A8zEBUJj4GIhrqHywXVI1hhqo9DW+zZ1uy6m7QDBziouR96/sZX/3p8urISKts3rk9tP9e3SZen7wAj3j5CpmvJ1xr3civSWz+ZE= 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 1686668621080292.24501195704784; Tue, 13 Jun 2023 08:03:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TW-0006ES-EF; Tue, 13 Jun 2023 10:58:26 -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 1q95TN-0006AB-D1 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TJ-0007Xr-JL for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:15 -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-642-304l-uf1NI-l6Z9Hqb7qVA-1; Tue, 13 Jun 2023 10:58:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A3BB9101A598; Tue, 13 Jun 2023 14:58:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id B479840C6F5E; Tue, 13 Jun 2023 14:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668292; 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=qbjXMEFHjLeeCQ+bgtWRo9/HwYhqwSaOT2Sv9lsS9+k=; b=Nxpns0Qijl2yPpc1qStudlyn4IGOUvXWmPTjzoyhlSc31dVfnR9Hffc1F5F+mpYUo0CREp hiVxrz0A//rD8AnVikaM7uTcCj712aZ3OylCYN4YZvdBi3S7IC46JC6IUMZJNfpKn8FBq5 8zpwog6WRom5FcKf5r4Oq/X0CWGFgpY= X-MC-Unique: 304l-uf1NI-l6Z9Hqb7qVA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 08/18] migration: Move update_compress_threads_counts() to ram-compress.c Date: Tue, 13 Jun 2023 16:57:47 +0200 Message-Id: <20230613145757.10131-9-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668623249100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.h | 1 + migration/ram-compress.c | 17 +++++++++++++++++ migration/ram.c | 15 --------------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/migration/ram-compress.h b/migration/ram-compress.h index 77465dad4b..e55d3b50bd 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -70,5 +70,6 @@ void decompress_data_with_multi_threads(QEMUFile *f, void= *host, int len); =20 void populate_compress(MigrationInfo *info); uint64_t ram_compressed_pages(void); +void update_compress_thread_counts(const CompressParam *param, int bytes_x= mit); =20 #endif diff --git a/migration/ram-compress.c b/migration/ram-compress.c index c48d5c53f6..47b600d62b 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -32,11 +32,14 @@ #include "ram-compress.h" =20 #include "qemu/error-report.h" +#include "qemu/stats64.h" #include "migration.h" #include "options.h" #include "io/channel-null.h" #include "exec/target_page.h" #include "exec/ramblock.h" +#include "ram.h" +#include "migration-stats.h" =20 CompressionStats compression_counters; =20 @@ -508,3 +511,17 @@ uint64_t ram_compressed_pages(void) return compression_counters.pages; } =20 +void update_compress_thread_counts(const CompressParam *param, int bytes_x= mit) +{ + ram_transferred_add(bytes_xmit); + + if (param->result =3D=3D RES_ZEROPAGE) { + stat64_add(&mig_stats.zero_pages, 1); + return; + } + + /* 8 means a header with RAM_SAVE_FLAG_CONTINUE. */ + compression_counters.compressed_size +=3D bytes_xmit - 8; + compression_counters.pages++; +} + diff --git a/migration/ram.c b/migration/ram.c index 13c518f81a..53dec4d305 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1259,21 +1259,6 @@ static int ram_save_multifd_page(QEMUFile *file, RAM= Block *block, return 1; } =20 -static void -update_compress_thread_counts(const CompressParam *param, int bytes_xmit) -{ - ram_transferred_add(bytes_xmit); - - if (param->result =3D=3D RES_ZEROPAGE) { - stat64_add(&mig_stats.zero_pages, 1); - return; - } - - /* 8 means a header with RAM_SAVE_FLAG_CONTINUE. */ - compression_counters.compressed_size +=3D bytes_xmit - 8; - compression_counters.pages++; -} - static int send_queued_data(CompressParam *param) { PageSearchStatus *pss =3D &ram_state->pss[RAM_CHANNEL_PRECOPY]; --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668364; cv=none; d=zohomail.com; s=zohoarc; b=MWpx+Xv/faJj5DZZCRlPVX+k3kDxGr7KWzs5jO5JenXWa3aHlU/FAsUdcBcQXfa74lhmjSegZ6P78J9YqkpNiy6TIV0MpGTd2w6rFFz4UTs/N4yhDDzeijo89tCrqgcqoxQFgPNea2jjw9PWJYSkLSHqCJd/gId4XkvIZdCUARM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668364; 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=c767jYGipjzdAjfPD7K5FSit3BxPU+40ApOONyr+N+Y=; b=cEwlXjfBAjDxftHJfkCfxICNmvTHna9CU8ubRANgphKv3fFZEzwZ90MYc20HBVuXYHnCeF36D3pbs+YKMlVgl59o3N2NhQR6p1WQsFOMUpa3X0P8zYkLM6criSE4aAHC0Ie1uldLqm4zaKg9zc5SzFIpXjtwwxdgH/MeM4fgkh8= 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 168666836471940.805069325873546; Tue, 13 Jun 2023 07:59:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TW-0006EY-SI; Tue, 13 Jun 2023 10:58:26 -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 1q95TP-0006AV-B9 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:20 -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 1q95TL-0007YQ-Dv for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:18 -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-90-ylHaB08LPiu1wT6mDZpJ6A-1; Tue, 13 Jun 2023 10:58:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D73E93C11CD3; Tue, 13 Jun 2023 14:58:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA3E040C6CD7; Tue, 13 Jun 2023 14:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668294; 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=c767jYGipjzdAjfPD7K5FSit3BxPU+40ApOONyr+N+Y=; b=feovnpNrdz1yR+e9lifWjLAndeQoOCJO3HW982QSwC2mXC/BxCCPoMqS9xMOS4aR1Ze/U3 BxEdnSXeVmC+OCcSPk5y8nL0Wb6s1DYxULjx5U8+OYogityoLmh3dghwiTdyWcmg7C9eZF 4j7Qm+bAM/WtjTlpGEbSY01jI71fw4g= X-MC-Unique: ylHaB08LPiu1wT6mDZpJ6A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 09/18] migration: Make compress_data_with_multithreads return bool Date: Tue, 13 Jun 2023 16:57:48 +0200 Message-Id: <20230613145757.10131-10-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668365182100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/ram-compress.h | 4 ++-- migration/ram-compress.c | 17 ++++++++++------- migration/ram.c | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/migration/ram-compress.h b/migration/ram-compress.h index e55d3b50bd..b228640092 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -60,8 +60,8 @@ void compress_threads_save_cleanup(void); int compress_threads_save_setup(void); =20 void flush_compressed_data(int (send_queued_data(CompressParam *))); -int compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, - int (send_queued_data(CompressParam *))); +bool compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, + int (send_queued_data(CompressParam = *))); =20 int wait_for_decompress_done(void); void compress_threads_load_cleanup(void); diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 47b600d62b..8ce9519f3d 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -262,10 +262,13 @@ static inline void set_compress_params(CompressParam = *param, RAMBlock *block, param->trigger =3D true; } =20 -int compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, - int (send_queued_data(CompressParam *))) +/* + * Return true when it compress a page + */ +bool compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, + int (send_queued_data(CompressParam *= ))) { - int idx, thread_count, pages =3D -1; + int idx, thread_count; bool wait =3D migrate_compress_wait_thread(); =20 thread_count =3D migrate_compress_threads(); @@ -283,8 +286,8 @@ retry: =20 qemu_cond_signal(¶m->cond); qemu_mutex_unlock(¶m->mutex); - pages =3D 1; - break; + qemu_mutex_unlock(&comp_done_lock); + return true; } } =20 @@ -292,13 +295,13 @@ retry: * wait for the free thread if the user specifies 'compress-wait-threa= d', * otherwise we will post the page out in the main thread as normal pa= ge. */ - if (pages < 0 && wait) { + if (wait) { qemu_cond_wait(&comp_done_cond, &comp_done_lock); goto retry; } qemu_mutex_unlock(&comp_done_lock); =20 - return pages; + return false; } =20 /* return the size after decompression, or negative value on error */ diff --git a/migration/ram.c b/migration/ram.c index 53dec4d305..2a3ff2c36e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2034,7 +2034,7 @@ static bool save_compress_page(RAMState *rs, PageSear= chStatus *pss, return false; } =20 - if (compress_page_with_multi_thread(block, offset, send_queued_data) >= 0) { + if (compress_page_with_multi_thread(block, offset, send_queued_data)) { return true; } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668801; cv=none; d=zohomail.com; s=zohoarc; b=gdebhMxso2j+q8fIECZvKqW/qe9xPkXqAdzGXHqX+76qeoZ23lBjHCE+z0Y9fIUFzSnOiToLPa5YlFGZUs1AOTQHlppIpF6TQoDLWnumf9Ygt6bA0t1ChZc/08BCnzR89u1u9gIfKOtH2AHNZVhgeQwTOgg+PFJMQ9OF74d0v6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668801; 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=5QaxHG+LmfAB5VqZ9Nwjn2fcIfi43u55saowATej41Q=; b=f+W0P/74vQWJWGK9At3LQvQbstif5PuVpt4qT91H80WKOcROvVa5l2VowKoMzuHLNlRiDImSax1bk50cbCPXM/NzcDYFULatSiS8/0aTsVAne1qCRm1Z3YBtz2DoVHt+eAEKGruU2ixNhJjZJMqv2gOkMY//3z5kNlUhoyHHhUY= 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 1686668801873194.45886354481343; Tue, 13 Jun 2023 08:06:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TX-0006El-G3; Tue, 13 Jun 2023 10:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TN-0006AC-D6 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TL-0007YC-6y for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-279-iEnqKrlHMbiKq9Ffol3Yhw-1; Tue, 13 Jun 2023 10:58:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1352D101A531; Tue, 13 Jun 2023 14:58:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 278BB40C6F5E; Tue, 13 Jun 2023 14:58:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668294; 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=5QaxHG+LmfAB5VqZ9Nwjn2fcIfi43u55saowATej41Q=; b=gGcAlaM+9GsqPuXo2VjJ9HkhDYn43Eec/fY6HGEsVWE0MLgXilz7RgbzIsTrNb6JXNRD+A iaXbvtyBd9wwtloZdWOO68iHCcmpcHn39Tg6AsOQf+pUCmFqDhquyN4Do6+zf2UeA15/Zi KemWuWINox3hJqG2A+c3qChpcNi0OVk= X-MC-Unique: iEnqKrlHMbiKq9Ffol3Yhw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 10/18] migration: Simplify compress_page_with_multithread() Date: Tue, 13 Jun 2023 16:57:49 +0200 Message-Id: <20230613145757.10131-11-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668868083100005 Content-Type: text/plain; charset="utf-8" Move the goto to a while true. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.c | 48 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 8ce9519f3d..3c44803132 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -273,35 +273,35 @@ bool compress_page_with_multi_thread(RAMBlock *block,= ram_addr_t offset, =20 thread_count =3D migrate_compress_threads(); qemu_mutex_lock(&comp_done_lock); -retry: - for (idx =3D 0; idx < thread_count; idx++) { - if (comp_param[idx].done) { - CompressParam *param =3D &comp_param[idx]; - qemu_mutex_lock(¶m->mutex); - param->done =3D false; - send_queued_data(param); - assert(qemu_file_buffer_empty(param->file)); - compress_reset_result(param); - set_compress_params(param, block, offset); =20 - qemu_cond_signal(¶m->cond); - qemu_mutex_unlock(¶m->mutex); + while (true) { + for (idx =3D 0; idx < thread_count; idx++) { + if (comp_param[idx].done) { + CompressParam *param =3D &comp_param[idx]; + qemu_mutex_lock(¶m->mutex); + param->done =3D false; + send_queued_data(param); + assert(qemu_file_buffer_empty(param->file)); + compress_reset_result(param); + set_compress_params(param, block, offset); + + qemu_cond_signal(¶m->cond); + qemu_mutex_unlock(¶m->mutex); + qemu_mutex_unlock(&comp_done_lock); + return true; + } + } + if (!wait) { qemu_mutex_unlock(&comp_done_lock); - return true; + return false; } - } - - /* - * wait for the free thread if the user specifies 'compress-wait-threa= d', - * otherwise we will post the page out in the main thread as normal pa= ge. - */ - if (wait) { + /* + * wait for a free thread if the user specifies + * 'compress-wait-thread', otherwise we will post the page out + * in the main thread as normal page. + */ qemu_cond_wait(&comp_done_cond, &comp_done_lock); - goto retry; } - qemu_mutex_unlock(&comp_done_lock); - - return false; } =20 /* return the size after decompression, or negative value on error */ --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668377; cv=none; d=zohomail.com; s=zohoarc; b=Wsh/VF19y9c39FQRD1Rn4zJm1sSssabVjTJ27NggzyKHH8dSi92eZeb/Wvo8sjlD8yGk3kUKtWXBQkcVHaEpKYHa5lAwo/XNmKi+u2GYefUROpFr6lkVhg3OoWvIpR1Fp36oyEKcXXndwU50Czkj455CpaDESxrb3wXOBlszRP0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668377; 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=5u+tuTyHdYcoPsVBpk4oMKPHwy05vocsbj2T88lAuiY=; b=X7+qRRJul992D/gGX95EOxNy5iM1WYlV//v0v/hJoMWcRs8lLjurju9U2r+JLPQMApaYSZxjvuxHKBdbh9euti/cUz65jTpuIMMKfR5cG9IWvKO8w6yuHVc9FoH0YivQ28IMjd0etQoob+f5ssVkIFo0Xet8ds7fORj1WjywdWQ= 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 1686668377120867.61955855367; Tue, 13 Jun 2023 07:59:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TV-0006ED-Nc; Tue, 13 Jun 2023 10:58:25 -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 1q95TO-0006AJ-HW for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:19 -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 1q95TN-0007Yl-56 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:18 -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-117-EFz01cNIOV-HsKcgN3jJEw-1; Tue, 13 Jun 2023 10:58:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 47F4F3C11CC0; Tue, 13 Jun 2023 14:58:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A08240C6F5C; Tue, 13 Jun 2023 14:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668296; 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=5u+tuTyHdYcoPsVBpk4oMKPHwy05vocsbj2T88lAuiY=; b=c0PLtvWaazd7ZZEKvYhhSG9Ep7Pn/bVKIHIfpIUZ1A7EoScrUYPDejE0epivLeTDpdOKlc r25zx2lgS1/icbffVVO0f66c2quQZGvXvKG0EszMrYGsrMteyF5d0SeJdizUS5eC0/nXZo WHxI2Xvtc5dTEnxw1A11IFNOFeZqrkg= X-MC-Unique: EFz01cNIOV-HsKcgN3jJEw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 11/18] migration: Move busy++ to migrate_with_multithread Date: Tue, 13 Jun 2023 16:57:50 +0200 Message-Id: <20230613145757.10131-12-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668378976100003 Content-Type: text/plain; charset="utf-8" And now we can simplify save_compress_page(). Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.c | 1 + migration/ram.c | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 3c44803132..2652cdee8b 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -293,6 +293,7 @@ bool compress_page_with_multi_thread(RAMBlock *block, r= am_addr_t offset, } if (!wait) { qemu_mutex_unlock(&comp_done_lock); + compression_counters.busy++; return false; } /* diff --git a/migration/ram.c b/migration/ram.c index 2a3ff2c36e..60f24006bc 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2034,12 +2034,7 @@ static bool save_compress_page(RAMState *rs, PageSea= rchStatus *pss, return false; } =20 - if (compress_page_with_multi_thread(block, offset, send_queued_data)) { - return true; - } - - compression_counters.busy++; - return false; + return compress_page_with_multi_thread(block, offset, send_queued_data= ); } =20 /** --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668358; cv=none; d=zohomail.com; s=zohoarc; b=iNR9JLxTEOlW+41/q8M9vMplAE63oJQ5CZ/038IW8v4MAf14bVYeH1oXIY/IdsOfQYvVgQPzs7bZ5Hlw95BSK57ntH1Bseg2fANJvISG98Qw6Iop0zuGC9GtvEvqOSnxwCppIWqPIpLynKerLD456EkpgJQAw5OupMTherm6bSQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668358; 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=v558RLr6WgkcbOztgEE4mV8ORUZbrNghlZK35hjC7OA=; b=aPc0pWS9XpT6atZZhi6bxpNcu+bOBiA63nXN8wSghUvuteJS4M9daogNUdne+fqgEiF2JSsVeuJp/TNkjkVIPgS6nYso1D65XQcOcTO/eDwQVUB1C6vjhxIxldU4LG9g12Uc1qF3LlMQguWDTzyumYEqbJHQMfLpvE50YVkrsGg= 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 1686668358209260.05384487528306; Tue, 13 Jun 2023 07:59:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TZ-0006GW-BS; Tue, 13 Jun 2023 10:58:29 -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 1q95TR-0006B3-4d for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:23 -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 1q95TP-0007ZY-C5 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:20 -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-567-fO7T3T5FOAuaT5AQ-hQQ2w-1; Tue, 13 Jun 2023 10:58:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D0BB85A5BE; Tue, 13 Jun 2023 14:58:14 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F7EB40C6F5C; Tue, 13 Jun 2023 14:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668298; 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=v558RLr6WgkcbOztgEE4mV8ORUZbrNghlZK35hjC7OA=; b=TxWdvrMPKtE3xJlDp1m/8K3eixFfAlzfie6BGcVwJycWQ//KgiYFrdRLzptbPO5/ykNIAP EvhcGnDzDq4ghIIMCUlnxuvVXNIBlLEGNFM+aheLoqH6czhIIMWpu+RC9YdSlemTShCRAP 3VfunZsSc1xoUciJWZGbZaqlHqGfiCE= X-MC-Unique: fO7T3T5FOAuaT5AQ-hQQ2w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 12/18] migration: Create compression_update_rates() Date: Tue, 13 Jun 2023 16:57:51 +0200 Message-Id: <20230613145757.10131-13-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668359711100003 Content-Type: text/plain; charset="utf-8" So we can move more compression_counters stuff to ram-compress.c. Create compression_counters struct to add the stuff that was on MigrationState. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.h | 1 + migration/ram.h | 1 - migration/ram-compress.c | 41 +++++++++++++++++++++++++++++++++++++++- migration/ram.c | 29 +--------------------------- 4 files changed, 42 insertions(+), 30 deletions(-) diff --git a/migration/ram-compress.h b/migration/ram-compress.h index b228640092..a7eb028849 100644 --- a/migration/ram-compress.h +++ b/migration/ram-compress.h @@ -71,5 +71,6 @@ void decompress_data_with_multi_threads(QEMUFile *f, void= *host, int len); void populate_compress(MigrationInfo *info); uint64_t ram_compressed_pages(void); void update_compress_thread_counts(const CompressParam *param, int bytes_x= mit); +void compression_update_rates(uint64_t page_count); =20 #endif diff --git a/migration/ram.h b/migration/ram.h index ea1f3c25b5..60bc4c9e3a 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -34,7 +34,6 @@ #include "io/channel.h" =20 extern XBZRLECacheStats xbzrle_counters; -extern CompressionStats compression_counters; =20 bool ramblock_is_ignored(RAMBlock *block); /* Should be holding either ram_list.mutex, or the RCU lock. */ diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 2652cdee8b..5e1bb82fcd 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -41,7 +41,20 @@ #include "ram.h" #include "migration-stats.h" =20 -CompressionStats compression_counters; +static struct { + int64_t pages; + int64_t busy; + double busy_rate; + int64_t compressed_size; + double compression_rate; + /* compression statistics since the beginning of the period */ + /* amount of count that no free thread to compress data */ + uint64_t compress_thread_busy_prev; + /* amount bytes after compression */ + uint64_t compressed_size_prev; + /* amount of compressed pages */ + uint64_t compress_pages_prev; +} compression_counters; =20 static CompressParam *comp_param; static QemuThread *compress_threads; @@ -529,3 +542,29 @@ void update_compress_thread_counts(const CompressParam= *param, int bytes_xmit) compression_counters.pages++; } =20 +void compression_update_rates(uint64_t page_count) +{ + if (migrate_compress()) { + compression_counters.busy_rate =3D (double)(compression_counters.b= usy - + compression_counters.compress_thread_busy_prev) / page_count; + compression_counters.compress_thread_busy_prev =3D + compression_counters.busy; + + double compressed_size =3D compression_counters.compressed_size - + compression_counters.compressed_size_prev; + if (compressed_size) { + double uncompressed_size =3D (compression_counters.pages - + compression_counters.compress_pages_prev) * + qemu_target_page_size(); + + /* Compression-Ratio =3D Uncompressed-size / Compressed-size */ + compression_counters.compression_rate =3D + uncompressed_size / compressed_siz= e; + + compression_counters.compress_pages_prev =3D + compression_counters.pages; + compression_counters.compressed_size_prev =3D + compression_counters.compressed_size; + } + } +} diff --git a/migration/ram.c b/migration/ram.c index 60f24006bc..1bd586c23a 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -364,13 +364,6 @@ struct RAMState { bool xbzrle_started; /* Are we on the last stage of migration */ bool last_stage; - /* compression statistics since the beginning of the period */ - /* amount of count that no free thread to compress data */ - uint64_t compress_thread_busy_prev; - /* amount bytes after compression */ - uint64_t compressed_size_prev; - /* amount of compressed pages */ - uint64_t compress_pages_prev; =20 /* total handled target pages at the beginning of period */ uint64_t target_page_count_prev; @@ -933,7 +926,6 @@ uint64_t ram_get_total_transferred_pages(void) static void migration_update_rates(RAMState *rs, int64_t end_time) { uint64_t page_count =3D rs->target_page_count - rs->target_page_count_= prev; - double compressed_size; =20 /* calculate period counters */ stat64_set(&mig_stats.dirty_pages_rate, @@ -961,26 +953,7 @@ static void migration_update_rates(RAMState *rs, int64= _t end_time) rs->xbzrle_pages_prev =3D xbzrle_counters.pages; rs->xbzrle_bytes_prev =3D xbzrle_counters.bytes; } - - if (migrate_compress()) { - compression_counters.busy_rate =3D (double)(compression_counters.b= usy - - rs->compress_thread_busy_prev) / page_count; - rs->compress_thread_busy_prev =3D compression_counters.busy; - - compressed_size =3D compression_counters.compressed_size - - rs->compressed_size_prev; - if (compressed_size) { - double uncompressed_size =3D (compression_counters.pages - - rs->compress_pages_prev) * TARGET_PAGE= _SIZE; - - /* Compression-Ratio =3D Uncompressed-size / Compressed-size */ - compression_counters.compression_rate =3D - uncompressed_size / compressed_siz= e; - - rs->compress_pages_prev =3D compression_counters.pages; - rs->compressed_size_prev =3D compression_counters.compressed_s= ize; - } - } + compression_update_rates(page_count); } =20 static void migration_trigger_throttle(RAMState *rs) --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668776; cv=none; d=zohomail.com; s=zohoarc; b=IEdSJylSmcnLBzsz5N3M6RSmPWjaLN1WycG9r5HU4vl6zewCwfCxNNP01YDVOW8QX8M7W16YkbxeseviYzSkXBMovKj6hfOMHg7pzPozsYFY84Kog0vAZQhNo662mtsAlCdK1eTuLUw+VVNaRif94EyP1FwLN+59mY2skhvQTA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668776; 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=u6yZ98f+/mqkbFcKCuQfUUgo2LiE0FyqRaP8zx8asoo=; b=gxY9wIpsq0EznBBK29DuS5WSeUZpZo9bgX61lPwi8HybN3bUK0o8VkACVpqOrYdwfGhqEA1aMj8pbSMDA3oIk8DTH7QUS62+8uX1fTWg7n4X4Cxy2ogn3uP235Ox/I+qbgker3k8IWuwlE/pViY2/7tlomaxHhGQDx4DcKjlcOc= 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 1686668776651844.2542057385187; Tue, 13 Jun 2023 08:06:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TX-0006FB-Ta; Tue, 13 Jun 2023 10:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TS-0006Bo-7D for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:23 -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 1q95TQ-0007Zs-Pq for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:21 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-63-Ue2hunVINAGtY5YKyhkc3Q-1; Tue, 13 Jun 2023 10:58:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2E0E803DBF; Tue, 13 Jun 2023 14:58:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id C395E40C6F5E; Tue, 13 Jun 2023 14:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668300; 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=u6yZ98f+/mqkbFcKCuQfUUgo2LiE0FyqRaP8zx8asoo=; b=MDZ4+kJdlT/y60n6AgRhpxK06/4A/cGhvk+NMwDY3ZWD0RVYEyiYxFhX2Vp7w09AIfvN5+ 9FiERQq/DHmWGnYzPiM6+DqkA/PuIsOXzYUuuxoW2fPZz1B3GMdu1m09vcmYpoMbXNi86x XED6fZeK3nB65SaXfEn43eKUXeUfkXg= X-MC-Unique: Ue2hunVINAGtY5YKyhkc3Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 13/18] migration: Simplify decompress_data_with_multi_threads() Date: Tue, 13 Jun 2023 16:57:52 +0200 Message-Id: <20230613145757.10131-14-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668778584100003 Content-Type: text/plain; charset="utf-8" Doing a break to do another break is just confused. Just call return when we know we want to return. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index 5e1bb82fcd..cf3a6c238d 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -498,14 +498,10 @@ void decompress_data_with_multi_threads(QEMUFile *f, = void *host, int len) decomp_param[idx].len =3D len; qemu_cond_signal(&decomp_param[idx].cond); qemu_mutex_unlock(&decomp_param[idx].mutex); - break; + return; } } - if (idx < thread_count) { - break; - } else { - qemu_cond_wait(&decomp_done_cond, &decomp_done_lock); - } + qemu_cond_wait(&decomp_done_cond, &decomp_done_lock); } } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668511; cv=none; d=zohomail.com; s=zohoarc; b=kHL0G9YYMvlDp7TdPhbClkds/S6X75W0adWSClVNbG7FHWRfppv0GygSVuKj4r7lehsdqzswCAJm0kt7hRIQSF4aBScQp8XO3V4BkwqQwQzJBazU58rWH7tNBQQhc577qSdzPfY8Fhk5KjM4jsWYjiNe3VLIgQs5jqF1Ebu00j0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668511; 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=ulfFLbOBAIT59r7Ub4yug/+2xRy7DXVbPJWIbgsules=; b=KSsJX5rEjfgePUgCN35JPVS9Gz/F21F/XYp6LvR1L3ydl+KisFUoKyaSnXcV24lm7qG6++DlvW62QqkpPsBQLAy9duMfVYxlGwBB7yBJQN7Q/cB8jyMccFnUAVwkj4JqeZt5VnOviJbRW3g3TDHTY/cESbEQrhYCCmKNOeapLnw= 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 1686668511619742.5875920497275; Tue, 13 Jun 2023 08:01:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TX-0006Ea-3w; Tue, 13 Jun 2023 10:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TR-0006Av-1S for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:21 -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 1q95TP-0007Zb-C8 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:20 -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-623-mtmIHWMxNmWKhxC9xjcQNw-1; Tue, 13 Jun 2023 10:58:17 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E64F23855561; Tue, 13 Jun 2023 14:58:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 042DA40C6F5C; Tue, 13 Jun 2023 14:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668298; 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=ulfFLbOBAIT59r7Ub4yug/+2xRy7DXVbPJWIbgsules=; b=CF0HhMP4wDZk8I0oS1yF7nYZILvEp9r2HClRih7Q5LIkNcgciuPTnhPLNolavAPseNg9ew KbAvVdln297Ont92eFl4UZALc0cFzpz1+9cbJ7sNaVrhKWzc9yu3KwRbdmfCHWRWnrJNGp mdYIYKaMNuBq9DjmLpxWIyJYEuME8JE= X-MC-Unique: mtmIHWMxNmWKhxC9xjcQNw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 14/18] migration: Use "i" as an for index in ram-compress.c Date: Tue, 13 Jun 2023 16:57:53 +0200 Message-Id: <20230613145757.10131-15-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668522641100001 Content-Type: text/plain; charset="utf-8" It is used everywhere else in C. Once there, make sure that we don't use the index outside of the for declaring the variable there. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram-compress.c | 57 ++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/migration/ram-compress.c b/migration/ram-compress.c index cf3a6c238d..a23531606e 100644 --- a/migration/ram-compress.c +++ b/migration/ram-compress.c @@ -243,27 +243,25 @@ static inline void compress_reset_result(CompressPara= m *param) =20 void flush_compressed_data(int (send_queued_data(CompressParam *))) { - int idx, thread_count; - - thread_count =3D migrate_compress_threads(); + int thread_count =3D migrate_compress_threads(); =20 qemu_mutex_lock(&comp_done_lock); - for (idx =3D 0; idx < thread_count; idx++) { - while (!comp_param[idx].done) { + for (int i =3D 0; i < thread_count; i++) { + while (!comp_param[i].done) { qemu_cond_wait(&comp_done_cond, &comp_done_lock); } } qemu_mutex_unlock(&comp_done_lock); =20 - for (idx =3D 0; idx < thread_count; idx++) { - qemu_mutex_lock(&comp_param[idx].mutex); - if (!comp_param[idx].quit) { - CompressParam *param =3D &comp_param[idx]; + for (int i =3D 0; i < thread_count; i++) { + qemu_mutex_lock(&comp_param[i].mutex); + if (!comp_param[i].quit) { + CompressParam *param =3D &comp_param[i]; send_queued_data(param); assert(qemu_file_buffer_empty(param->file)); compress_reset_result(param); } - qemu_mutex_unlock(&comp_param[idx].mutex); + qemu_mutex_unlock(&comp_param[i].mutex); } } =20 @@ -281,16 +279,15 @@ static inline void set_compress_params(CompressParam = *param, RAMBlock *block, bool compress_page_with_multi_thread(RAMBlock *block, ram_addr_t offset, int (send_queued_data(CompressParam *= ))) { - int idx, thread_count; bool wait =3D migrate_compress_wait_thread(); =20 - thread_count =3D migrate_compress_threads(); + int thread_count =3D migrate_compress_threads(); qemu_mutex_lock(&comp_done_lock); =20 while (true) { - for (idx =3D 0; idx < thread_count; idx++) { - if (comp_param[idx].done) { - CompressParam *param =3D &comp_param[idx]; + for (int i =3D 0; i < thread_count; i++) { + if (comp_param[i].done) { + CompressParam *param =3D &comp_param[i]; qemu_mutex_lock(¶m->mutex); param->done =3D false; send_queued_data(param); @@ -384,16 +381,14 @@ static void *do_data_decompress(void *opaque) =20 int wait_for_decompress_done(void) { - int idx, thread_count; - if (!migrate_compress()) { return 0; } =20 - thread_count =3D migrate_decompress_threads(); + int thread_count =3D migrate_decompress_threads(); qemu_mutex_lock(&decomp_done_lock); - for (idx =3D 0; idx < thread_count; idx++) { - while (!decomp_param[idx].done) { + for (int i =3D 0; i < thread_count; i++) { + while (!decomp_param[i].done) { qemu_cond_wait(&decomp_done_cond, &decomp_done_lock); } } @@ -484,20 +479,18 @@ exit: =20 void decompress_data_with_multi_threads(QEMUFile *f, void *host, int len) { - int idx, thread_count; - - thread_count =3D migrate_decompress_threads(); + int thread_count =3D migrate_decompress_threads(); QEMU_LOCK_GUARD(&decomp_done_lock); while (true) { - for (idx =3D 0; idx < thread_count; idx++) { - if (decomp_param[idx].done) { - decomp_param[idx].done =3D false; - qemu_mutex_lock(&decomp_param[idx].mutex); - qemu_get_buffer(f, decomp_param[idx].compbuf, len); - decomp_param[idx].des =3D host; - decomp_param[idx].len =3D len; - qemu_cond_signal(&decomp_param[idx].cond); - qemu_mutex_unlock(&decomp_param[idx].mutex); + for (int i =3D 0; i < thread_count; i++) { + if (decomp_param[i].done) { + decomp_param[i].done =3D false; + qemu_mutex_lock(&decomp_param[i].mutex); + qemu_get_buffer(f, decomp_param[i].compbuf, len); + decomp_param[i].des =3D host; + decomp_param[i].len =3D len; + qemu_cond_signal(&decomp_param[i].cond); + qemu_mutex_unlock(&decomp_param[i].mutex); return; } } --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668511; cv=none; d=zohomail.com; s=zohoarc; b=TKossyGMMFKv0pcJfE5jKiwdb+QgmZDnsqI+pM5+3Kxje7iIctGLWWqBwQPXQ+51P25KVYye+/ILiOHnifZ74BOEKk9rglLOUYQQf7AcoGcynNCoR05F6juEnMbTDD97XZVKNxpPoI5LBKUbFya00xh+Wf7hbTVoUSS9jDOlo5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668511; 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=Pvo7dw/k63TnR6NweiqCcskG3T/Fy7l5tP+kzkTWyjw=; b=iQ7zt9gk+4bojjtlESyaKknlnNMcb2mO4EJYqwoJl0iwKlfQPOUf7J9NMFHKKw9TRAS9jg1msbPGL52XdLY29jP5QAbdvOWVAhDXTri+QToLjQIVLSLDTsZQqBtAnE1PhOLshuaRDSpvbzzAezqBs58hh3Hm06/kEzHdix3r90E= 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 1686668511935315.3994629297266; Tue, 13 Jun 2023 08:01:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TY-0006Fi-Aa; Tue, 13 Jun 2023 10:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TU-0006Cm-37 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TS-0007aW-Ok for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:23 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-605-58XYXCRMPHiuOtjwE-yc1Q-1; Tue, 13 Jun 2023 10:58:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25C29185A795; Tue, 13 Jun 2023 14:58:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38DCD40C6F5C; Tue, 13 Jun 2023 14:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668302; 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=Pvo7dw/k63TnR6NweiqCcskG3T/Fy7l5tP+kzkTWyjw=; b=C+rRINaWNICF+3sDcIM7Tq/cZift0XOyrJBxc6cJeiIckTm5mlqHti7yyHdh4GTVU5E7B8 Gi7frcRJjSbwrH96kvI7t7TtKFNxFX+60addhAWwHab6nQoBdVOYzque65IOJpewFwN91b Xi81uaFM6+zX+vZ4+fkXtqiABIZmgJI= X-MC-Unique: 58XYXCRMPHiuOtjwE-yc1Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 15/18] migration: save_compress_page() can take block through pss Date: Tue, 13 Jun 2023 16:57:54 +0200 Message-Id: <20230613145757.10131-16-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668528494100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 1bd586c23a..e3ff98a6ce 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1986,7 +1986,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr= _t start, ram_addr_t len) * paths to handle it */ static bool save_compress_page(RAMState *rs, PageSearchStatus *pss, - RAMBlock *block, ram_addr_t offset) + ram_addr_t offset) { if (!migrate_compress()) { return false; @@ -2002,12 +2002,13 @@ static bool save_compress_page(RAMState *rs, PageSe= archStatus *pss, * We post the fist page as normal page as compression will take * much CPU resource. */ - if (block !=3D pss->last_sent_block) { + if (pss->block !=3D pss->last_sent_block) { ram_flush_compressed_data(); return false; } =20 - return compress_page_with_multi_thread(block, offset, send_queued_data= ); + return compress_page_with_multi_thread(pss->block, offset, + send_queued_data); } =20 /** @@ -2028,7 +2029,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) return res; } =20 - if (save_compress_page(rs, pss, block, offset)) { + if (save_compress_page(rs, pss, offset)) { return 1; } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668400; cv=none; d=zohomail.com; s=zohoarc; b=OsL6GaeCtbQt8e/2rq9S1UWNvHuPoD5KY9fc9S5SyVaNlbVkh2uy6clApbGT1fOEnCPiyHnB8D/H3NiWwCawd2LCuSTVdxBj3X6f4aFvK6vHCf418z+/1BHPTV4LQJqUSv0bKGrN9D68Z81E8I5l8AgC87QvW+FNGs4HSAWGRDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668400; 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=syZYUbF0RRsso7q5i6xC2UsHkPUInHWHOLDSqW2YAak=; b=jPq6g+fz1QLGd3UtOGy3TwXwsN9neURULGx+yMoanFL9gsMQuAdFNdyyX+hZX12OuAzGKGxxH/CYsxgNxcpLuO0JZKk6bK0x3jOcrgpTF2wzYBI42cp1UxO/DrTM3hKngc49BVH89DoAkmTv+xTgX4PX7vR6F7eKQIFabyVVL8Q= 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 1686668400919146.91171212030065; Tue, 13 Jun 2023 08:00:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95Ta-0006H8-DS; Tue, 13 Jun 2023 10:58:30 -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 1q95TU-0006Ce-1V for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:24 -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 1q95TS-0007aL-66 for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:23 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-36-cUpnqGSANLiqAwc-65ZLvw-1; Tue, 13 Jun 2023 10:58:20 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 57B85280158F; Tue, 13 Jun 2023 14:58:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B44640C6F5C; Tue, 13 Jun 2023 14:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668301; 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=syZYUbF0RRsso7q5i6xC2UsHkPUInHWHOLDSqW2YAak=; b=OPGEprAsHgYL0Rnnmz8umYF5mXcHdmJbuRy4sJAB+TooC00CLqnJhLMwAoqQ/k4ft60x21 5H84d6G7o23hcWgsja2RFrlFv140J4UTpkTwqb0TZTV3Veb6M2IsYBkAk1QySj3PZb8Uwc tTJjrOoNkcVobL0soSMdIOYNC2UjmFQ= X-MC-Unique: cUpnqGSANLiqAwc-65ZLvw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 16/18] migration: control_save_page() can take block through pss Date: Tue, 13 Jun 2023 16:57:55 +0200 Message-Id: <20230613145757.10131-17-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668401289100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index e3ff98a6ce..293ea87a70 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1114,14 +1114,14 @@ static int save_zero_page(PageSearchStatus *pss, QE= MUFile *f, RAMBlock *block, * * Return true if the pages has been saved, otherwise false is returned. */ -static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, +static bool control_save_page(PageSearchStatus *pss, ram_addr_t offset, int *pages) { uint64_t bytes_xmit =3D 0; int ret; =20 *pages =3D -1; - ret =3D ram_control_save_page(pss->pss_channel, block->offset, offset, + ret =3D ram_control_save_page(pss->pss_channel, pss->block->offset, of= fset, TARGET_PAGE_SIZE, &bytes_xmit); if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { return false; @@ -2025,7 +2025,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) ram_addr_t offset =3D ((ram_addr_t)pss->page) << TARGET_PAGE_BITS; int res; =20 - if (control_save_page(pss, block, offset, &res)) { + if (control_save_page(pss, offset, &res)) { return res; } =20 --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668780; cv=none; d=zohomail.com; s=zohoarc; b=aouT3PBT0H+hrJZTfqEKFiP2evXtdbc2Fu2uPqpXxcwsYcLhPvXuuXqY22i2uujaus2xI+P7GOD6RcysVUOxNOfbfRXsHPZA8kggbthfzYSY5DHlamhmJRmzMjfWlpPpTA5KAG0h85O5M0x/vMIltONbNbejflRljgTUwJzfKzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668780; 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=t5YGCGVQz6G3iR3YABDPJqBvknSAWfsEV8CrTrsPdWM=; b=iOydpcSBMI7809E9EaKugcKB2IKvKCSy8zB26XdaPRrOH/Ye2tNjFl32sLfwsR4lFIwf8eaFAIui7cdJOkCOBlR8vlmHVN1/4+4yjeGwlNhT9fxVI3CHYhS7sTewYSzcqQzZh69Y2PxqrprqguCIPoiKfpE1dbPp3JLCdtmOh+Y= 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 1686668780304265.50029807203134; Tue, 13 Jun 2023 08:06:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TX-0006F8-TF; Tue, 13 Jun 2023 10:58:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TV-0006EE-Md for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:25 -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 1q95TU-0007af-7y for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-220-xluXWPzYPVWmN0fDp31E_w-1; Tue, 13 Jun 2023 10:58:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B837101A53B; Tue, 13 Jun 2023 14:58:20 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C69440C6F5C; Tue, 13 Jun 2023 14:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668303; 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=t5YGCGVQz6G3iR3YABDPJqBvknSAWfsEV8CrTrsPdWM=; b=HvZv+0kiv8jTIhfmzUjSemS+Az4SxB34zLrV0KxAoOX+8UmYvpRWZJevfrEfpz123p2KBz r2s4tlveR7ffDYpMzH9/LT0qQtTdQCbzc7p7LGwdAG78Zd8rqPdBgehj8Pom13x4dOqvyi D4vjf/ov8upeNIvrTKMMr5SCpLsnQdw= X-MC-Unique: xluXWPzYPVWmN0fDp31E_w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 17/18] migration: Remove not needed block parameter for save_zero_page* Date: Tue, 13 Jun 2023 16:57:56 +0200 Message-Id: <20230613145757.10131-18-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1686668780720100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 293ea87a70..0259c33da7 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1067,20 +1067,20 @@ void ram_release_page(const char *rbname, uint64_t = offset) * a zero page * * @pss: current PSS channel - * @block: block that contains the page we want to send * @offset: offset inside the block for the page */ static int save_zero_page_to_file(PageSearchStatus *pss, QEMUFile *file, - RAMBlock *block, ram_addr_t offset) + ram_addr_t offset) { - uint8_t *p =3D block->host + offset; + uint8_t *p =3D pss->block->host + offset; int len =3D 0; =20 if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { - len +=3D save_page_header(pss, file, block, offset | RAM_SAVE_FLAG= _ZERO); + len +=3D save_page_header(pss, file, pss->block, + offset | RAM_SAVE_FLAG_ZERO); qemu_put_byte(file, 0); len +=3D 1; - ram_release_page(block->idstr, offset); + ram_release_page(pss->block->idstr, offset); } return len; } @@ -1091,13 +1091,11 @@ static int save_zero_page_to_file(PageSearchStatus = *pss, QEMUFile *file, * Returns the number of pages written. * * @pss: current PSS channel - * @block: block that contains the page we want to send * @offset: offset inside the block for the page */ -static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, RAMBlock *bl= ock, - ram_addr_t offset) +static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, ram_addr_t o= ffset) { - int len =3D save_zero_page_to_file(pss, f, block, offset); + int len =3D save_zero_page_to_file(pss, f, offset); =20 if (len) { stat64_add(&mig_stats.zero_pages, 1); @@ -2033,7 +2031,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) return 1; } =20 - res =3D save_zero_page(pss, pss->pss_channel, block, offset); + res =3D save_zero_page(pss, pss->pss_channel, offset); if (res > 0) { /* Must let xbzrle know, otherwise a previous (now 0'd) cached * page would be stale --=20 2.40.1 From nobody Sat May 18 16:47:02 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=1686668469; cv=none; d=zohomail.com; s=zohoarc; b=dzXbpPimHbvC0csF9Gop9GyUGG/ASzONM9mn6VNsySGmlyViySkNjkWUGy+OkmyEZJDcO4abJ+vwFQvZh0lH+9of6dSdKDNqIg/PEij9ol2ammCFqD1ruB55PJmQgO06zt5tBhaeJUbW/7YjuY89FCxQ2Ew/HjXTU9ad4RlJr6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686668469; 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=AYitUFaIA20kYEpVcqSE6/4EobqKj/4bK3euR5gvfvU=; b=FA0cVoh00UHRh5u9iqhgyVBfikZPbHo+Uz1tP+uV76SKA90tWnymMOmZB8CkR61/6/634BJ09GrIYfG2NsdsYGiHM/SX08rdoJYfEDHFukNfW/uBXJcAAuXIbxQZBvFKwfIA6quObABz+Ya/tFq7CjalRNluIyH+8l+Eb5rFsXo= 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 1686668469367861.7193531164485; Tue, 13 Jun 2023 08:01:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q95TY-0006GL-Nu; Tue, 13 Jun 2023 10:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TW-0006EL-0A for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q95TU-0007aq-JX for qemu-devel@nongnu.org; Tue, 13 Jun 2023 10:58:25 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-131-S-lOfaSGPZCfpf2zbqxdSg-1; Tue, 13 Jun 2023 10:58:22 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0D3A1801224; Tue, 13 Jun 2023 14:58:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0F5540C947A; Tue, 13 Jun 2023 14:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686668304; 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=AYitUFaIA20kYEpVcqSE6/4EobqKj/4bK3euR5gvfvU=; b=FRUZlQATFI+nPoZ88rKxMMHtFw2bgd8N2hU5XifTU6b0TJLdEP3PrKGp3hDk8/7l6NklL3 Eet6xLiHnlOQYN8lGedtEsQeEQVPosf3LxjdHrFyGQU77npAdkL5ezniqAvQA0nGlYMiIy I6h+9ywsNeP2q/VK2ha2lWSfkznoFw4= X-MC-Unique: S-lOfaSGPZCfpf2zbqxdSg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Leonardo Bras , Lukas Straub , Juan Quintela Subject: [PATCH 18/18] migration: Remove not needed file parameter for save_zero_page* Date: Tue, 13 Jun 2023 16:57:57 +0200 Message-Id: <20230613145757.10131-19-quintela@redhat.com> In-Reply-To: <20230613145757.10131-1-quintela@redhat.com> References: <20230613145757.10131-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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: 1686668479705100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 0259c33da7..ae11d0e992 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1069,16 +1069,15 @@ void ram_release_page(const char *rbname, uint64_t = offset) * @pss: current PSS channel * @offset: offset inside the block for the page */ -static int save_zero_page_to_file(PageSearchStatus *pss, QEMUFile *file, - ram_addr_t offset) +static int save_zero_page_to_file(PageSearchStatus *pss, ram_addr_t offset) { uint8_t *p =3D pss->block->host + offset; int len =3D 0; =20 if (buffer_is_zero(p, TARGET_PAGE_SIZE)) { - len +=3D save_page_header(pss, file, pss->block, + len +=3D save_page_header(pss, pss->pss_channel, pss->block, offset | RAM_SAVE_FLAG_ZERO); - qemu_put_byte(file, 0); + qemu_put_byte(pss->pss_channel, 0); len +=3D 1; ram_release_page(pss->block->idstr, offset); } @@ -1093,9 +1092,9 @@ static int save_zero_page_to_file(PageSearchStatus *p= ss, QEMUFile *file, * @pss: current PSS channel * @offset: offset inside the block for the page */ -static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, ram_addr_t o= ffset) +static int save_zero_page(PageSearchStatus *pss, ram_addr_t offset) { - int len =3D save_zero_page_to_file(pss, f, offset); + int len =3D save_zero_page_to_file(pss, offset); =20 if (len) { stat64_add(&mig_stats.zero_pages, 1); @@ -2031,7 +2030,7 @@ static int ram_save_target_page_legacy(RAMState *rs, = PageSearchStatus *pss) return 1; } =20 - res =3D save_zero_page(pss, pss->pss_channel, offset); + res =3D save_zero_page(pss, offset); if (res > 0) { /* Must let xbzrle know, otherwise a previous (now 0'd) cached * page would be stale --=20 2.40.1