From patchwork Thu Apr 27 16:34:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Mf/RFBkZ; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hDh60pdz23vL for ; Fri, 28 Apr 2023 02:35:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aA-00059G-9X; Thu, 27 Apr 2023 12:34:58 -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 1ps4a8-00058i-FT for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:34:56 -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 1ps4a7-0006Uu-3s for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:34:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613294; 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=1v2Kno7+lfPhDpIP/vNNRfOpXUJb0fVL1X2a1vewvbM=; b=Mf/RFBkZG61u/roVU1RRyhmsBdcyy86ixKdxmBxMqfXI+r8NvQjUQBMEunYJmphYHJBKx8 /UWE4Y9+HxfDWMQOtDhxNmsW0yN3qZ0+S++dbzrHwW72hmizVpIjmHzn5HPU5zZEQxjKkZ EpTgofSGOXe9Opngv563c2stEBtPHKo= 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-590-iZscrFoOPvOo6OJqvHoyOQ-1; Thu, 27 Apr 2023 12:34:52 -0400 X-MC-Unique: iZscrFoOPvOo6OJqvHoyOQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 332AB3C1023D for ; Thu, 27 Apr 2023 16:34:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68BED10DF8; Thu, 27 Apr 2023 16:34:51 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 01/19] multifd: We already account for this packet on the multifd thread Date: Thu, 27 Apr 2023 18:34:31 +0200 Message-Id: <20230427163449.27473-2-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/multifd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/migration/multifd.c b/migration/multifd.c index 6a59c03dd2..6053012ad9 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -626,10 +626,7 @@ int multifd_send_sync_main(QEMUFile *f) p->packet_num = multifd_send_state->packet_num++; p->flags |= MULTIFD_FLAG_SYNC; p->pending_job++; - qemu_file_acct_rate_limit(f, p->packet_len); qemu_mutex_unlock(&p->mutex); - stat64_add(&ram_counters.transferred, p->packet_len); - stat64_add(&ram_counters.multifd_bytes, p->packet_len); qemu_sem_post(&p->sem); } for (i = 0; i < migrate_multifd_channels(); i++) { From patchwork Thu Apr 27 16:34:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Fkbu3XI+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hDh5xrBz23vG for ; Fri, 28 Apr 2023 02:35:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aC-00059p-7X; Thu, 27 Apr 2023 12:35:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps4a9-000593-VJ for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:34:57 -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 1ps4a7-0006V0-Gr for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:34:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613294; 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=KvxBIueHJpPbgMKL09aBPNBY7+gzW088zcIOlQEzhVk=; b=Fkbu3XI+lRpy3e90eSAxpVNopFAFjUxFQNhKMMh+0YvjMCua6nqbUqgd/lx1wKoaUVIjLC 8lurYigd0iUL68m4prB8X69dEw6uwCWNueunTxPcJEG1PchCp5+rcHWBHXZcwUUNDYqkK9 v45va9Qc/iFX6V637jt/YfSqRL4IsXo= 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-325-2ly8K89DOCmlJNLUYwrV4A-1; Thu, 27 Apr 2023 12:34:53 -0400 X-MC-Unique: 2ly8K89DOCmlJNLUYwrV4A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 632ECA0F381 for ; Thu, 27 Apr 2023 16:34:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79C3663F46; Thu, 27 Apr 2023 16:34:52 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 02/19] migration: Move ram_stats to its own file migration-stats.[ch] Date: Thu, 27 Apr 2023 18:34:32 +0200 Message-Id: <20230427163449.27473-3-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There is already include/qemu/stats.h, so stats.h was a bad idea. We want this file to not depend on anything else, we will move all the migration counters/stats to this struct. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/meson.build | 1 + migration/migration-stats.c | 17 +++++++++++++++ migration/migration-stats.h | 41 +++++++++++++++++++++++++++++++++++++ migration/migration.c | 1 + migration/multifd.c | 1 + migration/ram.c | 3 +-- migration/ram.h | 23 --------------------- migration/savevm.c | 1 + 8 files changed, 63 insertions(+), 25 deletions(-) create mode 100644 migration/migration-stats.c create mode 100644 migration/migration-stats.h diff --git a/migration/meson.build b/migration/meson.build index 480ff6854a..da1897fadf 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -19,6 +19,7 @@ softmmu_ss.add(files( 'fd.c', 'global_state.c', 'migration-hmp-cmds.c', + 'migration-stats.c', 'migration.c', 'multifd.c', 'multifd-zlib.c', diff --git a/migration/migration-stats.c b/migration/migration-stats.c new file mode 100644 index 0000000000..b0eb5ae73c --- /dev/null +++ b/migration/migration-stats.c @@ -0,0 +1,17 @@ +/* + * Migration stats + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "qemu/stats64.h" +#include "migration-stats.h" + +RAMStats ram_counters; diff --git a/migration/migration-stats.h b/migration/migration-stats.h new file mode 100644 index 0000000000..2edea0c779 --- /dev/null +++ b/migration/migration-stats.h @@ -0,0 +1,41 @@ +/* + * Migration stats + * + * Copyright (c) 2012-2023 Red Hat Inc + * + * Authors: + * Juan Quintela + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#ifndef QEMU_MIGRATION_STATS_H +#define QEMU_MIGRATION_STATS_H + +#include "qemu/stats64.h" + +/* + * These are the ram migration statistic counters. It is loosely + * based on MigrationStats. We change to Stat64 any counter that + * needs to be updated using atomic ops (can be accessed by more than + * one thread). + */ +typedef struct { + Stat64 dirty_bytes_last_sync; + Stat64 dirty_pages_rate; + Stat64 dirty_sync_count; + Stat64 dirty_sync_missed_zero_copy; + Stat64 downtime_bytes; + Stat64 zero_pages; + Stat64 multifd_bytes; + Stat64 normal_pages; + Stat64 postcopy_bytes; + Stat64 postcopy_requests; + Stat64 precopy_bytes; + Stat64 transferred; +} RAMStats; + +extern RAMStats ram_counters; + +#endif diff --git a/migration/migration.c b/migration/migration.c index abcadbb619..5ecf3dc381 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -29,6 +29,7 @@ #include "migration/global_state.h" #include "migration/misc.h" #include "migration.h" +#include "migration-stats.h" #include "savevm.h" #include "qemu-file.h" #include "channel.h" diff --git a/migration/multifd.c b/migration/multifd.c index 6053012ad9..347999f84a 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -19,6 +19,7 @@ #include "qapi/error.h" #include "ram.h" #include "migration.h" +#include "migration-stats.h" #include "socket.h" #include "tls.h" #include "qemu-file.h" diff --git a/migration/ram.c b/migration/ram.c index 89be3e3320..a6d5478ef8 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -36,6 +36,7 @@ #include "xbzrle.h" #include "ram.h" #include "migration.h" +#include "migration-stats.h" #include "migration/register.h" #include "migration/misc.h" #include "qemu-file.h" @@ -460,8 +461,6 @@ uint64_t ram_bytes_remaining(void) 0; } -RAMStats ram_counters; - void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { diff --git a/migration/ram.h b/migration/ram.h index 04b05e1b2c..8692de6ba0 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -32,30 +32,7 @@ #include "qapi/qapi-types-migration.h" #include "exec/cpu-common.h" #include "io/channel.h" -#include "qemu/stats64.h" -/* - * These are the ram migration statistic counters. It is loosely - * based on MigrationStats. We change to Stat64 any counter that - * needs to be updated using atomic ops (can be accessed by more than - * one thread). - */ -typedef struct { - Stat64 dirty_bytes_last_sync; - Stat64 dirty_pages_rate; - Stat64 dirty_sync_count; - Stat64 dirty_sync_missed_zero_copy; - Stat64 downtime_bytes; - Stat64 zero_pages; - Stat64 multifd_bytes; - Stat64 normal_pages; - Stat64 postcopy_bytes; - Stat64 postcopy_requests; - Stat64 precopy_bytes; - Stat64 transferred; -} RAMStats; - -extern RAMStats ram_counters; extern XBZRLECacheStats xbzrle_counters; extern CompressionStats compression_counters; diff --git a/migration/savevm.c b/migration/savevm.c index a9181b444b..8e2efb1a19 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -31,6 +31,7 @@ #include "net/net.h" #include "migration.h" #include "migration/snapshot.h" +#include "migration-stats.h" #include "migration/vmstate.h" #include "migration/misc.h" #include "migration/register.h" From patchwork Thu Apr 27 16:34:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FrAKxw0H; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hFj6fXzz23s0 for ; Fri, 28 Apr 2023 02:36:25 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4ai-0005VF-Oy; Thu, 27 Apr 2023 12:35:32 -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 1ps4ag-0005Sk-R1 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:30 -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 1ps4ae-0006mz-6t for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613324; 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=fERS0ILB2j+0W0xGcHrf7etBfI7Hor7XIScJjAQcQds=; b=FrAKxw0H3fKv2YeUT3LGQ6NzLDTqe6gCOYt1lGx5yTLmnHPZOoC44Ob/N3QX1+XYC8MZ1+ WeAt1EOAI0Wo4x/SzR2q+QVXmSPMdjTEIkfqdS23gLarBPJbnIQK8ulXb6z2BLOhasADDe BoW/ltgK0yC5LBK9Tg1vp/Gnh2SbOp0= 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-540-IQqp41iEO0OBDg2TrcMxJA-1; Thu, 27 Apr 2023 12:35:06 -0400 X-MC-Unique: IQqp41iEO0OBDg2TrcMxJA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 96E03811E7D for ; Thu, 27 Apr 2023 16:34:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8D2F63F4D; Thu, 27 Apr 2023 16:34:53 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 03/19] migration: Rename ram_counters to mig_stats Date: Thu, 27 Apr 2023 18:34:33 +0200 Message-Id: <20230427163449.27473-4-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org migration_stats is just too long, and it is going to have more than ram counters in the near future. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/migration-stats.c | 2 +- migration/migration-stats.h | 2 +- migration/migration.c | 32 ++++++++++++------------- migration/multifd.c | 6 ++--- migration/ram.c | 48 ++++++++++++++++++------------------- migration/savevm.c | 2 +- 6 files changed, 46 insertions(+), 46 deletions(-) diff --git a/migration/migration-stats.c b/migration/migration-stats.c index b0eb5ae73c..8c0af9b80a 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -14,4 +14,4 @@ #include "qemu/stats64.h" #include "migration-stats.h" -RAMStats ram_counters; +RAMStats mig_stats; diff --git a/migration/migration-stats.h b/migration/migration-stats.h index 2edea0c779..197374b4f6 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -36,6 +36,6 @@ typedef struct { Stat64 transferred; } RAMStats; -extern RAMStats ram_counters; +extern RAMStats mig_stats; #endif diff --git a/migration/migration.c b/migration/migration.c index 5ecf3dc381..feb5ab7493 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -909,26 +909,26 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) size_t page_size = qemu_target_page_size(); info->ram = g_malloc0(sizeof(*info->ram)); - info->ram->transferred = stat64_get(&ram_counters.transferred); + info->ram->transferred = stat64_get(&mig_stats.transferred); info->ram->total = ram_bytes_total(); - info->ram->duplicate = stat64_get(&ram_counters.zero_pages); + info->ram->duplicate = stat64_get(&mig_stats.zero_pages); /* legacy value. It is not used anymore */ info->ram->skipped = 0; - info->ram->normal = stat64_get(&ram_counters.normal_pages); + info->ram->normal = stat64_get(&mig_stats.normal_pages); info->ram->normal_bytes = info->ram->normal * page_size; info->ram->mbps = s->mbps; info->ram->dirty_sync_count = - stat64_get(&ram_counters.dirty_sync_count); + stat64_get(&mig_stats.dirty_sync_count); info->ram->dirty_sync_missed_zero_copy = - stat64_get(&ram_counters.dirty_sync_missed_zero_copy); + stat64_get(&mig_stats.dirty_sync_missed_zero_copy); info->ram->postcopy_requests = - stat64_get(&ram_counters.postcopy_requests); + stat64_get(&mig_stats.postcopy_requests); info->ram->page_size = page_size; - info->ram->multifd_bytes = stat64_get(&ram_counters.multifd_bytes); + info->ram->multifd_bytes = stat64_get(&mig_stats.multifd_bytes); info->ram->pages_per_second = s->pages_per_second; - info->ram->precopy_bytes = stat64_get(&ram_counters.precopy_bytes); - info->ram->downtime_bytes = stat64_get(&ram_counters.downtime_bytes); - info->ram->postcopy_bytes = stat64_get(&ram_counters.postcopy_bytes); + info->ram->precopy_bytes = stat64_get(&mig_stats.precopy_bytes); + info->ram->downtime_bytes = stat64_get(&mig_stats.downtime_bytes); + info->ram->postcopy_bytes = stat64_get(&mig_stats.postcopy_bytes); if (migrate_xbzrle()) { info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache)); @@ -960,7 +960,7 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) if (s->state != MIGRATION_STATUS_COMPLETED) { info->ram->remaining = ram_bytes_remaining(); info->ram->dirty_pages_rate = - stat64_get(&ram_counters.dirty_pages_rate); + stat64_get(&mig_stats.dirty_pages_rate); } } @@ -1613,10 +1613,10 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, migrate_init(s); /* - * set ram_counters compression_counters memory to zero for a + * set mig_stats compression_counters memory to zero for a * new migration */ - memset(&ram_counters, 0, sizeof(ram_counters)); + memset(&mig_stats, 0, sizeof(mig_stats)); memset(&compression_counters, 0, sizeof(compression_counters)); return true; @@ -2627,7 +2627,7 @@ static MigThrError migration_detect_error(MigrationState *s) static uint64_t migration_total_bytes(MigrationState *s) { return qemu_file_total_transferred(s->to_dst_file) + - stat64_get(&ram_counters.multifd_bytes); + stat64_get(&mig_stats.multifd_bytes); } static void migration_calculate_complete(MigrationState *s) @@ -2691,10 +2691,10 @@ static void migration_update_counters(MigrationState *s, * if we haven't sent anything, we don't want to * recalculate. 10000 is a small enough number for our purposes */ - if (stat64_get(&ram_counters.dirty_pages_rate) && + if (stat64_get(&mig_stats.dirty_pages_rate) && transferred > 10000) { s->expected_downtime = - stat64_get(&ram_counters.dirty_bytes_last_sync) / bandwidth; + stat64_get(&mig_stats.dirty_bytes_last_sync) / bandwidth; } qemu_file_reset_rate_limit(s->to_dst_file); diff --git a/migration/multifd.c b/migration/multifd.c index 347999f84a..4a2e1a47ce 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -434,8 +434,8 @@ static int multifd_send_pages(QEMUFile *f) transferred = ((uint64_t) pages->num) * p->page_size + p->packet_len; qemu_file_acct_rate_limit(f, transferred); qemu_mutex_unlock(&p->mutex); - stat64_add(&ram_counters.transferred, transferred); - stat64_add(&ram_counters.multifd_bytes, transferred); + stat64_add(&mig_stats.transferred, transferred); + stat64_add(&mig_stats.multifd_bytes, transferred); qemu_sem_post(&p->sem); return 1; @@ -577,7 +577,7 @@ static int multifd_zero_copy_flush(QIOChannel *c) return -1; } if (ret == 1) { - stat64_add(&ram_counters.dirty_sync_missed_zero_copy, 1); + stat64_add(&mig_stats.dirty_sync_missed_zero_copy, 1); } return ret; diff --git a/migration/ram.c b/migration/ram.c index a6d5478ef8..c3981f64e4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -464,13 +464,13 @@ uint64_t ram_bytes_remaining(void) void ram_transferred_add(uint64_t bytes) { if (runstate_is_running()) { - stat64_add(&ram_counters.precopy_bytes, bytes); + stat64_add(&mig_stats.precopy_bytes, bytes); } else if (migration_in_postcopy()) { - stat64_add(&ram_counters.postcopy_bytes, bytes); + stat64_add(&mig_stats.postcopy_bytes, bytes); } else { - stat64_add(&ram_counters.downtime_bytes, bytes); + stat64_add(&mig_stats.downtime_bytes, bytes); } - stat64_add(&ram_counters.transferred, bytes); + stat64_add(&mig_stats.transferred, bytes); } struct MigrationOps { @@ -744,7 +744,7 @@ void mig_throttle_counter_reset(void) rs->time_last_bitmap_sync = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); rs->num_dirty_pages_period = 0; - rs->bytes_xfer_prev = stat64_get(&ram_counters.transferred); + rs->bytes_xfer_prev = stat64_get(&mig_stats.transferred); } /** @@ -764,7 +764,7 @@ static void xbzrle_cache_zero_page(RAMState *rs, ram_addr_t current_addr) /* We don't care if this fails to allocate a new cache page * as long as it updated an old one */ cache_insert(XBZRLE.cache, current_addr, XBZRLE.zero_target_page, - stat64_get(&ram_counters.dirty_sync_count)); + stat64_get(&mig_stats.dirty_sync_count)); } #define ENCODING_FLAG_XBZRLE 0x1 @@ -790,7 +790,7 @@ static int save_xbzrle_page(RAMState *rs, PageSearchStatus *pss, int encoded_len = 0, bytes_xbzrle; uint8_t *prev_cached_page; QEMUFile *file = pss->pss_channel; - uint64_t generation = stat64_get(&ram_counters.dirty_sync_count); + uint64_t generation = stat64_get(&mig_stats.dirty_sync_count); if (!cache_is_cached(XBZRLE.cache, current_addr, generation)) { xbzrle_counters.cache_miss++; @@ -1118,8 +1118,8 @@ uint64_t ram_pagesize_summary(void) uint64_t ram_get_total_transferred_pages(void) { - return stat64_get(&ram_counters.normal_pages) + - stat64_get(&ram_counters.zero_pages) + + return stat64_get(&mig_stats.normal_pages) + + stat64_get(&mig_stats.zero_pages) + compression_counters.pages + xbzrle_counters.pages; } @@ -1129,7 +1129,7 @@ static void migration_update_rates(RAMState *rs, int64_t end_time) double compressed_size; /* calculate period counters */ - stat64_set(&ram_counters.dirty_pages_rate, + stat64_set(&mig_stats.dirty_pages_rate, rs->num_dirty_pages_period * 1000 / (end_time - rs->time_last_bitmap_sync)); @@ -1180,7 +1180,7 @@ static void migration_trigger_throttle(RAMState *rs) { uint64_t threshold = migrate_throttle_trigger_threshold(); uint64_t bytes_xfer_period = - stat64_get(&ram_counters.transferred) - rs->bytes_xfer_prev; + stat64_get(&mig_stats.transferred) - rs->bytes_xfer_prev; uint64_t bytes_dirty_period = rs->num_dirty_pages_period * TARGET_PAGE_SIZE; uint64_t bytes_dirty_threshold = bytes_xfer_period * threshold / 100; @@ -1209,7 +1209,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBlock *block; int64_t end_time; - stat64_add(&ram_counters.dirty_sync_count, 1); + stat64_add(&mig_stats.dirty_sync_count, 1); if (!rs->time_last_bitmap_sync) { rs->time_last_bitmap_sync = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); @@ -1223,7 +1223,7 @@ static void migration_bitmap_sync(RAMState *rs) RAMBLOCK_FOREACH_NOT_IGNORED(block) { ramblock_sync_dirty_bitmap(rs, block); } - stat64_set(&ram_counters.dirty_bytes_last_sync, ram_bytes_remaining()); + stat64_set(&mig_stats.dirty_bytes_last_sync, ram_bytes_remaining()); } qemu_mutex_unlock(&rs->bitmap_mutex); @@ -1243,10 +1243,10 @@ static void migration_bitmap_sync(RAMState *rs) /* reset period counters */ rs->time_last_bitmap_sync = end_time; rs->num_dirty_pages_period = 0; - rs->bytes_xfer_prev = stat64_get(&ram_counters.transferred); + rs->bytes_xfer_prev = stat64_get(&mig_stats.transferred); } if (migrate_events()) { - uint64_t generation = stat64_get(&ram_counters.dirty_sync_count); + uint64_t generation = stat64_get(&mig_stats.dirty_sync_count); qapi_event_send_migration_pass(generation); } } @@ -1320,7 +1320,7 @@ static int save_zero_page(PageSearchStatus *pss, QEMUFile *f, RAMBlock *block, int len = save_zero_page_to_file(pss, f, block, offset); if (len) { - stat64_add(&ram_counters.zero_pages, 1); + stat64_add(&mig_stats.zero_pages, 1); ram_transferred_add(len); return 1; } @@ -1357,9 +1357,9 @@ static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, } if (bytes_xmit > 0) { - stat64_add(&ram_counters.normal_pages, 1); + stat64_add(&mig_stats.normal_pages, 1); } else if (bytes_xmit == 0) { - stat64_add(&ram_counters.zero_pages, 1); + stat64_add(&mig_stats.zero_pages, 1); } return true; @@ -1391,7 +1391,7 @@ static int save_normal_page(PageSearchStatus *pss, RAMBlock *block, qemu_put_buffer(file, buf, TARGET_PAGE_SIZE); } ram_transferred_add(TARGET_PAGE_SIZE); - stat64_add(&ram_counters.normal_pages, 1); + stat64_add(&mig_stats.normal_pages, 1); return 1; } @@ -1447,7 +1447,7 @@ static int ram_save_multifd_page(QEMUFile *file, RAMBlock *block, if (multifd_queue_page(file, block, offset) < 0) { return -1; } - stat64_add(&ram_counters.normal_pages, 1); + stat64_add(&mig_stats.normal_pages, 1); return 1; } @@ -1486,7 +1486,7 @@ update_compress_thread_counts(const CompressParam *param, int bytes_xmit) ram_transferred_add(bytes_xmit); if (param->zero_page) { - stat64_add(&ram_counters.zero_pages, 1); + stat64_add(&mig_stats.zero_pages, 1); return; } @@ -2179,7 +2179,7 @@ int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len) RAMBlock *ramblock; RAMState *rs = ram_state; - stat64_add(&ram_counters.postcopy_requests, 1); + stat64_add(&mig_stats.postcopy_requests, 1); RCU_READ_LOCK_GUARD(); if (!rbname) { @@ -2634,9 +2634,9 @@ void acct_update_position(QEMUFile *f, size_t size, bool zero) uint64_t pages = size / TARGET_PAGE_SIZE; if (zero) { - stat64_add(&ram_counters.zero_pages, pages); + stat64_add(&mig_stats.zero_pages, pages); } else { - stat64_add(&ram_counters.normal_pages, pages); + stat64_add(&mig_stats.normal_pages, pages); ram_transferred_add(size); qemu_file_credit_transfer(f, size); } diff --git a/migration/savevm.c b/migration/savevm.c index 8e2efb1a19..a9d0a88e62 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1622,7 +1622,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp) } migrate_init(ms); - memset(&ram_counters, 0, sizeof(ram_counters)); + memset(&mig_stats, 0, sizeof(mig_stats)); memset(&compression_counters, 0, sizeof(compression_counters)); ms->to_dst_file = f; From patchwork Thu Apr 27 16:34:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774552 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YBH3BlbU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hH13H8Jz23s0 for ; Fri, 28 Apr 2023 02:37:33 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aU-0005Dt-89; Thu, 27 Apr 2023 12:35:18 -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 1ps4aO-0005B3-N1 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:12 -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 1ps4aN-0006i4-6X for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613310; 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=14xOUDM6FpIhOsZHKhcu5B84Z8Q3vn58nLLTcxEKxV0=; b=YBH3BlbUaaTQcxQogXamPyRyRhiSlTH0cNOrMnmf+KhLeeauoJiBnuuLAPc0KuUmSUBLFy 02TwxdtfQNKFO4zJPLt7Aurb7plvvHi5EZPfbR6T034aVqnagg9QBjwQWtWSjrIS03C8lh 0PItIdmKyYQ5AFRGxOddpTQK1jwFkVI= 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-49-ux4frsv0N2G-THKFta8imQ-1; Thu, 27 Apr 2023 12:34:56 -0400 X-MC-Unique: ux4frsv0N2G-THKFta8imQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7C873C10238 for ; Thu, 27 Apr 2023 16:34:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0B5463F4D; Thu, 27 Apr 2023 16:34:54 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 04/19] migration: Rename RAMStats to MigrationAtomicStats Date: Thu, 27 Apr 2023 18:34:34 +0200 Message-Id: <20230427163449.27473-5-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is lousely based on MigrationStats, but that name is taken, so this is the best one that I came with. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- If you have any good suggestion for the name, I am all ears. --- migration/migration-stats.c | 2 +- migration/migration-stats.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/migration-stats.c b/migration/migration-stats.c index 8c0af9b80a..2f2cea965c 100644 --- a/migration/migration-stats.c +++ b/migration/migration-stats.c @@ -14,4 +14,4 @@ #include "qemu/stats64.h" #include "migration-stats.h" -RAMStats mig_stats; +MigrationAtomicStats mig_stats; diff --git a/migration/migration-stats.h b/migration/migration-stats.h index 197374b4f6..149af932d7 100644 --- a/migration/migration-stats.h +++ b/migration/migration-stats.h @@ -34,8 +34,8 @@ typedef struct { Stat64 postcopy_requests; Stat64 precopy_bytes; Stat64 transferred; -} RAMStats; +} MigrationAtomicStats; -extern RAMStats mig_stats; +extern MigrationAtomicStats mig_stats; #endif From patchwork Thu Apr 27 16:34:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Z9cwwu+I; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hG43qpKz23s0 for ; Fri, 28 Apr 2023 02:36:44 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aW-0005Ex-1R; Thu, 27 Apr 2023 12:35: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 1ps4aU-0005Dq-3i for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:18 -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 1ps4aS-0006iM-G3 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613312; 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=eCwV/ceYtjxUdlYG70aEG2T9pDl6nK0pJPj/PMgOVTw=; b=Z9cwwu+Ia27WdzMMrGgqHHI+ZuPIpYhte4urjpET+tTUNMzmzX/gnARV6W6dyTBMgo8C58 xjBT7ZFlu1Im22ykkl4gu899grQL6S6PE0NyK8kCYd9/xBltfnQ5DC7A5bAYogwXEPGE9z aoNybVhcCz9n+FWgv9/fhTUI2PhZq7w= 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-600-23VhpWy7NSuGL8GANjJAkA-1; Thu, 27 Apr 2023 12:34:57 -0400 X-MC-Unique: 23VhpWy7NSuGL8GANjJAkA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B63BA1C041A0 for ; Thu, 27 Apr 2023 16:34:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id EED5410DF8; Thu, 27 Apr 2023 16:34:55 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 05/19] migration/rdma: Split the zero page case from acct_update_position Date: Thu, 27 Apr 2023 18:34:35 +0200 Message-Id: <20230427163449.27473-6-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Now that we have atomic counters, we can do it on the place that we need it, no need to do it inside ram.c. Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 12 ++++-------- migration/ram.h | 2 +- migration/rdma.c | 7 +++++-- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c3981f64e4..c249a1f468 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2629,17 +2629,13 @@ static int ram_find_and_save_block(RAMState *rs) return pages; } -void acct_update_position(QEMUFile *f, size_t size, bool zero) +void acct_update_position(QEMUFile *f, size_t size) { uint64_t pages = size / TARGET_PAGE_SIZE; - if (zero) { - stat64_add(&mig_stats.zero_pages, pages); - } else { - stat64_add(&mig_stats.normal_pages, pages); - ram_transferred_add(size); - qemu_file_credit_transfer(f, size); - } + stat64_add(&mig_stats.normal_pages, pages); + ram_transferred_add(size); + qemu_file_credit_transfer(f, size); } static uint64_t ram_bytes_total_with_ignored(void) diff --git a/migration/ram.h b/migration/ram.h index 8692de6ba0..3804753ca3 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -53,7 +53,7 @@ void mig_throttle_counter_reset(void); uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len); -void acct_update_position(QEMUFile *f, size_t size, bool zero); +void acct_update_position(QEMUFile *f, size_t size); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ void ram_postcopy_send_discard_bitmap(MigrationState *ms); diff --git a/migration/rdma.c b/migration/rdma.c index 0af5e944f0..7a9b284c3f 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -17,8 +17,10 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/cutils.h" +#include "exec/target_page.h" #include "rdma.h" #include "migration.h" +#include "migration-stats.h" #include "qemu-file.h" #include "ram.h" #include "qemu/error-report.h" @@ -2120,7 +2122,8 @@ retry: return -EIO; } - acct_update_position(f, sge.length, true); + stat64_add(&mig_stats.zero_pages, + sge.length / qemu_target_page_size()); return 1; } @@ -2228,7 +2231,7 @@ retry: } set_bit(chunk, block->transit_bitmap); - acct_update_position(f, sge.length, false); + acct_update_position(f, sge.length); rdma->total_writes++; return 0; From patchwork Thu Apr 27 16:34:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=M8zd4Ma/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hDh5tgWz23s0 for ; Fri, 28 Apr 2023 02:35:31 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aM-0005Aa-UX; Thu, 27 Apr 2023 12:35:10 -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 1ps4aL-0005AP-HG for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:09 -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 1ps4aK-0006hG-3B for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613307; 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=E7WEdNJ+SDsBGCO+I4wMc8FLRtbSMcHmbxkuQfUr3Y0=; b=M8zd4Ma/1jphw3ndBYe1IH4PnDJqsHJetAuVd9EPoQoyw7jl2RLTpw1lHVL/cggHFhnvmt DAVd2HgoKXYRWY4uJSpfwxhm8XgCgsqsgbVA/0r3JFD8Cdfy+1xRrBGIxhVbCMRCyLmj5W vNP7xR6e3HVHqk/lt82ezsbExC0/8k4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-629-Jb0TLxQGMHGsZ-9Yusg2Ow-1; Thu, 27 Apr 2023 12:35:02 -0400 X-MC-Unique: Jb0TLxQGMHGsZ-9Yusg2Ow-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C3599A0F39B for ; Thu, 27 Apr 2023 16:34:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0657C63F46; Thu, 27 Apr 2023 16:34:56 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 06/19] migration/rdma: Unfold last user of acct_update_position() Date: Thu, 27 Apr 2023 18:34:36 +0200 Message-Id: <20230427163449.27473-7-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela Reviewed-by: Lukas Straub --- migration/ram.c | 9 --------- migration/ram.h | 1 - migration/rdma.c | 4 +++- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index c249a1f468..7d81c4a39e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -2629,15 +2629,6 @@ static int ram_find_and_save_block(RAMState *rs) return pages; } -void acct_update_position(QEMUFile *f, size_t size) -{ - uint64_t pages = size / TARGET_PAGE_SIZE; - - stat64_add(&mig_stats.normal_pages, pages); - ram_transferred_add(size); - qemu_file_credit_transfer(f, size); -} - static uint64_t ram_bytes_total_with_ignored(void) { RAMBlock *block; diff --git a/migration/ram.h b/migration/ram.h index 3804753ca3..6fffbeb5f1 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -53,7 +53,6 @@ void mig_throttle_counter_reset(void); uint64_t ram_pagesize_summary(void); int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len); -void acct_update_position(QEMUFile *f, size_t size); void ram_postcopy_migrated_memory_release(MigrationState *ms); /* For outgoing discard bitmap */ void ram_postcopy_send_discard_bitmap(MigrationState *ms); diff --git a/migration/rdma.c b/migration/rdma.c index 7a9b284c3f..7e747b2595 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2231,7 +2231,9 @@ retry: } set_bit(chunk, block->transit_bitmap); - acct_update_position(f, sge.length); + stat64_add(&mig_stats.normal_pages, sge.length / qemu_target_page_size()); + ram_transferred_add(sge.length); + qemu_file_credit_transfer(f, sge.length); rdma->total_writes++; return 0; From patchwork Thu Apr 27 16:34:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774545 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=DI3BSmnS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hFH6tWdz23s0 for ; Fri, 28 Apr 2023 02:36:03 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aT-0005DV-Io; Thu, 27 Apr 2023 12:35:17 -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 1ps4aO-0005Av-5M for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:12 -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 1ps4aM-0006hy-JE for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613309; 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=iOJx893rhTDZstmfdkELyrCUZk3sN0eUWX9Y/k68xFI=; b=DI3BSmnS61aF7LTJs+JrDDb4BXYaAOY6Pa2xplremA+ikVKP8hp1vqtB+Ew4v8xs2/FKVM Ore049X8/94DPXyE4C1kUTcL/2u+alxFx43lrqO68skfTOgXfwAb+4RjTujWXm7gU39kqr NdVeK/C0MDmUVU2rEWT6tuknKohklfk= 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-257-ArvRfF3nM2qBysutU8JIUQ-1; Thu, 27 Apr 2023 12:34:59 -0400 X-MC-Unique: ArvRfF3nM2qBysutU8JIUQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D4D84280606C for ; Thu, 27 Apr 2023 16:34:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1402063F4F; Thu, 27 Apr 2023 16:34:57 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 07/19] migration/rdma: Unflod ram_control_before_iterate() Date: Thu, 27 Apr 2023 18:34:37 +0200 Message-Id: <20230427163449.27473-8-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Once there: - Remove unused data parameter - unfold it in its callers. - change all callers to call qemu_rdma_registration_start() Signed-off-by: Juan Quintela --- migration/qemu-file.c | 13 +------------ migration/qemu-file.h | 2 -- migration/ram.c | 16 +++++++++++++--- migration/rdma.c | 4 +--- migration/rdma.h | 6 ++++++ 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index ee04240a21..b6dca23706 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -30,6 +30,7 @@ #include "qemu-file.h" #include "trace.h" #include "qapi/error.h" +#include "rdma.h" #define IO_BUF_SIZE 32768 #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) @@ -314,18 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt = 0; } -void ram_control_before_iterate(QEMUFile *f, uint64_t flags) -{ - int ret = 0; - - if (f->hooks && f->hooks->before_ram_iterate) { - ret = f->hooks->before_ram_iterate(f, flags, NULL); - if (ret < 0) { - qemu_file_set_error(f, ret); - } - } -} - void ram_control_after_iterate(QEMUFile *f, uint64_t flags) { int ret = 0; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d16cd50448..c898c5c537 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -56,7 +56,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); typedef struct QEMUFileHooks { - QEMURamHookFunc *before_ram_iterate; QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; @@ -150,7 +149,6 @@ 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); -void ram_control_before_iterate(QEMUFile *f, uint64_t flags); void ram_control_after_iterate(QEMUFile *f, uint64_t flags); void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data); diff --git a/migration/ram.c b/migration/ram.c index 7d81c4a39e..ce5dfc3c86 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -58,6 +58,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "rdma.h" #include "options.h" #include "hw/boards.h" /* for machine_dump_guest_core() */ @@ -3277,7 +3278,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } } - ram_control_before_iterate(f, RAM_CONTROL_SETUP); + ret = qemu_rdma_registration_start(f, RAM_CONTROL_SETUP); + if (ret < 0) { + qemu_file_set_error(f, ret); + } ram_control_after_iterate(f, RAM_CONTROL_SETUP); migration_ops = g_malloc0(sizeof(MigrationOps)); @@ -3337,7 +3341,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) /* Read version before ram_list.blocks */ smp_rmb(); - ram_control_before_iterate(f, RAM_CONTROL_ROUND); + ret = qemu_rdma_registration_start(f, RAM_CONTROL_ROUND); + if (ret < 0) { + qemu_file_set_error(f, ret); + } t0 = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); i = 0; @@ -3442,7 +3449,10 @@ static int ram_save_complete(QEMUFile *f, void *opaque) migration_bitmap_sync_precopy(rs); } - ram_control_before_iterate(f, RAM_CONTROL_FINISH); + ret = qemu_rdma_registration_start(f, RAM_CONTROL_FINISH); + if (ret < 0) { + qemu_file_set_error(f, ret); + } /* try transferring iterative blocks of memory */ diff --git a/migration/rdma.c b/migration/rdma.c index 7e747b2595..56b7f6901e 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3860,8 +3860,7 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) } } -static int qemu_rdma_registration_start(QEMUFile *f, - uint64_t flags, void *data) +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; @@ -4004,7 +4003,6 @@ static const QEMUFileHooks rdma_read_hooks = { }; static const QEMUFileHooks rdma_write_hooks = { - .before_ram_iterate = qemu_rdma_registration_start, .after_ram_iterate = qemu_rdma_registration_stop, .save_page = qemu_rdma_save_page, }; diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..901c829c8b 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -22,4 +22,10 @@ void rdma_start_outgoing_migration(void *opaque, const char *host_port, void rdma_start_incoming_migration(const char *host_port, Error **errp); + +#ifdef CONFIG_RDMA +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); +#else +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +#endif #endif From patchwork Thu Apr 27 16:34:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774555 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XIGw/x1E; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hJH2S14z23s0 for ; Fri, 28 Apr 2023 02:38:39 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4bM-0007Bh-4O; Thu, 27 Apr 2023 12:36:12 -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 1ps4bK-000783-HJ for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:36:11 -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 1ps4bH-00070D-Qz for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:36:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613367; 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=722oFCQWayp8iOsqJAVquYGAYVGaTZ0i4japbSZA1Tg=; b=XIGw/x1E2STkOcFNg8Gwe/lKvbUavGIm8UddEQuXSvcC4zOE9L6KBhNjCVB24Ica7DPA4Y ZiYwVmoLCyewX2kXH7VMCIG+lnYN3O/VGTj3z05IWYDY+kzU8LoAaFlGp9RzvZCGBiaDWL 7vF+bKING7u24Av/m04ZIGVh5syn4v8= 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-378-FSTDC9TOPnizbWae6MLOKA-1; Thu, 27 Apr 2023 12:35:09 -0400 X-MC-Unique: FSTDC9TOPnizbWae6MLOKA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 476021C02D41 for ; Thu, 27 Apr 2023 16:35:00 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BA5A10DF8; Thu, 27 Apr 2023 16:34:59 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 08/19] migration/rdma: Unflod ram_control_after_iterate() Date: Thu, 27 Apr 2023 18:34:38 +0200 Message-Id: <20230427163449.27473-9-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Once there: - Remove unused data parameter - unfold it in its callers - change all callers to call qemu_rdma_registration_stop() Signed-off-by: Juan Quintela --- migration/qemu-file.c | 12 ------------ migration/qemu-file.h | 2 -- migration/ram.c | 17 ++++++++++++++--- migration/rdma.c | 4 +--- migration/rdma.h | 2 ++ 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index b6dca23706..22af45a5db 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,18 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt = 0; } -void ram_control_after_iterate(QEMUFile *f, uint64_t flags) -{ - int ret = 0; - - if (f->hooks && f->hooks->after_ram_iterate) { - ret = f->hooks->after_ram_iterate(f, flags, NULL); - if (ret < 0) { - qemu_file_set_error(f, ret); - } - } -} - void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) { int ret = -EINVAL; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index c898c5c537..fac26d7869 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -56,7 +56,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); typedef struct QEMUFileHooks { - QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; @@ -149,7 +148,6 @@ 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); -void ram_control_after_iterate(QEMUFile *f, uint64_t flags); void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data); /* Whenever this is found in the data stream, the flags diff --git a/migration/ram.c b/migration/ram.c index ce5dfc3c86..a5109a0f77 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3282,7 +3282,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque) if (ret < 0) { qemu_file_set_error(f, ret); } - ram_control_after_iterate(f, RAM_CONTROL_SETUP); + + ret = qemu_rdma_registration_stop(f, RAM_CONTROL_SETUP); + if (ret < 0) { + qemu_file_set_error(f, ret); + } migration_ops = g_malloc0(sizeof(MigrationOps)); migration_ops->ram_save_target_page = ram_save_target_page_legacy; @@ -3401,7 +3405,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) * Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ - ram_control_after_iterate(f, RAM_CONTROL_ROUND); + ret = qemu_rdma_registration_stop(f, RAM_CONTROL_ROUND); + if (ret < 0) { + qemu_file_set_error(f, ret); + } out: if (ret >= 0 @@ -3474,7 +3481,11 @@ static int ram_save_complete(QEMUFile *f, void *opaque) qemu_mutex_unlock(&rs->bitmap_mutex); flush_compressed_data(rs); - ram_control_after_iterate(f, RAM_CONTROL_FINISH); + + int ret = qemu_rdma_registration_stop(f, RAM_CONTROL_FINISH); + if (ret < 0) { + qemu_file_set_error(f, ret); + } } if (ret < 0) { diff --git a/migration/rdma.c b/migration/rdma.c index 56b7f6901e..77bbe3da36 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3888,8 +3888,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) * Inform dest that dynamic registrations are done for now. * First, flush writes, if any. */ -static int qemu_rdma_registration_stop(QEMUFile *f, - uint64_t flags, void *data) +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; @@ -4003,7 +4002,6 @@ static const QEMUFileHooks rdma_read_hooks = { }; static const QEMUFileHooks rdma_write_hooks = { - .after_ram_iterate = qemu_rdma_registration_stop, .save_page = qemu_rdma_save_page, }; diff --git a/migration/rdma.h b/migration/rdma.h index 901c829c8b..a16a8d8bc6 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -25,7 +25,9 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp); #ifdef CONFIG_RDMA int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); #else int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } #endif #endif From patchwork Thu Apr 27 16:34:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AW1vLxB/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hFF1bxMz23s0 for ; Fri, 28 Apr 2023 02:36:01 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aX-0005Fa-KL; Thu, 27 Apr 2023 12:35:21 -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 1ps4aV-0005ES-58 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35: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 1ps4aS-0006id-GJ for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613313; 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=m5swpW0JMkzO+gt4Ban4GFGxcDH5gnLYFyk8V6a4n0M=; b=AW1vLxB//kj4dsBuzUttL4ylkcbWFDshi36JPwV17QnuxNXv6VC1zg227sCuw1sO/Wyzpg hzGnMcYeA99mTM5CdlaGUTqjYuvn8Cfi8d42RfRh7FTNG04+t/MHEIbO3B0mec3IGsRqJl h7uWEwF5coLkJdLYq5aYs0E3YWCVvNo= 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-437-lTDgaxjxNhGunr5lFc0qXQ-1; Thu, 27 Apr 2023 12:35:09 -0400 X-MC-Unique: lTDgaxjxNhGunr5lFc0qXQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 53028382C985 for ; Thu, 27 Apr 2023 16:35:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A3E063F4F; Thu, 27 Apr 2023 16:35:00 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 09/19] migration/rdma: simplify ram_control_load_hook() Date: Thu, 27 Apr 2023 18:34:39 +0200 Message-Id: <20230427163449.27473-10-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- migration/qemu-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 22af45a5db..9b5e14a2ef 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -317,10 +317,8 @@ void qemu_fflush(QEMUFile *f) void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) { - int ret = -EINVAL; - if (f->hooks && f->hooks->hook_ram_load) { - ret = f->hooks->hook_ram_load(f, flags, data); + int ret = f->hooks->hook_ram_load(f, flags, data); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -330,7 +328,7 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) * that expects there to be a hook on the destination. */ if (flags == RAM_CONTROL_HOOK) { - qemu_file_set_error(f, ret); + qemu_file_set_error(f, -EINVAL); } } } From patchwork Thu Apr 27 16:34:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774543 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SuPxViBA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hF22k3Dz23s0 for ; Fri, 28 Apr 2023 02:35:50 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aj-0005Va-NV; Thu, 27 Apr 2023 12:35:33 -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 1ps4ah-0005Uo-Vw for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:32 -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 1ps4ag-0006qL-3X for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613329; 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=MR22qS+hH/2q31GosffhAixHKQy1yQTpaWbEt4e7Is8=; b=SuPxViBARpFKtKX+m1mmiam0WnlIXkmCkGwxgZMAV6ZLs+hBRSWcMI2AVsNPR+MRWixhXk cyHtlk20VQAby43rIN22+Xa1LFB+AqttjAaToUT1B0GZDtsN1gf/MmubTunh0xFG7r/W/g wwqztSXCv69KTuwcHh4Bb6FcMKutFSY= 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-422-md4CrwyON6WrIRL24uQAnA-1; Thu, 27 Apr 2023 12:35:11 -0400 X-MC-Unique: md4CrwyON6WrIRL24uQAnA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5EC0A3C1179E for ; Thu, 27 Apr 2023 16:35:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9597F10DF8; Thu, 27 Apr 2023 16:35:01 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 10/19] migration/rdma: Don't pass the QIOChannelRDMA as an opaque Date: Thu, 27 Apr 2023 18:34:40 +0200 Message-Id: <20230427163449.27473-11-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org We can calculate it from the QEMUFile like the caller. Signed-off-by: Juan Quintela --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 77bbe3da36..40b8e2da51 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3527,7 +3527,7 @@ static int dest_ram_sort_func(const void *a, const void *b) * * Keep doing this until the source tells us to stop. */ -static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque) +static int qemu_rdma_registration_handle(QEMUFile *f) { RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), .type = RDMA_CONTROL_REGISTER_RESULT, @@ -3539,7 +3539,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f, void *opaque) }; RDMAControlHeader blocks = { .type = RDMA_CONTROL_RAM_BLOCKS_RESULT, .repeat = 1 }; - QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(opaque); + QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; RDMALocalBlocks *local; RDMAControlHeader head; @@ -3852,7 +3852,7 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) return rdma_block_notification_handle(rioc, data); case RAM_CONTROL_HOOK: - return qemu_rdma_registration_handle(f, rioc); + return qemu_rdma_registration_handle(f); default: /* Shouldn't be called with any other values */ From patchwork Thu Apr 27 16:34:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774551 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aTqrqK45; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hGr40Htz23s0 for ; Fri, 28 Apr 2023 02:37:24 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4ah-0005UX-Oa; Thu, 27 Apr 2023 12:35:31 -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 1ps4ag-0005Qv-4X for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:30 -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 1ps4ae-0006ne-7G for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613325; 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=KeqppU5ddEmna+4HH/DlV8nM8nv9SHrAqAyn/lPWMYw=; b=aTqrqK45E8vwsSck4kwH8oLHWbYCxjOfDshptNj5TJMsYZ9DRDP2JD6y6rOfy5XQ8joTC2 vNGkqrfdJvzAhhDmRC7HAyC+pwtDXM5UESNv35TQHGNzsf5KgRq7H09iNjl2Xtyxv9rQi/ 4H8hIHTe+u9/Fhz9e/ZV42kmrVV29Pg= 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-220-kRDgi5fXP3mNwzI5tTJEeQ-1; Thu, 27 Apr 2023 12:35:16 -0400 X-MC-Unique: kRDgi5fXP3mNwzI5tTJEeQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6BFB21C08795 for ; Thu, 27 Apr 2023 16:35:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id A435863F46; Thu, 27 Apr 2023 16:35:02 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 11/19] migration/rdma: We can calculate the rioc from the QEMUFile Date: Thu, 27 Apr 2023 18:34:41 +0200 Message-Id: <20230427163449.27473-12-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 40b8e2da51..d7fdc963fd 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3811,9 +3811,10 @@ out: * the source. */ static int -rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name) +rdma_block_notification_handle(QEMUFile *f, const char *name) { RDMAContext *rdma; + QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); int curr; int found = -1; @@ -3846,10 +3847,9 @@ rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name) static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) { - QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); switch (flags) { case RAM_CONTROL_BLOCK_REG: - return rdma_block_notification_handle(rioc, data); + return rdma_block_notification_handle(f, data); case RAM_CONTROL_HOOK: return qemu_rdma_registration_handle(f); From patchwork Thu Apr 27 16:34:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774549 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MLnN0BtS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hGN3tvwz23s0 for ; Fri, 28 Apr 2023 02:37:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aV-0005Eb-FO; Thu, 27 Apr 2023 12:35: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 1ps4aS-0005D2-RN for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:16 -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 1ps4aO-0006iJ-GO for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613312; 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=Y1iUzXgl7Kpiayyw0jRzYGaGGHnXFr89XRU4iycxopk=; b=MLnN0BtSCpuCrvTvYsM8pON0c7gUueLG+jjxlQopi4m3n2z9ojo5E/uiccOGFYZ77ncXRo qMZJ4jt5kdZw/gq62lzWAuIsTL7jECvi6+H2d+AAu4lA0aQGiML7YEC+ClMQfStU4TNa56 4oRTi8BE3EHN4m3oyC6hbO/2XqDZZ7I= 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-673-IvjSvNmdPm-bvU8AKylXSg-1; Thu, 27 Apr 2023 12:35:09 -0400 X-MC-Unique: IvjSvNmdPm-bvU8AKylXSg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75E3238470BA for ; Thu, 27 Apr 2023 16:35:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF15F63F50; Thu, 27 Apr 2023 16:35:03 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 12/19] migration/rdma: It makes no sense to recive that flag without RDMA Date: Thu, 27 Apr 2023 18:34:42 +0200 Message-Id: <20230427163449.27473-13-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This could only happen if the source send RAM_SAVE_FLAG_HOOK (i.e. rdma) and destination don't have CONFIG_RDMA. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9b5e14a2ef..014db96984 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -322,14 +322,6 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) if (ret < 0) { qemu_file_set_error(f, ret); } - } else { - /* - * Hook is a hook specifically requested by the source sending a flag - * that expects there to be a hook on the destination. - */ - if (flags == RAM_CONTROL_HOOK) { - qemu_file_set_error(f, -EINVAL); - } } } From patchwork Thu Apr 27 16:34:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774553 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IHnJ+5C6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hHt6zCjz23s0 for ; Fri, 28 Apr 2023 02:38:18 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aY-0005Fl-72; Thu, 27 Apr 2023 12:35:22 -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 1ps4aX-0005FG-5a for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:21 -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 1ps4aV-0006ko-O8 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613319; 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=vFVSz2sLMTWKc6+hkxmZlMqk9lYsjx+Z706drG9kI7I=; b=IHnJ+5C6sHMbIWjYb6KYGSOCECM4I8wXX3vGQQP3WqotvxnQEG3TW1wPaSUd14NPyfmwJx l6quyt56GW//6ZGnU3yS/oJwtDzNyS8NYqLpGBxPbhOXDaehkzVlhT4Icz/LQWxYvjrvgZ RQ+KiDZxg3ESUE58oWHXU+OV1w1GYRM= 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-602-gd23lQhFMKa1w-wkylOLGw-1; Thu, 27 Apr 2023 12:35:17 -0400 X-MC-Unique: gd23lQhFMKa1w-wkylOLGw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81E3A817079 for ; Thu, 27 Apr 2023 16:35:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id B919410DF8; Thu, 27 Apr 2023 16:35:04 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 13/19] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry Date: Thu, 27 Apr 2023 18:34:43 +0200 Message-Id: <20230427163449.27473-14-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fixes this commit, clearly a bad merge after a rebase or similar, it should have been its own case since that point. commit 5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7 Author: Peter Lieven Date: Tue Jun 24 11:32:36 2014 +0200 migration: catch unknown flag combinations in ram_load Signed-off-by: Juan Quintela --- migration/ram.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index a5109a0f77..67ba2d7f7e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4466,14 +4466,12 @@ static int ram_load_precopy(QEMUFile *f) multifd_recv_sync_main(); } break; + case RAM_SAVE_FLAG_HOOK: + ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); + break; default: - if (flags & RAM_SAVE_FLAG_HOOK) { - ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); - } else { - error_report("Unknown combination of migration flags: 0x%x", - flags); - ret = -EINVAL; - } + error_report("Unknown combination of migration flags: 0x%x", flags); + ret = -EINVAL; } if (!ret) { ret = qemu_file_get_error(f); From patchwork Thu Apr 27 16:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ffgwNmjH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hJb6MMVz23s0 for ; Fri, 28 Apr 2023 02:38:55 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aZ-0005Fw-2Z; Thu, 27 Apr 2023 12:35: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 1ps4aX-0005Fe-Sg for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:21 -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 1ps4aV-0006kr-S2 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613319; 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=iZOknDHkrqErhjtulmRkjLzOJj3FFNiXAvfxSmzwR3g=; b=ffgwNmjHaDX1P31rXZe+TnUrdNv3/ji8/65gpQV+hzy5RL9YyEbYVzL6lIMxRtcgIrCpvj HqmtE6ExVOtEqACZR8PCulcIFxWo2RHQiaYq8cCxSuH4w+IZyhn+/Xov9hhmsXQtGOmWTC 9H5gNf3rpckgSHwydUyVOuNj5Ec9B7g= 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-638-IGc1tWcUP1mnyMnqn6wLCg-1; Thu, 27 Apr 2023 12:35:12 -0400 X-MC-Unique: IGc1tWcUP1mnyMnqn6wLCg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 908F03855597 for ; Thu, 27 Apr 2023 16:35:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id C549D63F52; Thu, 27 Apr 2023 16:35:05 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 14/19] migration/rdma: Remove all uses of RAM_CONTROL_HOOK Date: Thu, 27 Apr 2023 18:34:44 +0200 Message-Id: <20230427163449.27473-15-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Instead of going trhough ram_control_load_hook(), call qemu_rdma_registration_handle() directly. Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/ram.c | 5 ++++- migration/rdma.c | 5 +---- migration/rdma.h | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index fac26d7869..7623e3c475 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -41,7 +41,6 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data); */ #define RAM_CONTROL_SETUP 0 #define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_HOOK 2 #define RAM_CONTROL_FINISH 3 #define RAM_CONTROL_BLOCK_REG 4 diff --git a/migration/ram.c b/migration/ram.c index 67ba2d7f7e..c0110ca8cb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4467,7 +4467,10 @@ static int ram_load_precopy(QEMUFile *f) } break; case RAM_SAVE_FLAG_HOOK: - ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); + ret = qemu_rdma_registration_handle(f); + if (ret < 0) { + qemu_file_set_error(f, ret); + } break; default: error_report("Unknown combination of migration flags: 0x%x", flags); diff --git a/migration/rdma.c b/migration/rdma.c index d7fdc963fd..e72584483a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3527,7 +3527,7 @@ static int dest_ram_sort_func(const void *a, const void *b) * * Keep doing this until the source tells us to stop. */ -static int qemu_rdma_registration_handle(QEMUFile *f) +int qemu_rdma_registration_handle(QEMUFile *f) { RDMAControlHeader reg_resp = { .len = sizeof(RDMARegisterResult), .type = RDMA_CONTROL_REGISTER_RESULT, @@ -3851,9 +3851,6 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) case RAM_CONTROL_BLOCK_REG: return rdma_block_notification_handle(f, data); - case RAM_CONTROL_HOOK: - return qemu_rdma_registration_handle(f); - default: /* Shouldn't be called with any other values */ abort(); diff --git a/migration/rdma.h b/migration/rdma.h index a16a8d8bc6..8d0253047c 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,9 +24,11 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp); #ifdef CONFIG_RDMA +int qemu_rdma_registration_handle(QEMUFile *f); int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); #else +int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } #endif From patchwork Thu Apr 27 16:34:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774550 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VnZs6oKC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hGN5RXrz23vG for ; Fri, 28 Apr 2023 02:37:00 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4as-0005Xs-SK; Thu, 27 Apr 2023 12:35:42 -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 1ps4ap-0005XU-HR for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:39 -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 1ps4aZ-0006m0-QS for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613323; 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=ojgGHfB+wMyc8rrE0L1a8xisZz4sPMDO7VyWT6Ur3c4=; b=VnZs6oKCKBzzDBQ4GV/Q8LJJvy2bZHGR3QknFtUtUkGUWRkLjcFfzvuZmsyD5I2JwAic8c CUKex7bnAPFWdgjuWCxoz3MAt9kz2lv/8PXN1kF3WtjfeTbq4V8BLVwOC604GK0ixVlAvK AmLoOvxIFV2bwf+t3x85hazKSOeKcyQ= 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-468-0K7PqJ5eP7CO1ghiBktfCg-1; Thu, 27 Apr 2023 12:35:10 -0400 X-MC-Unique: 0K7PqJ5eP7CO1ghiBktfCg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A31B388CE15 for ; Thu, 27 Apr 2023 16:35:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5C3D10DF8; Thu, 27 Apr 2023 16:35:06 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 15/19] migration/rdma: Unfold hook_ram_load() Date: Thu, 27 Apr 2023 18:34:45 +0200 Message-Id: <20230427163449.27473-16-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There is only one flag called with: RAM_CONTROL_BLOCK_REG. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 10 ---------- migration/qemu-file.h | 11 ----------- migration/ram.c | 6 ++++-- migration/rdma.c | 25 +++++-------------------- migration/rdma.h | 2 ++ 5 files changed, 11 insertions(+), 43 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 014db96984..9d86900efe 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,16 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt = 0; } -void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) -{ - if (f->hooks && f->hooks->hook_ram_load) { - int ret = f->hooks->hook_ram_load(f, flags, data); - if (ret < 0) { - qemu_file_set_error(f, ret); - } - } -} - size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 7623e3c475..d69f5d65e8 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,20 +29,12 @@ #include "exec/cpu-common.h" #include "io/channel.h" -/* - * This function provides hooks around different - * stages of RAM migration. - * 'data' is call specific data associated with the 'flags' value - */ -typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags, void *data); - /* * Constants used by ram_control_* hooks */ #define RAM_CONTROL_SETUP 0 #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 -#define RAM_CONTROL_BLOCK_REG 4 /* * This function allows override of where the RAM page @@ -55,7 +47,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); typedef struct QEMUFileHooks { - QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; @@ -147,8 +138,6 @@ 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); -void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data); - /* Whenever this is found in the data stream, the flags * will be passed to ram_control_load_hook in the incoming-migration * side. This lets before_ram_iterate/after_ram_iterate add diff --git a/migration/ram.c b/migration/ram.c index c0110ca8cb..d29dd67d5f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4418,8 +4418,10 @@ static int ram_load_precopy(QEMUFile *f) ret = -EINVAL; } } - ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG, - block->idstr); + ret = rdma_block_notification_handle(f, block->idstr); + if (ret < 0) { + qemu_file_set_error(f, ret); + } } else { error_report("Unknown ramblock \"%s\", cannot " "accept migration", id); diff --git a/migration/rdma.c b/migration/rdma.c index e72584483a..72ea08ee95 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3804,14 +3804,12 @@ out: } /* Destination: - * Called via a ram_control_load_hook during the initial RAM load section which - * lists the RAMBlocks by name. This lets us know the order of the RAMBlocks - * on the source. - * We've already built our local RAMBlock list, but not yet sent the list to - * the source. + * Called during the initial RAM load section which lists the + * RAMBlocks by name. This lets us know the order of the RAMBlocks on + * the source. We've already built our local RAMBlock list, but not + * yet sent the list to the source. */ -static int -rdma_block_notification_handle(QEMUFile *f, const char *name) +int rdma_block_notification_handle(QEMUFile *f, const char *name) { RDMAContext *rdma; QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); @@ -3845,18 +3843,6 @@ rdma_block_notification_handle(QEMUFile *f, const char *name) return 0; } -static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) -{ - switch (flags) { - case RAM_CONTROL_BLOCK_REG: - return rdma_block_notification_handle(f, data); - - default: - /* Shouldn't be called with any other values */ - abort(); - } -} - int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); @@ -3995,7 +3981,6 @@ err: } static const QEMUFileHooks rdma_read_hooks = { - .hook_ram_load = rdma_load_hook, }; static const QEMUFileHooks rdma_write_hooks = { diff --git a/migration/rdma.h b/migration/rdma.h index 8d0253047c..1266a90e07 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -27,9 +27,11 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp); int qemu_rdma_registration_handle(QEMUFile *f); int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); +int rdma_block_notification_handle(QEMUFile *f, const char *name); #else int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_block_notification_handle(QEMUFile *f, const char *name) { return 0; } #endif #endif From patchwork Thu Apr 27 16:34:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OW4G5Il6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hJb12hXz23s0 for ; Fri, 28 Apr 2023 02:38:55 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aj-0005VJ-1j; Thu, 27 Apr 2023 12:35:33 -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 1ps4ah-0005U8-Ax for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -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 1ps4ae-0006ms-70 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613324; 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=6yMHYrA9NrI4BEISNh357klwmig/KwcB8MVZWi34Mqk=; b=OW4G5Il68pWKljyd9y97LVfO71rQXUJmi0+Z2vZbrrzmTbHfXytfV2V9kHe+s60AXV0Tt2 SzvT6/u7q1U8S/WDOfRR2Vx1k9jV2RRAuFaskIfS9dP6ks8uUmm7+zAqvnNRKRVsOix8dL 1UXZkzeIX37fEm9JllvmViRxB9mjAW0= 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-355-D2HCk5i0OtOAMwXUFQOvVw-1; Thu, 27 Apr 2023 12:35:13 -0400 X-MC-Unique: D2HCk5i0OtOAMwXUFQOvVw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7F2B88F475 for ; Thu, 27 Apr 2023 16:35:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA64F10DF8; Thu, 27 Apr 2023 16:35:07 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 16/19] migration/rdma: Make ram_control_save_page() use exported interfaces Date: Thu, 27 Apr 2023 18:34:46 +0200 Message-Id: <20230427163449.27473-17-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- migration/qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9d86900efe..17b3c2ea21 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -323,7 +323,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, int ret = f->hooks->save_page(f, block_offset, offset, size, bytes_sent); if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { - f->rate_limit_used += size; + qemu_file_acct_rate_limit(f, size); } if (ret != RAM_SAVE_CONTROL_DELAYED && From patchwork Thu Apr 27 16:34:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=i8RWYB5v; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hDy0ynzz23s0 for ; Fri, 28 Apr 2023 02:35:46 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4af-0005P6-Qw; Thu, 27 Apr 2023 12:35: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 1ps4ab-0005GO-1r for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:28 -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 1ps4aY-0006lK-B7 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613321; 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=osSFFVLtpSQW3rj3iu3uCMmm5SDDB3Xwew23SW70aBw=; b=i8RWYB5v3UK9IkoRGHDD4sBuyT8PqpD5gtMhisVOlQvIiXGqSW/42qPCYMCtGTyQzJZAxF tLTA+uFKTgAScC8bWlpL3K11+GFOOLERQRi74Ak9MQr1vSUXW/IjskoXKOWh4vwqI0i+d1 wsmhIBUTFN3e/uDVKb+ZEySFXHLK3dg= 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-193-1eQV3ExiM7-HUMg6bNUDyw-1; Thu, 27 Apr 2023 12:35:16 -0400 X-MC-Unique: 1eQV3ExiM7-HUMg6bNUDyw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C0F2D85C6F5 for ; Thu, 27 Apr 2023 16:35:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 071B463F4F; Thu, 27 Apr 2023 16:35:08 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 17/19] migration/rdma: Create rdma_control_save_page() Date: Thu, 27 Apr 2023 18:34:47 +0200 Message-Id: <20230427163449.27473-18-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The only user of ram_control_save_page() and save_page() hook was rdma. Just move the function to rdma.c, rename it to rdma_control_save_page(). Signed-off-by: Juan Quintela --- migration/qemu-file.c | 26 -------------------------- migration/qemu-file.h | 14 -------------- migration/ram.c | 4 ++-- migration/rdma.c | 22 +++++++++++++++++++++- migration/rdma.h | 8 ++++++++ 5 files changed, 31 insertions(+), 43 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 17b3c2ea21..8d3f33fe41 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,32 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt = 0; } -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent) -{ - if (f->hooks && f->hooks->save_page) { - int ret = f->hooks->save_page(f, block_offset, - offset, size, bytes_sent); - if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { - qemu_file_acct_rate_limit(f, size); - } - - if (ret != RAM_SAVE_CONTROL_DELAYED && - ret != RAM_SAVE_CONTROL_NOT_SUPP) { - if (bytes_sent && *bytes_sent > 0) { - qemu_file_credit_transfer(f, *bytes_sent); - } else if (ret < 0) { - qemu_file_set_error(f, ret); - } - } - - return ret; - } - - return RAM_SAVE_CONTROL_NOT_SUPP; -} - /* * Attempt to fill the buffer from the underlying file * Returns the number of bytes read, or negative value for an error. diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d69f5d65e8..ae3a704772 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -36,18 +36,7 @@ #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 -/* - * This function allows override of where the RAM page - * is saved (such as RDMA, for example.) - */ -typedef size_t (QEMURamSaveFunc)(QEMUFile *f, - ram_addr_t block_offset, - ram_addr_t offset, - size_t size, - uint64_t *bytes_sent); - typedef struct QEMUFileHooks { - QEMURamSaveFunc *save_page; } QEMUFileHooks; QEMUFile *qemu_file_new_input(QIOChannel *ioc); @@ -148,9 +137,6 @@ int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); #define RAM_SAVE_CONTROL_NOT_SUPP -1000 #define RAM_SAVE_CONTROL_DELAYED -2000 -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent); QIOChannel *qemu_file_get_ioc(QEMUFile *file); #endif diff --git a/migration/ram.c b/migration/ram.c index d29dd67d5f..a085ce8cae 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1342,8 +1342,8 @@ static bool control_save_page(PageSearchStatus *pss, RAMBlock *block, int ret; *pages = -1; - ret = ram_control_save_page(pss->pss_channel, block->offset, offset, - TARGET_PAGE_SIZE, &bytes_xmit); + ret = rdma_control_save_page(pss->pss_channel, block->offset, offset, + TARGET_PAGE_SIZE, &bytes_xmit); if (ret == RAM_SAVE_CONTROL_NOT_SUPP) { return false; } diff --git a/migration/rdma.c b/migration/rdma.c index 72ea08ee95..42ac7fd1e2 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3315,6 +3315,27 @@ err: return ret; } +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent) +{ + int ret = qemu_rdma_save_page(f, block_offset, offset, size, bytes_sent); + if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { + qemu_file_acct_rate_limit(f, size); + } + + if (ret != RAM_SAVE_CONTROL_DELAYED && + ret != RAM_SAVE_CONTROL_NOT_SUPP) { + if (bytes_sent && *bytes_sent > 0) { + qemu_file_credit_transfer(f, *bytes_sent); + } else if (ret < 0) { + qemu_file_set_error(f, ret); + } + } + return ret; +} + + static void rdma_accept_incoming_migration(void *opaque); static void rdma_cm_poll_handler(void *opaque) @@ -3984,7 +4005,6 @@ static const QEMUFileHooks rdma_read_hooks = { }; static const QEMUFileHooks rdma_write_hooks = { - .save_page = qemu_rdma_save_page, }; diff --git a/migration/rdma.h b/migration/rdma.h index 1266a90e07..ed3650ef67 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -17,6 +17,8 @@ #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H +#include "exec/memory.h" + void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp); @@ -28,10 +30,16 @@ int qemu_rdma_registration_handle(QEMUFile *f); int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); int rdma_block_notification_handle(QEMUFile *f, const char *name); +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent); #else int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } int rdma_block_notification_handle(QEMUFile *f, const char *name) { return 0; } +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent) { return false; } #endif #endif From patchwork Thu Apr 27 16:34:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OuVOyaKr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hJY4nCgz23s0 for ; Fri, 28 Apr 2023 02:38:53 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4aj-0005VR-Fq; Thu, 27 Apr 2023 12:35:33 -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 1ps4ah-0005UN-KH for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -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 1ps4af-0006pq-JT for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613328; 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=slYeA25HPZ4g+rB+oPhWKTNhtMCuA0yIjh1Q+drwesQ=; b=OuVOyaKrPrrLODlaFyAaYbtN3iGr+kJJ54obspM8QWaMMMpIXj547UsBkRnEcGBCuJBl/1 9Yy+7H27X+jv3YuycZnB9h7SlJNPA6awCpTb2iQsEwK4ocJjfF6KAJmv+GtoeYT66f7Ye8 pdMnJ7PUCzTcAaP7ZKCSLPMRgu202SQ= 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-217-EChx7ON2Ou2WGznL0oTyqQ-1; Thu, 27 Apr 2023 12:35:23 -0400 X-MC-Unique: EChx7ON2Ou2WGznL0oTyqQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C895D18A64F0 for ; Thu, 27 Apr 2023 16:35:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DD5F63F46; Thu, 27 Apr 2023 16:35:09 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 18/19] qemu-file: Remove QEMUFileHooks Date: Thu, 27 Apr 2023 18:34:48 +0200 Message-Id: <20230427163449.27473-19-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The only user was rdma, and its use is gone. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 6 ------ migration/qemu-file.h | 4 ---- migration/rdma.c | 9 --------- 3 files changed, 19 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 8d3f33fe41..c0c2195a6e 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -36,7 +36,6 @@ #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) struct QEMUFile { - const QEMUFileHooks *hooks; QIOChannel *ioc; bool is_writable; @@ -160,11 +159,6 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc) return qemu_file_new_impl(ioc, false); } -void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks) -{ - f->hooks = hooks; -} - /* * Get last error for stream f with optional Error* * diff --git a/migration/qemu-file.h b/migration/qemu-file.h index ae3a704772..9c99914b21 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -36,12 +36,8 @@ #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 -typedef struct QEMUFileHooks { -} QEMUFileHooks; - QEMUFile *qemu_file_new_input(QIOChannel *ioc); QEMUFile *qemu_file_new_output(QIOChannel *ioc); -void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks); int qemu_fclose(QEMUFile *f); /* diff --git a/migration/rdma.c b/migration/rdma.c index 42ac7fd1e2..63492fd4ac 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4001,13 +4001,6 @@ err: return ret; } -static const QEMUFileHooks rdma_read_hooks = { -}; - -static const QEMUFileHooks rdma_write_hooks = { -}; - - static void qio_channel_rdma_finalize(Object *obj) { QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(obj); @@ -4066,12 +4059,10 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma, const char *mode) rioc->file = qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout = rdma; rioc->rdmain = rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_write_hooks); } else { rioc->file = qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain = rdma; rioc->rdmaout = rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_read_hooks); } return rioc->file; From patchwork Thu Apr 27 16:34:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 1774554 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bMghXA3Z; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Q6hJ42gS8z23s0 for ; Fri, 28 Apr 2023 02:38:28 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ps4ai-0005VB-D7; Thu, 27 Apr 2023 12:35:32 -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 1ps4ah-0005UC-Fd for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ps4ae-0006n0-86 for qemu-devel@nongnu.org; Thu, 27 Apr 2023 12:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682613324; 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=6PblU6H1oK6jH35HJlGBHarLzSB+RlIpEk1lgmkn1qE=; b=bMghXA3ZIVCToW1sUpeaRnnuhN70TUKQ27g2cVsp+DGNk9CDVO12e3D/3i5TqJ5W6oltTe rjQWbpm5Q+IE18wsr/X04W4su8ugI+VNEY28n02EsBFzY7kutpfY95c0LZMOuVB/aI2PaS rf8G6KWd+3cSEF4WUV3XNlOvdG/qfsk= 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-144-NJ6Uf4npMIS7FMK2Wx_lMQ-1; Thu, 27 Apr 2023 12:35:21 -0400 X-MC-Unique: NJ6Uf4npMIS7FMK2Wx_lMQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEDAB282383D for ; Thu, 27 Apr 2023 16:35:11 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.238]) by smtp.corp.redhat.com (Postfix) with ESMTP id 168EB63F46; Thu, 27 Apr 2023 16:35:10 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Cc: Juan Quintela , Peter Xu , Leonardo Bras Subject: [PATCH 19/19] migration/rdma: Move rdma constants from qemu-file.h to rdma.h Date: Thu, 27 Apr 2023 18:34:49 +0200 Message-Id: <20230427163449.27473-20-quintela@redhat.com> In-Reply-To: <20230427163449.27473-1-quintela@redhat.com> References: <20230427163449.27473-1-quintela@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- migration/qemu-file.h | 17 ----------------- migration/ram.c | 2 +- migration/rdma.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 9c99914b21..5129b6f196 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,13 +29,6 @@ #include "exec/cpu-common.h" #include "io/channel.h" -/* - * Constants used by ram_control_* hooks - */ -#define RAM_CONTROL_SETUP 0 -#define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_FINISH 3 - QEMUFile *qemu_file_new_input(QIOChannel *ioc); QEMUFile *qemu_file_new_output(QIOChannel *ioc); int qemu_fclose(QEMUFile *f); @@ -123,16 +116,6 @@ 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); -/* Whenever this is found in the data stream, the flags - * will be passed to ram_control_load_hook in the incoming-migration - * side. This lets before_ram_iterate/after_ram_iterate add - * transport-specific sections to the RAM migration data. - */ -#define RAM_SAVE_FLAG_HOOK 0x80 - -#define RAM_SAVE_CONTROL_NOT_SUPP -1000 -#define RAM_SAVE_CONTROL_DELAYED -2000 - QIOChannel *qemu_file_get_ioc(QEMUFile *file); #endif diff --git a/migration/ram.c b/migration/ram.c index a085ce8cae..ac2296d740 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -86,7 +86,7 @@ #define RAM_SAVE_FLAG_EOS 0x10 #define RAM_SAVE_FLAG_CONTINUE 0x20 #define RAM_SAVE_FLAG_XBZRLE 0x40 -/* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ +/* 0x80 is reserved in rdma.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 #define RAM_SAVE_FLAG_MULTIFD_FLUSH 0x200 /* We can't use any flag that is bigger than 0x200 */ diff --git a/migration/rdma.h b/migration/rdma.h index ed3650ef67..96ec2cc8f0 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,6 +24,22 @@ void rdma_start_outgoing_migration(void *opaque, const char *host_port, void rdma_start_incoming_migration(const char *host_port, Error **errp); +/* + * Constants used by rdma return codes + */ +#define RAM_CONTROL_SETUP 0 +#define RAM_CONTROL_ROUND 1 +#define RAM_CONTROL_FINISH 3 + +/* + * Whenever this is found in the data stream, the flags + * will be passed to rdma functions in the incoming-migration + * side. + */ +#define RAM_SAVE_FLAG_HOOK 0x80 + +#define RAM_SAVE_CONTROL_NOT_SUPP -1000 +#define RAM_SAVE_CONTROL_DELAYED -2000 #ifdef CONFIG_RDMA int qemu_rdma_registration_handle(QEMUFile *f);