From nobody Sat May 18 14:54:26 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=1676491664; cv=none; d=zohomail.com; s=zohoarc; b=BliMHMF/vW9cxEnb+y44phlAdHrFxwD7u71S2NfAHh1QWPiumt5W3gLUdd0SiM0M7wEYe2KlFHvhl2hXLQjQF3XY592ARk2hHSrCBdOn+vXewP49fZlc93JCperZFYDi1mkJN94FP4q4bfVmWQ0zAI/GRqRlSLSWMjM43+htx+Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676491664; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MJpg7N2ZV7Mz/ks4UAtfx5cTtvFxrLAvHJbxTW8fDeQ=; b=FzecCeluBeTovtTjOOntrZ8gBUaWOFzVmfQ1oA10F9vJQIeDbXHTHfvhSaDaoKYXDpe2xNkxvNsHFYwkOOwd8swmqKXys27Jrt+Be3KA73G5nPMmA9ooOVEidgM2lgndW+bnGlPIjYSMh09GgpXK7vQ1NTd7TItSVX7gXHvcByo= 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 1676491664802604.6017041811301; Wed, 15 Feb 2023 12:07:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSO2c-0003CH-C5; Wed, 15 Feb 2023 15:06:10 -0500 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 1pSO2a-00039g-G9 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:08 -0500 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 1pSO2Y-0006a6-Th for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:08 -0500 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-392-DPe2qpV5MLS44s0c7h4oOA-1; Wed, 15 Feb 2023 15:06:02 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2FB7B29AA2D0; Wed, 15 Feb 2023 20:06:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id E02F3C15BA0; Wed, 15 Feb 2023 20:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676491566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MJpg7N2ZV7Mz/ks4UAtfx5cTtvFxrLAvHJbxTW8fDeQ=; b=FAfk5YWoIEx1oo7HtSDZhZbhR4zUZEag6r9lNYLxXp/ZBDYkFzHAjfxA70okc7u51IUgT5 h6PJuf+xnLo3SbZZvKJPZLeQoKtQHFQ9KUfRlMukPZH60a8PxHxriE13qxecqnSJnoRu+e oAXkbBSWfnlvabY5nhXZYQAweupqTnA= X-MC-Unique: DPe2qpV5MLS44s0c7h4oOA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , qemu-s390x@nongnu.org, Juan Quintela , Thomas Huth , Halil Pasic , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , Alex Williamson , Ilya Leoshkevich , qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , David Hildenbrand , John Snow , Christian Borntraeger , Richard Henderson , Eric Farman , Avihai Horon , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Subject: [PULL 1/5] migration/qemu-file: Add qemu_file_get_to_fd() Date: Wed, 15 Feb 2023 21:05:50 +0100 Message-Id: <20230215200554.1365-2-quintela@redhat.com> In-Reply-To: <20230215200554.1365-1-quintela@redhat.com> References: <20230215200554.1365-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1676491665106100001 From: Avihai Horon Add new function qemu_file_get_to_fd() that allows reading data from QEMUFile and writing it straight into a given fd. This will be used later in VFIO migration code. Signed-off-by: Avihai Horon Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 + migration/qemu-file.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index fa13d04d78..9d0155a2a1 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -148,6 +148,7 @@ int qemu_file_shutdown(QEMUFile *f); QEMUFile *qemu_file_get_return_path(QEMUFile *f); void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); +int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =20 void ram_control_before_iterate(QEMUFile *f, uint64_t flags); void ram_control_after_iterate(QEMUFile *f, uint64_t flags); diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 2d5f74ffc2..102ab3b439 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -940,3 +940,37 @@ QIOChannel *qemu_file_get_ioc(QEMUFile *file) { return file->ioc; } + +/* + * Read size bytes from QEMUFile f and write them to fd. + */ +int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size) +{ + while (size) { + size_t pending =3D f->buf_size - f->buf_index; + ssize_t rc; + + if (!pending) { + rc =3D qemu_fill_buffer(f); + if (rc < 0) { + return rc; + } + if (rc =3D=3D 0) { + return -EIO; + } + continue; + } + + rc =3D write(fd, f->buf + f->buf_index, MIN(pending, size)); + if (rc < 0) { + return -errno; + } + if (rc =3D=3D 0) { + return -EIO; + } + f->buf_index +=3D rc; + size -=3D rc; + } + + return 0; +} --=20 2.39.1 From nobody Sat May 18 14:54:26 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=1676491642; cv=none; d=zohomail.com; s=zohoarc; b=WQh0IUUjJj7j12JYmEQrR3NG/faQkSfjjti3+WomCY+Rzkn4TGLCUqvSuBbj3B38Uyw6st9pgNQbW01pjy+emCuhLg8zVJZiBXUlVjuL8ir4q0ZfqxY4AezmhzINTsv0B7ZdfDHr1+NxS92E2LwRyEKCwlfOeyZe6bI0nQelNS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676491642; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oYWILZNDRqRKAPG1wFGutXoZk8C18/1z3YfLEmfdUf8=; b=OvTj4zVdPD5sLH6o0cviOJlBSGde0FRqIICs7R5Cl3D1NDzsIrL/2AwDqw+KbAPwTpzP10HJsTHGTWVnprn2ld9/xD6U453iyWt6ePgXzxWWOJdeBQOGFwsVZMlhzN52wTAROtW1pTwgd7klUuv7ZegKrE0XQu3a/YdlU6Ytkg4= 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 1676491642913441.8163809186942; Wed, 15 Feb 2023 12:07:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSO2h-0003Pl-PF; Wed, 15 Feb 2023 15:06:15 -0500 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 1pSO2g-0003Mb-A7 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:14 -0500 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 1pSO2e-0006bD-Dr for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:14 -0500 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-510-7Kmbm_9hOQuBVXrSHfozIw-1; Wed, 15 Feb 2023 15:06:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EE0FD1C08976; Wed, 15 Feb 2023 20:06:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77211C15BAD; Wed, 15 Feb 2023 20:06:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676491571; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oYWILZNDRqRKAPG1wFGutXoZk8C18/1z3YfLEmfdUf8=; b=ah0DD7NqDb/k69dicJFg0OOZm8YxWLoJbbYu4AYefaxfGNgIrA3eXdM9YL244VGg+UVGvH xd1GsaRNyfYAu0ID2bMZyque7s86mx3C9UKBOe1V9ErHQKpVoRwaJIfAdOjI2FmvpLn5Cn xzEdevutlIz3dpNYfxjmV3spCAq0a2o= X-MC-Unique: 7Kmbm_9hOQuBVXrSHfozIw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , qemu-s390x@nongnu.org, Juan Quintela , Thomas Huth , Halil Pasic , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , Alex Williamson , Ilya Leoshkevich , qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , David Hildenbrand , John Snow , Christian Borntraeger , Richard Henderson , Eric Farman , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 2/5] migration/block: Convert remaining DPRINTF() debug macro to trace events Date: Wed, 15 Feb 2023 21:05:51 +0100 Message-Id: <20230215200554.1365-3-quintela@redhat.com> In-Reply-To: <20230215200554.1365-1-quintela@redhat.com> References: <20230215200554.1365-1-quintela@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676491644831100007 From: Philippe Mathieu-Daud=C3=A9 Finish the conversion from commit fe80c0241d ("migration: using trace_ to replace DPRINTF"). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/block.c | 12 +----------- migration/trace-events | 1 + 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/migration/block.c b/migration/block.c index 29f69025af..b5ce506d01 100644 --- a/migration/block.c +++ b/migration/block.c @@ -42,16 +42,6 @@ #define MAX_IO_BUFFERS 512 #define MAX_PARALLEL_IO 16 =20 -/* #define DEBUG_BLK_MIGRATION */ - -#ifdef DEBUG_BLK_MIGRATION -#define DPRINTF(fmt, ...) \ - do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) \ - do { } while (0) -#endif - typedef struct BlkMigDevState { /* Written during setup phase. Can be read without a lock. */ BlockBackend *blk; @@ -502,7 +492,7 @@ static int blk_mig_save_bulked_block(QEMUFile *f) block_mig_state.prev_progress =3D progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); - DPRINTF("Completed %d %%\r", progress); + trace_migration_block_progression(progress); } =20 return ret; diff --git a/migration/trace-events b/migration/trace-events index 67b65a70ff..b20e1271bc 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -357,6 +357,7 @@ migration_block_flush_blks(const char *action, int subm= itted, int read_done, int migration_block_save(const char *mig_stage, int submitted, int transferred= ) "Enter save live %s submitted %d transferred %d" migration_block_save_complete(void) "Block migration completed" migration_block_state_pending(uint64_t pending) "Enter save live pending = %" PRIu64 +migration_block_progression(unsigned percent) "Completed %u%%" =20 # page_cache.c migration_pagecache_init(int64_t max_num_items) "Setting cache buckets to = %" PRId64 --=20 2.39.1 From nobody Sat May 18 14:54:26 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=1676491642; cv=none; d=zohomail.com; s=zohoarc; b=LJ9VOn5u1OPp7ObdLHMDPvi72DiARgTTRvA9xm0v2T4lJAeR3IHaYdZmewirJOIZF5awjZANDgRmS8sPeypCRa4eVuck3cR0/YG9dWxyBNE1Owy+pEBiEB7lNTD9KLI6H0iIOwHa0iSwQ74+yDA0J41i2NOVXSqrRmt3NqBLHA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676491642; 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=8HBDlS8YGQFwLRNtPts38vTJnZT72kt65ZZY6qT/Zzg=; b=Rl+UKJfWcqOopQ/XFVLJQgi4jmK+T32NgafJLj32KbEBFRIgMiwcNwiCBBsfkEGUudlLlUnvewA3hCZMMFMT4Ahxum7J2OWcSWs1T/GMj+SVXjStm3F9Sdf+Z3Otq7cn1lcQ9nQ5ssoH7Df3/P8acOiAeTysvFM/03pAxTH6Tmo= 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 1676491642115140.5540880317434; Wed, 15 Feb 2023 12:07:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSO2n-0003Vv-0m; Wed, 15 Feb 2023 15:06:21 -0500 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 1pSO2l-0003Uc-EJ for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:19 -0500 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 1pSO2i-0006c2-SD for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:19 -0500 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-497-vcrt3zF5PJO163X5hMae1g-1; Wed, 15 Feb 2023 15:06:09 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 179D13815F7E; Wed, 15 Feb 2023 20:06:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41A19C15BA0; Wed, 15 Feb 2023 20:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676491575; 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=8HBDlS8YGQFwLRNtPts38vTJnZT72kt65ZZY6qT/Zzg=; b=NlRmSjDp4YR5YylxvIA1Ax1BUBFKONwTa97N7dsUqYiKkaqrUIECZ/LTWwNkF1lBBTmS/h 6wMeVkZWSPg+8kYKXHP0NIMg0B58ffdtFNJQ/GMOgCo7LC4KdEb70Bvh/Z74BY44syZcSJ LmQhv3kksftu0IFlX/tXEfmjhMAJ3qk= X-MC-Unique: vcrt3zF5PJO163X5hMae1g-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , qemu-s390x@nongnu.org, Juan Quintela , Thomas Huth , Halil Pasic , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , Alex Williamson , Ilya Leoshkevich , qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , David Hildenbrand , John Snow , Christian Borntraeger , Richard Henderson , Eric Farman Subject: [PULL 3/5] migration: In case of postcopy, the memory ends in res_postcopy_only Date: Wed, 15 Feb 2023 21:05:52 +0100 Message-Id: <20230215200554.1365-4-quintela@redhat.com> In-Reply-To: <20230215200554.1365-1-quintela@redhat.com> References: <20230215200554.1365-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676491642886100001 Content-Type: text/plain; charset="utf-8" So remove last assignation of res_compatible. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Juan Quintela --- migration/ram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/ram.c b/migration/ram.c index 521912385d..ecf697a58d 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3528,7 +3528,7 @@ static void ram_state_pending_exact(void *opaque, =20 if (migrate_postcopy_ram()) { /* We can do postcopy, and all the data is postcopiable */ - *res_compatible +=3D remaining_size; + *res_postcopy_only +=3D remaining_size; } else { *res_precopy_only +=3D remaining_size; } --=20 2.39.1 From nobody Sat May 18 14:54:26 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=1676491614; cv=none; d=zohomail.com; s=zohoarc; b=fGU+IwxMzJBXzN6emyud9bOEoAXeN0SXaZHEPkaYnDQMRdMVG2XTh1yxAwRoGr9v3l/DqT0Xk9gKLuPnb5J9YAcc7LvvvGXhJX+CwSM15T1uKUFeINisMJKx/y/gVuKIglX6J4uoegJWplnnPoFHgt6D7E9Gpa1Ne4MG4AF5G18= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676491614; 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=WRG6MX+4LKPAWpHn9CWu/RyIO/wJsPPIHusNID8t7qY=; b=GPIz1JgcrnQeFwPjDo9LX33kl03pjznOCeFMlbTB4SfNk8zd2nsI2nIfuSpLQJrVuN76MYm5VjpMEb1w/8f27fGj2EGNov1D4WrLOk6+c15tKvYtHEWct+f1WFnCWjvm3iMUkt512GWcVOxABPMY0Uz+P8vDVmqPPXx6OAeP1Mg= 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 1676491614450463.05093922250114; Wed, 15 Feb 2023 12:06:54 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSO2z-0003j0-2Q; Wed, 15 Feb 2023 15:06:33 -0500 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 1pSO2n-0003Vz-Cs for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:21 -0500 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 1pSO2l-0006co-79 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:21 -0500 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-361-5txZRq8KNni8tVwMoZKjiA-1; Wed, 15 Feb 2023 15:06:13 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54FA43815F7B; Wed, 15 Feb 2023 20:06:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 61934C15BA0; Wed, 15 Feb 2023 20:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676491578; 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=WRG6MX+4LKPAWpHn9CWu/RyIO/wJsPPIHusNID8t7qY=; b=htZBxsyS118bf/qjp/BaUtmo92zexHrB6N9icOpsnfthr7rVjFrcTOAT7w0u8zKXmKsnPM zaoJcvaIWBYA/Yz2L15aCfa3qx6BlM+PS3Qnwo1phh8lx3pZykt7ye6iiRSoPiGrpqYAmE Ue15KNYAX4W4sMJeqN75eZY/l6WnGvs= X-MC-Unique: 5txZRq8KNni8tVwMoZKjiA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , qemu-s390x@nongnu.org, Juan Quintela , Thomas Huth , Halil Pasic , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , Alex Williamson , Ilya Leoshkevich , qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , David Hildenbrand , John Snow , Christian Borntraeger , Richard Henderson , Eric Farman Subject: [PULL 4/5] migration: Remove unused res_compatible Date: Wed, 15 Feb 2023 21:05:53 +0100 Message-Id: <20230215200554.1365-5-quintela@redhat.com> In-Reply-To: <20230215200554.1365-1-quintela@redhat.com> References: <20230215200554.1365-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1676491615276100001 Content-Type: text/plain; charset="utf-8" Nothing assigns to it after previous commit. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Juan Quintela --- include/migration/register.h | 7 ++----- migration/savevm.h | 2 -- hw/s390x/s390-stattrib.c | 1 - hw/vfio/migration.c | 3 +-- migration/block-dirty-bitmap.c | 1 - migration/block.c | 1 - migration/migration.c | 18 ++++++++---------- migration/ram.c | 2 -- migration/savevm.c | 8 ++------ hw/vfio/trace-events | 2 +- migration/trace-events | 4 ++-- 11 files changed, 16 insertions(+), 33 deletions(-) diff --git a/include/migration/register.h b/include/migration/register.h index b91a0cdbf8..a958a92a0f 100644 --- a/include/migration/register.h +++ b/include/migration/register.h @@ -49,22 +49,19 @@ typedef struct SaveVMHandlers { /* Note for save_live_pending: * - res_precopy_only is for data which must be migrated in precopy ph= ase * or in stopped state, in other words - before target vm start - * - res_compatible is for data which may be migrated in any phase * - res_postcopy_only is for data which must be migrated in postcopy = phase * or in stopped state, in other words - after source vm stop * - * Sum of res_postcopy_only, res_compatible and res_postcopy_only is t= he - * whole amount of pending data. + * Sum of res_postcopy_only and res_postcopy_only is the whole + * amount of pending data. */ /* This estimates the remaining data to transfer */ void (*state_pending_estimate)(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only); /* This calculate the exact remaining data to transfer */ void (*state_pending_exact)(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only); LoadStateHandler *load_state; int (*load_setup)(QEMUFile *f, void *opaque); diff --git a/migration/savevm.h b/migration/savevm.h index b1901e68d5..bd625a644b 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -41,10 +41,8 @@ void qemu_savevm_state_complete_postcopy(QEMUFile *f); int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, bool inactivate_disks); void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only); void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index 3e32002eab..c7ae9184ab 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -184,7 +184,6 @@ static int cmma_save_setup(QEMUFile *f, void *opaque) =20 static void cmma_state_pending(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { S390StAttribState *sas =3D S390_STATTRIB(opaque); diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index b3318f0f20..fb0dd9571d 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -458,7 +458,6 @@ static void vfio_save_cleanup(void *opaque) =20 static void vfio_state_pending(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { VFIODevice *vbasedev =3D opaque; @@ -473,7 +472,7 @@ static void vfio_state_pending(void *opaque, *res_precopy_only +=3D migration->pending_bytes; =20 trace_vfio_state_pending(vbasedev->name, *res_precopy_only, - *res_postcopy_only, *res_compatible); + *res_postcopy_only); } =20 static int vfio_save_iterate(QEMUFile *f, void *opaque) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 5a621419d3..9c6655e11a 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -764,7 +764,6 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void= *opaque) =20 static void dirty_bitmap_state_pending(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { DBMSaveState *s =3D &((DBMState *)opaque)->save; diff --git a/migration/block.c b/migration/block.c index b5ce506d01..168ef89a82 100644 --- a/migration/block.c +++ b/migration/block.c @@ -855,7 +855,6 @@ static int block_save_complete(QEMUFile *f, void *opaqu= e) =20 static void block_state_pending(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { /* Estimate pending number of bytes to send */ diff --git a/migration/migration.c b/migration/migration.c index 90fca70cb7..296f7fe768 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3863,20 +3863,18 @@ typedef enum { */ static MigIterateState migration_iteration_run(MigrationState *s) { - uint64_t pend_pre, pend_compat, pend_post; + uint64_t pend_pre, pend_post; bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; =20 - qemu_savevm_state_pending_estimate(&pend_pre, &pend_compat, &pend_post= ); - uint64_t pending_size =3D pend_pre + pend_compat + pend_post; + qemu_savevm_state_pending_estimate(&pend_pre, &pend_post); + uint64_t pending_size =3D pend_pre + pend_post; =20 - trace_migrate_pending_estimate(pending_size, - pend_pre, pend_compat, pend_post); + trace_migrate_pending_estimate(pending_size, pend_pre, pend_post); =20 - if (pend_pre + pend_compat <=3D s->threshold_size) { - qemu_savevm_state_pending_exact(&pend_pre, &pend_compat, &pend_pos= t); - pending_size =3D pend_pre + pend_compat + pend_post; - trace_migrate_pending_exact(pending_size, - pend_pre, pend_compat, pend_post); + if (pend_pre <=3D s->threshold_size) { + qemu_savevm_state_pending_exact(&pend_pre, &pend_post); + pending_size =3D pend_pre + pend_post; + trace_migrate_pending_exact(pending_size, pend_pre, pend_post); } =20 if (!pending_size || pending_size < s->threshold_size) { diff --git a/migration/ram.c b/migration/ram.c index ecf697a58d..178f92a77f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3491,7 +3491,6 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) =20 static void ram_state_pending_estimate(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { RAMState **temp =3D opaque; @@ -3509,7 +3508,6 @@ static void ram_state_pending_estimate(void *opaque, =20 static void ram_state_pending_exact(void *opaque, uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { RAMState **temp =3D opaque; diff --git a/migration/savevm.c b/migration/savevm.c index b5e6962bb6..80b7f1222a 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1542,13 +1542,11 @@ flush: * for units that can't do postcopy. */ void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { SaveStateEntry *se; =20 *res_precopy_only =3D 0; - *res_compatible =3D 0; *res_postcopy_only =3D 0; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { @@ -1561,19 +1559,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *r= es_precopy_only, } } se->ops->state_pending_estimate(se->opaque, - res_precopy_only, res_compatible, + res_precopy_only, res_postcopy_only); } } =20 void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only, - uint64_t *res_compatible, uint64_t *res_postcopy_only) { SaveStateEntry *se; =20 *res_precopy_only =3D 0; - *res_compatible =3D 0; *res_postcopy_only =3D 0; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { @@ -1586,7 +1582,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_pr= ecopy_only, } } se->ops->state_pending_exact(se->opaque, - res_precopy_only, res_compatible, + res_precopy_only, res_postcopy_only); } } diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 52de1c84f8..90a8aecb37 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -157,7 +157,7 @@ vfio_save_cleanup(const char *name) " (%s)" vfio_save_buffer(const char *name, uint64_t data_offset, uint64_t data_siz= e, uint64_t pending) " (%s) Offset 0x%"PRIx64" size 0x%"PRIx64" pending 0x%= "PRIx64 vfio_update_pending(const char *name, uint64_t pending) " (%s) pending 0x%= "PRIx64 vfio_save_device_config_state(const char *name) " (%s)" -vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy, = uint64_t compatible) " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64" compat= ible 0x%"PRIx64 +vfio_state_pending(const char *name, uint64_t precopy, uint64_t postcopy) = " (%s) precopy 0x%"PRIx64" postcopy 0x%"PRIx64 vfio_save_iterate(const char *name, int data_size) " (%s) data_size %d" vfio_save_complete_precopy(const char *name) " (%s)" vfio_load_device_config_state(const char *name) " (%s)" diff --git a/migration/trace-events b/migration/trace-events index b20e1271bc..92161eeac5 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -150,8 +150,8 @@ migrate_fd_cleanup(void) "" migrate_fd_error(const char *error_desc) "error=3D%s" migrate_fd_cancel(void) "" migrate_handle_rp_req_pages(const char *rbname, size_t start, size_t len) = "in %s at 0x%zx len 0x%zx" -migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t compat, uint64= _t post) "exact pending size %" PRIu64 " (pre =3D %" PRIu64 " compat=3D%" P= RIu64 " post=3D%" PRIu64 ")" -migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t compat, uin= t64_t post) "estimate pending size %" PRIu64 " (pre =3D %" PRIu64 " compat= =3D%" PRIu64 " post=3D%" PRIu64 ")" +migrate_pending_exact(uint64_t size, uint64_t pre, uint64_t post) "exact p= ending size %" PRIu64 " (pre =3D %" PRIu64 " post=3D%" PRIu64 ")" +migrate_pending_estimate(uint64_t size, uint64_t pre, uint64_t post) "esti= mate pending size %" PRIu64 " (pre =3D %" PRIu64 " post=3D%" PRIu64 ")" migrate_send_rp_message(int msg_type, uint16_t len) "%d: len %d" migrate_send_rp_recv_bitmap(char *name, int64_t size) "block '%s' size 0x%= "PRIi64 migration_completion_file_err(void) "" --=20 2.39.1 From nobody Sat May 18 14:54:26 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=1676491648; cv=none; d=zohomail.com; s=zohoarc; b=SZSeC3Lpfjhk8Thnxu/T43IszJTAfvfWC1dxG/VcpzLOA9WDMSlN3CQ1yNzV0f3Uigmj8PjfByHTjIUMrCgfR8VM8EwBnSvVN8X+FR2cSVmev/smKeNLsjOQFcyFmKQi53iOzLR6wTlyrJB3AVlXWvW/iO1WRRpshcYlMRmX47U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676491648; 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=dGzcMz/Xrwfz40/RuerjFlTOVeBvi5A+2byWQabuOxs=; b=RWA45vIVF1bNU/JLCtobLqAA987NuwRjzCSJfbntXYwOBI66eEHHvq+FwZmz+uqDRADQ93l9f0XAmtsM/sPcuLsGqKiTr0fXvgPngZUigjWFWAT4b5aBLgaF0PeQk5zA+hFIV4TXpusGmi2jZsDnbizkZo6d4RI99Z7C9/nT+q8= 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 167649164816828.294238385228255; Wed, 15 Feb 2023 12:07:28 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pSO2z-0003nW-VQ; Wed, 15 Feb 2023 15:06:34 -0500 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 1pSO2y-0003gL-G6 for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:32 -0500 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 1pSO2l-0006dA-SF for qemu-devel@nongnu.org; Wed, 15 Feb 2023 15:06:22 -0500 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-252-DePlCsAyNoaCKXxbMxEpnw-1; Wed, 15 Feb 2023 15:06:16 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 935CB29AA2FB; Wed, 15 Feb 2023 20:06:15 +0000 (UTC) Received: from secure.mitica (unknown [10.39.192.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99A89C15BA0; Wed, 15 Feb 2023 20:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676491579; 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=dGzcMz/Xrwfz40/RuerjFlTOVeBvi5A+2byWQabuOxs=; b=U/ysRAjfwVHAIRXrBposozpN4j6iXAZiiTpcJ1FfoTN1I0Qyj/DxPmfCAdZ2pGdjYzCyHf J5KsLgNxMlINj8Bme4icARgLmNFQNA5jt/5XnmOHEJQ5QNDZDkThWJLfWQ6tBytljb4ioU JKL5lMNNUErAKvAKfAste2TOfHiQ7Pc= X-MC-Unique: DePlCsAyNoaCKXxbMxEpnw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Eric Blake , qemu-s390x@nongnu.org, Juan Quintela , Thomas Huth , Halil Pasic , "Dr. David Alan Gilbert" , Vladimir Sementsov-Ogievskiy , Alex Williamson , Ilya Leoshkevich , qemu-block@nongnu.org, Stefan Hajnoczi , Fam Zheng , David Hildenbrand , John Snow , Christian Borntraeger , Richard Henderson , Eric Farman Subject: [PULL 5/5] migration: Rename res_{postcopy,precopy}_only Date: Wed, 15 Feb 2023 21:05:54 +0100 Message-Id: <20230215200554.1365-6-quintela@redhat.com> In-Reply-To: <20230215200554.1365-1-quintela@redhat.com> References: <20230215200554.1365-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1676491649361100001 Content-Type: text/plain; charset="utf-8" Once that res_compatible is removed, they don't make sense anymore. We remove the _only preffix. And to make things clearer we rename them to must_precopy and can_postcopy. Reviewed-by: Vladimir Sementsov-Ogievskiy Signed-off-by: Juan Quintela --- include/migration/register.h | 27 +++++++++++++++------------ migration/savevm.h | 8 ++++---- hw/s390x/s390-stattrib.c | 7 +++---- hw/vfio/migration.c | 10 ++++------ migration/block-dirty-bitmap.c | 6 +++--- migration/block.c | 7 +++---- migration/migration.c | 18 +++++++++--------- migration/ram.c | 18 ++++++++---------- migration/savevm.c | 24 ++++++++++-------------- 9 files changed, 59 insertions(+), 66 deletions(-) diff --git a/include/migration/register.h b/include/migration/register.h index a958a92a0f..a8dfd8fefd 100644 --- a/include/migration/register.h +++ b/include/migration/register.h @@ -47,22 +47,25 @@ typedef struct SaveVMHandlers { /* This runs outside the iothread lock! */ int (*save_setup)(QEMUFile *f, void *opaque); /* Note for save_live_pending: - * - res_precopy_only is for data which must be migrated in precopy ph= ase - * or in stopped state, in other words - before target vm start - * - res_postcopy_only is for data which must be migrated in postcopy = phase - * or in stopped state, in other words - after source vm stop + * must_precopy: + * - must be migrated in precopy or in stopped state + * - i.e. must be migrated before target start * - * Sum of res_postcopy_only and res_postcopy_only is the whole - * amount of pending data. + * can_postcopy: + * - can migrate in postcopy or in stopped state + * - i.e. can migrate after target start + * - some can also be migrated during precopy (RAM) + * - some must be migrated after source stops (block-dirty-bitmap) + * + * Sum of can_postcopy and must_postcopy is the whole amount of + * pending data. */ /* This estimates the remaining data to transfer */ - void (*state_pending_estimate)(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only); + void (*state_pending_estimate)(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy); /* This calculate the exact remaining data to transfer */ - void (*state_pending_exact)(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only); + void (*state_pending_exact)(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy); LoadStateHandler *load_state; int (*load_setup)(QEMUFile *f, void *opaque); int (*load_cleanup)(void *opaque); diff --git a/migration/savevm.h b/migration/savevm.h index bd625a644b..fb636735f0 100644 --- a/migration/savevm.h +++ b/migration/savevm.h @@ -40,10 +40,10 @@ void qemu_savevm_state_cleanup(void); void qemu_savevm_state_complete_postcopy(QEMUFile *f); int qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only, bool inactivate_disks); -void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only, - uint64_t *res_postcopy_only); -void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only, - uint64_t *res_postcopy_only); +void qemu_savevm_state_pending_exact(uint64_t *must_precopy, + uint64_t *can_postcopy); +void qemu_savevm_state_pending_estimate(uint64_t *must_precopy, + uint64_t *can_postcopy); void qemu_savevm_send_ping(QEMUFile *f, uint32_t value); void qemu_savevm_send_open_return_path(QEMUFile *f); int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len); diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index c7ae9184ab..aed919ad7d 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -182,16 +182,15 @@ static int cmma_save_setup(QEMUFile *f, void *opaque) return 0; } =20 -static void cmma_state_pending(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +static void cmma_state_pending(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy) { S390StAttribState *sas =3D S390_STATTRIB(opaque); S390StAttribClass *sac =3D S390_STATTRIB_GET_CLASS(sas); long long res =3D sac->get_dirtycount(sas); =20 if (res >=3D 0) { - *res_precopy_only +=3D res; + *must_precopy +=3D res; } } =20 diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index fb0dd9571d..83d2d44080 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -456,9 +456,8 @@ static void vfio_save_cleanup(void *opaque) trace_vfio_save_cleanup(vbasedev->name); } =20 -static void vfio_state_pending(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +static void vfio_state_pending(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy) { VFIODevice *vbasedev =3D opaque; VFIOMigration *migration =3D vbasedev->migration; @@ -469,10 +468,9 @@ static void vfio_state_pending(void *opaque, return; } =20 - *res_precopy_only +=3D migration->pending_bytes; + *must_precopy +=3D migration->pending_bytes; =20 - trace_vfio_state_pending(vbasedev->name, *res_precopy_only, - *res_postcopy_only); + trace_vfio_state_pending(vbasedev->name, *must_precopy, *can_postcopy); } =20 static int vfio_save_iterate(QEMUFile *f, void *opaque) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 9c6655e11a..fe73aa94b1 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -763,8 +763,8 @@ static int dirty_bitmap_save_complete(QEMUFile *f, void= *opaque) } =20 static void dirty_bitmap_state_pending(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) + uint64_t *must_precopy, + uint64_t *can_postcopy) { DBMSaveState *s =3D &((DBMState *)opaque)->save; SaveBitmapState *dbms; @@ -784,7 +784,7 @@ static void dirty_bitmap_state_pending(void *opaque, =20 trace_dirty_bitmap_state_pending(pending); =20 - *res_postcopy_only +=3D pending; + *can_postcopy +=3D pending; } =20 /* First occurrence of this bitmap. It should be created if doesn't exist = */ diff --git a/migration/block.c b/migration/block.c index 168ef89a82..426a25bb19 100644 --- a/migration/block.c +++ b/migration/block.c @@ -853,9 +853,8 @@ static int block_save_complete(QEMUFile *f, void *opaqu= e) return 0; } =20 -static void block_state_pending(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +static void block_state_pending(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy) { /* Estimate pending number of bytes to send */ uint64_t pending; @@ -876,7 +875,7 @@ static void block_state_pending(void *opaque, =20 trace_migration_block_state_pending(pending); /* We don't do postcopy */ - *res_precopy_only +=3D pending; + *must_precopy +=3D pending; } =20 static int block_load(QEMUFile *f, void *opaque, int version_id) diff --git a/migration/migration.c b/migration/migration.c index 296f7fe768..ae2025d9d8 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3863,18 +3863,18 @@ typedef enum { */ static MigIterateState migration_iteration_run(MigrationState *s) { - uint64_t pend_pre, pend_post; + uint64_t must_precopy, can_postcopy; bool in_postcopy =3D s->state =3D=3D MIGRATION_STATUS_POSTCOPY_ACTIVE; =20 - qemu_savevm_state_pending_estimate(&pend_pre, &pend_post); - uint64_t pending_size =3D pend_pre + pend_post; + qemu_savevm_state_pending_estimate(&must_precopy, &can_postcopy); + uint64_t pending_size =3D must_precopy + can_postcopy; =20 - trace_migrate_pending_estimate(pending_size, pend_pre, pend_post); + trace_migrate_pending_estimate(pending_size, must_precopy, can_postcop= y); =20 - if (pend_pre <=3D s->threshold_size) { - qemu_savevm_state_pending_exact(&pend_pre, &pend_post); - pending_size =3D pend_pre + pend_post; - trace_migrate_pending_exact(pending_size, pend_pre, pend_post); + if (must_precopy <=3D s->threshold_size) { + qemu_savevm_state_pending_exact(&must_precopy, &can_postcopy); + pending_size =3D must_precopy + can_postcopy; + trace_migrate_pending_exact(pending_size, must_precopy, can_postco= py); } =20 if (!pending_size || pending_size < s->threshold_size) { @@ -3884,7 +3884,7 @@ static MigIterateState migration_iteration_run(Migrat= ionState *s) } =20 /* Still a significant amount to transfer */ - if (!in_postcopy && pend_pre <=3D s->threshold_size && + if (!in_postcopy && must_precopy <=3D s->threshold_size && qatomic_read(&s->start_postcopy)) { if (postcopy_start(s)) { error_report("%s: postcopy failed to start", __func__); diff --git a/migration/ram.c b/migration/ram.c index 178f92a77f..96e8a19a58 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3489,9 +3489,8 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) return 0; } =20 -static void ram_state_pending_estimate(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +static void ram_state_pending_estimate(void *opaque, uint64_t *must_precop= y, + uint64_t *can_postcopy) { RAMState **temp =3D opaque; RAMState *rs =3D *temp; @@ -3500,15 +3499,14 @@ static void ram_state_pending_estimate(void *opaque, =20 if (migrate_postcopy_ram()) { /* We can do postcopy, and all the data is postcopiable */ - *res_postcopy_only +=3D remaining_size; + *can_postcopy +=3D remaining_size; } else { - *res_precopy_only +=3D remaining_size; + *must_precopy +=3D remaining_size; } } =20 -static void ram_state_pending_exact(void *opaque, - uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +static void ram_state_pending_exact(void *opaque, uint64_t *must_precopy, + uint64_t *can_postcopy) { RAMState **temp =3D opaque; RAMState *rs =3D *temp; @@ -3526,9 +3524,9 @@ static void ram_state_pending_exact(void *opaque, =20 if (migrate_postcopy_ram()) { /* We can do postcopy, and all the data is postcopiable */ - *res_postcopy_only +=3D remaining_size; + *can_postcopy +=3D remaining_size; } else { - *res_precopy_only +=3D remaining_size; + *must_precopy +=3D remaining_size; } } =20 diff --git a/migration/savevm.c b/migration/savevm.c index 80b7f1222a..aa54a67fda 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1541,13 +1541,13 @@ flush: * the result is split into the amount for units that can and * for units that can't do postcopy. */ -void qemu_savevm_state_pending_estimate(uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +void qemu_savevm_state_pending_estimate(uint64_t *must_precopy, + uint64_t *can_postcopy) { SaveStateEntry *se; =20 - *res_precopy_only =3D 0; - *res_postcopy_only =3D 0; + *must_precopy =3D 0; + *can_postcopy =3D 0; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->state_pending_estimate) { @@ -1558,19 +1558,17 @@ void qemu_savevm_state_pending_estimate(uint64_t *r= es_precopy_only, continue; } } - se->ops->state_pending_estimate(se->opaque, - res_precopy_only, - res_postcopy_only); + se->ops->state_pending_estimate(se->opaque, must_precopy, can_post= copy); } } =20 -void qemu_savevm_state_pending_exact(uint64_t *res_precopy_only, - uint64_t *res_postcopy_only) +void qemu_savevm_state_pending_exact(uint64_t *must_precopy, + uint64_t *can_postcopy) { SaveStateEntry *se; =20 - *res_precopy_only =3D 0; - *res_postcopy_only =3D 0; + *must_precopy =3D 0; + *can_postcopy =3D 0; =20 QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->state_pending_exact) { @@ -1581,9 +1579,7 @@ void qemu_savevm_state_pending_exact(uint64_t *res_pr= ecopy_only, continue; } } - se->ops->state_pending_exact(se->opaque, - res_precopy_only, - res_postcopy_only); + se->ops->state_pending_exact(se->opaque, must_precopy, can_postcop= y); } } =20 --=20 2.39.1