From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696424023; cv=none; d=zohomail.com; s=zohoarc; b=mVY64jG7mzIbKyTGhnaFHiowi7H5+Ybs3HfvH+/wONS6dXog7uViO0Sk2c3fgYa4wd6r5yULOBZlH2Bx77oQNl0rYyh00PDtbHL6UpcHpWcKuASyzExS+Gcx5yNmoMKcuF2r7Z5YidUglUPyiArEKnIvhPBfGL7sx6wTmBOdB+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696424023; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e9MU41DA6JfnvYM4B2zisrscwrZtuuap9bac0VUCHHY=; b=RdqnN4r0A1u84imCVUjtFrF49FYMZ78UwVndFNBi49SwM2LMtuRVpCAJKmNtDnap0xL+ZES30RPVCIjrHpxN9ZtKgXLxpGKQq6+djTd6Rcr2yFrusirX2YRJtTWlUNlAxeAWFfywTFg41ttPxx0bqxcZO73dGkA6I5G41NOOJI8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 169642402364966.11696980894578; Wed, 4 Oct 2023 05:53:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jh-0004Iq-0v; Wed, 04 Oct 2023 08:49: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 1qo1Jf-0004Hm-Ky for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -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 1qo1Jd-0006li-QC for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-176-fgnqabkjOGWUu0_n7yZQhQ-1; Wed, 04 Oct 2023 08:49:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EB35A1C0433F; Wed, 4 Oct 2023 12:49:16 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFE30C15BB8; Wed, 4 Oct 2023 12:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423765; 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=e9MU41DA6JfnvYM4B2zisrscwrZtuuap9bac0VUCHHY=; b=i/E2/cri5Cslmnsf/s9pCgwG5Z+Anvg95qUTout6m8K0pDx15gNo3n51F/PFaqk571hIG/ oIK2cgtDyWYcIjNzmL+DEhVj5C3HsS9T7feXAkMH9zLUaxIN1XJDm8MYAt3toQh4LkHv9l dk/NBJdcisKtxw2ILVboSWw5B9B86GU= X-MC-Unique: fgnqabkjOGWUu0_n7yZQhQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 01/10] migration: Create migrate_rdma() Date: Wed, 4 Oct 2023 14:49:04 +0200 Message-ID: <20231004124913.16360-2-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696424025799100003 Content-Type: text/plain; charset="utf-8" Helper to say if we are doing a migration over rdma. Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/migration.h | 2 ++ migration/options.h | 1 + migration/migration.c | 1 + migration/options.c | 7 +++++++ migration/rdma.c | 4 +++- 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/migration/migration.h b/migration/migration.h index 972597f4de..4543e36081 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -463,6 +463,8 @@ struct MigrationState { * switchover has been received. */ bool switchover_acked; + /* Is this a rdma migration */ + bool rdma_migration; }; =20 void migrate_set_state(int *state, int old_state, int new_state); diff --git a/migration/options.h b/migration/options.h index 045e2a41a2..a26fd1680b 100644 --- a/migration/options.h +++ b/migration/options.h @@ -56,6 +56,7 @@ bool migrate_zero_copy_send(void); =20 bool migrate_multifd_flush_after_each_section(void); bool migrate_postcopy(void); +bool migrate_rdma(void); bool migrate_tls(void); =20 /* capabilities helpers */ diff --git a/migration/migration.c b/migration/migration.c index 585d3c8f55..1cb8898e6b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1439,6 +1439,7 @@ int migrate_init(MigrationState *s, Error **errp) s->iteration_initial_bytes =3D 0; s->threshold_size =3D 0; s->switchover_acked =3D false; + s->rdma_migration =3D false; /* * set mig_stats compression_counters memory to zero for a * new migration diff --git a/migration/options.c b/migration/options.c index 1d1e1321b0..0107d63b9b 100644 --- a/migration/options.c +++ b/migration/options.c @@ -376,6 +376,13 @@ bool migrate_postcopy(void) return migrate_postcopy_ram() || migrate_dirty_bitmaps(); } =20 +bool migrate_rdma(void) +{ + MigrationState *s =3D migrate_get_current(); + + return s->rdma_migration; +} + bool migrate_tls(void) { MigrationState *s =3D migrate_get_current(); diff --git a/migration/rdma.c b/migration/rdma.c index cd5e1afe60..6219227915 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4126,6 +4126,7 @@ void rdma_start_incoming_migration(const char *host_p= ort, Error **errp) int ret; RDMAContext *rdma; Error *local_err =3D NULL; + MigrationState *s =3D migrate_get_current(); =20 trace_rdma_start_incoming_migration(); =20 @@ -4156,7 +4157,7 @@ void rdma_start_incoming_migration(const char *host_p= ort, Error **errp) } =20 trace_rdma_start_incoming_migration_after_rdma_listen(); - + s->rdma_migration =3D true; qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration, NULL, (void *)(intptr_t)rdma); return; @@ -4233,6 +4234,7 @@ void rdma_start_outgoing_migration(void *opaque, trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 s->to_dst_file =3D rdma_new_output(rdma); + s->rdma_migration =3D true; migrate_fd_connect(s, NULL); return; return_path_err: --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696424009778610.7950623729879; Wed, 4 Oct 2023 05:53:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jh-0004JA-7i; Wed, 04 Oct 2023 08:49: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 1qo1Jf-0004HK-3r for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -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 1qo1Jd-0006ku-5a for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:26 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-650-LKQwVBWtNgGGzqbizK45-A-1; Wed, 04 Oct 2023 08:49:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 62D5781D783; Wed, 4 Oct 2023 12:49:18 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39B8BC154CB; Wed, 4 Oct 2023 12:49:17 +0000 (UTC) X-MC-Unique: LKQwVBWtNgGGzqbizK45-A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 02/10] migration/rdma: Unfold ram_control_before_iterate() Date: Wed, 4 Oct 2023 14:49:05 +0200 Message-ID: <20231004124913.16360-3-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1696424011511100003 Content-Type: text/plain; charset="utf-8" Once there: - Remove unused data parameter - unfold it in its callers. - change all callers to call qemu_rdma_registration_start() - We need to call QIO_CHANNEL_RDMA() after we check for migrate_rdma() Reviewed-by: Peter Xu Signed-off-by: Juan Quintela -- initilazize rioc after checknig that rdma is enabled. Signed-off-by: Juan Quintela Reviewed-by: Fabiano Rosas --- migration/qemu-file.h | 2 -- migration/rdma.h | 7 +++++++ migration/qemu-file.c | 13 +------------ migration/ram.c | 16 +++++++++++++--- migration/rdma.c | 12 ++++-------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 03e718c264..d6a370c569 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -55,7 +55,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *before_ram_iterate; QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; @@ -127,7 +126,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); =20 -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); =20 diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..670c67a8cb 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -22,4 +22,11 @@ void rdma_start_outgoing_migration(void *opaque, const c= har *host_port, =20 void rdma_start_incoming_migration(const char *host_port, Error **errp); =20 + +#ifdef CONFIG_RDMA +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); +#else +static inline +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +#endif #endif diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 5e8207dae4..1a8170421f 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -32,6 +32,7 @@ #include "trace.h" #include "options.h" #include "qapi/error.h" +#include "rdma.h" =20 #define IO_BUF_SIZE 32768 #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) @@ -288,18 +289,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =3D 0; } =20 -void ram_control_before_iterate(QEMUFile *f, uint64_t flags) -{ - int ret =3D 0; - - if (f->hooks && f->hooks->before_ram_iterate) { - ret =3D 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 =3D 0; diff --git a/migration/ram.c b/migration/ram.c index e4bfd39f08..407760b3a2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -59,6 +59,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "rdma.h" #include "options.h" #include "sysemu/dirtylimit.h" #include "sysemu/kvm.h" @@ -3054,7 +3055,10 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } } =20 - ram_control_before_iterate(f, RAM_CONTROL_SETUP); + ret =3D 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); =20 migration_ops =3D g_malloc0(sizeof(MigrationOps)); @@ -3114,7 +3118,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaqu= e) /* Read version before ram_list.blocks */ smp_rmb(); =20 - ram_control_before_iterate(f, RAM_CONTROL_ROUND); + ret =3D qemu_rdma_registration_start(f, RAM_CONTROL_ROUND); + if (ret < 0) { + qemu_file_set_error(f, ret); + } =20 t0 =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); i =3D 0; @@ -3219,7 +3226,10 @@ static int ram_save_complete(QEMUFile *f, void *opaq= ue) migration_bitmap_sync_precopy(rs, true); } =20 - ram_control_before_iterate(f, RAM_CONTROL_FINISH); + ret =3D qemu_rdma_registration_start(f, RAM_CONTROL_FINISH); + if (ret < 0) { + qemu_file_set_error(f, ret); + } =20 /* try transferring iterative blocks of memory */ =20 diff --git a/migration/rdma.c b/migration/rdma.c index 6219227915..a93d8d705d 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3868,18 +3868,15 @@ static int rdma_load_hook(QEMUFile *f, uint64_t fla= gs, void *data) } } =20 -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 =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); - RDMAContext *rdma; - - if (migration_in_postcopy()) { + if (!migrate_rdma () || migration_in_postcopy()) { return 0; } =20 + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RCU_READ_LOCK_GUARD(); - rdma =3D qatomic_rcu_read(&rioc->rdmaout); + RDMAContext *rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { return -EIO; } @@ -4012,7 +4009,6 @@ static const QEMUFileHooks rdma_read_hooks =3D { }; =20 static const QEMUFileHooks rdma_write_hooks =3D { - .before_ram_iterate =3D qemu_rdma_registration_start, .after_ram_iterate =3D qemu_rdma_registration_stop, .save_page =3D qemu_rdma_save_page, }; --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696423837; cv=none; d=zohomail.com; s=zohoarc; b=YV6KZeG6MrfYuz9QlqEE5EX3dNrOZWJHcW3igZM6vA1P1h01RBh2T2H+apVep4995IIz+3T1VgwTEejI8BVlhHSu2LIl36/JjkZqFjKvHzNrXAiuYve1/AiTpkxXzFkkifV48GuQ8jXPZJ0g5JrZviW8rkJW/BPABQGfJDDYRMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696423837; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bqkYDICcUKQeEAJNHNLdGwxaS8sV7bbJx68o/+F+X6M=; b=M1Z8FfMyDJkwa6mzbICzjImpyWoe5sCCOvtsrTPJCaGzMoKIy9BYw6lsx71NOwsGfFgCoby6b00AZXDw+Wv02Pexmw3YcMgtUpxSYLPLZja2bAEE4SBLsUugpUuBsNsXZpSp/bHPDBjxmzvOp3n+pm0e19lIv563fDy+jRTZ1bk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696423837204696.2871168895919; Wed, 4 Oct 2023 05:50:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jh-0004JE-8h; Wed, 04 Oct 2023 08:49: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 1qo1Jf-0004Hq-Mi for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -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 1qo1Jd-0006kZ-H0 for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-392-CKQZZP80NxCpkMrcQu6y8Q-1; Wed, 04 Oct 2023 08:49:20 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC3A31C0419B; Wed, 4 Oct 2023 12:49:19 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id A433FC15BB8; Wed, 4 Oct 2023 12:49:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423763; 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=bqkYDICcUKQeEAJNHNLdGwxaS8sV7bbJx68o/+F+X6M=; b=hyGfvLL4tVClkRVJU8ITDWigJ58kqNmF0lUfQw5eE9wRYmhqGCRa9Dei0o6xe2FZNYMDhT sW6M9LLoyBxMCqEFlQgdaVo5EfBUkmCRGo7/CPTcPh7NxueMXa8cnSIrpbu9FXSX0xqC2F aqKjTMX0/atY93Bl5DH83+7UbaTPc5s= X-MC-Unique: CKQZZP80NxCpkMrcQu6y8Q-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 03/10] migration/rdma: Unfold ram_control_after_iterate() Date: Wed, 4 Oct 2023 14:49:06 +0200 Message-ID: <20231004124913.16360-4-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696423839374100003 Content-Type: text/plain; charset="utf-8" Once there: - Remove unused data parameter - unfold it in its callers - change all callers to call qemu_rdma_registration_stop() - We need to call QIO_CHANNEL_RDMA() after we check for migrate_rdma() Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- This function has goto's. So I don't change the place where we declare variables, althought I think that it is correct, just don't start that discussion. --- migration/qemu-file.h | 2 -- migration/rdma.h | 3 +++ migration/qemu-file.c | 12 ------------ migration/ram.c | 17 ++++++++++++++--- migration/rdma.c | 9 ++++----- 5 files changed, 21 insertions(+), 22 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d6a370c569..35e671a01e 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -55,7 +55,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; @@ -126,7 +125,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); =20 -void ram_control_after_iterate(QEMUFile *f, uint64_t flags); void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data); =20 /* Whenever this is found in the data stream, the flags diff --git a/migration/rdma.h b/migration/rdma.h index 670c67a8cb..c13b94c782 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -25,8 +25,11 @@ void rdma_start_incoming_migration(const char *host_port= , Error **errp); =20 #ifdef CONFIG_RDMA int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); #else static inline int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +static inline +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } #endif #endif diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 1a8170421f..35c5c9109b 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -289,18 +289,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =3D 0; } =20 -void ram_control_after_iterate(QEMUFile *f, uint64_t flags) -{ - int ret =3D 0; - - if (f->hooks && f->hooks->after_ram_iterate) { - ret =3D 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) { if (f->hooks && f->hooks->hook_ram_load) { diff --git a/migration/ram.c b/migration/ram.c index 407760b3a2..7bbdb69501 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3059,7 +3059,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 =3D qemu_rdma_registration_stop(f, RAM_CONTROL_SETUP); + if (ret < 0) { + qemu_file_set_error(f, ret); + } =20 migration_ops =3D g_malloc0(sizeof(MigrationOps)); migration_ops->ram_save_target_page =3D ram_save_target_page_legacy; @@ -3178,7 +3182,10 @@ static int ram_save_iterate(QEMUFile *f, void *opaqu= e) * Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ - ram_control_after_iterate(f, RAM_CONTROL_ROUND); + ret =3D qemu_rdma_registration_stop(f, RAM_CONTROL_ROUND); + if (ret < 0) { + qemu_file_set_error(f, ret); + } =20 out: if (ret >=3D 0 @@ -3251,7 +3258,11 @@ static int ram_save_complete(QEMUFile *f, void *opaq= ue) qemu_mutex_unlock(&rs->bitmap_mutex); =20 ram_flush_compressed_data(rs); - ram_control_after_iterate(f, RAM_CONTROL_FINISH); + + int ret =3D qemu_rdma_registration_stop(f, RAM_CONTROL_FINISH); + if (ret < 0) { + qemu_file_set_error(f, ret); + } } =20 if (ret < 0) { diff --git a/migration/rdma.c b/migration/rdma.c index a93d8d705d..0eff308577 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3894,19 +3894,19 @@ int qemu_rdma_registration_start(QEMUFile *f, uint6= 4_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 =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); + QIOChannelRDMA *rioc; RDMAContext *rdma; RDMAControlHeader head =3D { .len =3D 0, .repeat =3D 1 }; int ret =3D 0; =20 - if (migration_in_postcopy()) { + if (!migrate_rdma() || migration_in_postcopy()) { return 0; } =20 RCU_READ_LOCK_GUARD(); + rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { return -EIO; @@ -4009,7 +4009,6 @@ static const QEMUFileHooks rdma_read_hooks =3D { }; =20 static const QEMUFileHooks rdma_write_hooks =3D { - .after_ram_iterate =3D qemu_rdma_registration_stop, .save_page =3D qemu_rdma_save_page, }; =20 --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696424012; cv=none; d=zohomail.com; s=zohoarc; b=XaZXrkyMC63CjCrwYw+EKSkFKuOLSZSctHsBdfT3ykvypkFH+eECUy1k+/0HBIj2Ru4O3ao8Fm8uDKmyictv1G9bE3mCn3TA0w3ra7ml6jrUuV2bNNCbgBRExzbolTIieoxHLlY4+SdI41xn/W8bOy3OI1tf36DsT2johtuXyFU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696424012; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=i9Q7zBvhm5DMMFW68+/DUJZtZWVnU2s37cpMWFPBBqE=; b=KquyEWcjVdHId3Z4GsifelvtsjRIomVbXsSVR8JNLH2Hrr8wSf0r9LCnbyEcwOkWjOFxwXgZQ+zhmSTtQx+hXVWzqj9vA/BXDQvBweLBnCWZyHRmfqwQC22rczsyu7YHd14Owjsr7VNS4nGCrJeOTdCGZ4Pu5ZQGLX6hMts2ORc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696424012623945.3690145687052; Wed, 4 Oct 2023 05:53:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jj-0004MP-8o; Wed, 04 Oct 2023 08:49: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 1qo1Jf-0004He-Gv for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -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 1qo1Jd-0006lS-Dl for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:27 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-515-qraykl6VPTmeMomOe7hxgg-1; Wed, 04 Oct 2023 08:49:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 22EC028237C7; Wed, 4 Oct 2023 12:49:21 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1ABE1C15BB8; Wed, 4 Oct 2023 12:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423764; 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=i9Q7zBvhm5DMMFW68+/DUJZtZWVnU2s37cpMWFPBBqE=; b=RmVkc6jCHBfwnDk0uvbvM//rCh6mU1dlCDc302Xr+o6sae22wObJPscQrnbX8m/QpuABPR tnzEoXPz3qOEaxBu/+9a72t6T/Ord1hNFk6pqvqMkQt3zsTM5diVV83Ebb6eneArS8l08D soRYhmnbV5ehLoenbMe12VaqQe6SRt0= X-MC-Unique: qraykl6VPTmeMomOe7hxgg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 04/10] migration/rdma: Remove all uses of RAM_CONTROL_HOOK Date: Wed, 4 Oct 2023 14:49:07 +0200 Message-ID: <20231004124913.16360-5-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696424013532100006 Content-Type: text/plain; charset="utf-8" Instead of going trhough ram_control_load_hook(), call qemu_rdma_registration_handle() directly. Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/qemu-file.h | 1 - migration/rdma.h | 3 +++ migration/ram.c | 5 ++++- migration/rdma.c | 12 +++++++----- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 35e671a01e..14ff0d9cc4 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 =20 diff --git a/migration/rdma.h b/migration/rdma.h index c13b94c782..8bd277efb9 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,10 +24,13 @@ void rdma_start_incoming_migration(const char *host_por= t, Error **errp); =20 =20 #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 static inline +int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } +static inline int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } static inline int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } diff --git a/migration/ram.c b/migration/ram.c index 7bbdb69501..b3abcad1b4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4064,7 +4064,10 @@ static int ram_load_precopy(QEMUFile *f) } break; case RAM_SAVE_FLAG_HOOK: - ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); + ret =3D 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", f= lags); diff --git a/migration/rdma.c b/migration/rdma.c index 0eff308577..6208f1f818 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3535,7 +3535,7 @@ static int dest_ram_sort_func(const void *a, const vo= id *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 =3D { .len =3D sizeof(RDMARegisterResult), .type =3D RDMA_CONTROL_REGISTER_RESULT, @@ -3547,7 +3547,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f) }; RDMAControlHeader blocks =3D { .type =3D RDMA_CONTROL_RAM_BLOCKS_RESUL= T, .repeat =3D 1 }; - QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); + QIOChannelRDMA *rioc; RDMAContext *rdma; RDMALocalBlocks *local; RDMAControlHeader head; @@ -3562,7 +3562,12 @@ static int qemu_rdma_registration_handle(QEMUFile *f) int count =3D 0; int i =3D 0; =20 + if (!migrate_rdma()) { + return 0; + } + RCU_READ_LOCK_GUARD(); + rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); rdma =3D qatomic_rcu_read(&rioc->rdmain); =20 if (!rdma) { @@ -3859,9 +3864,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); =20 - case RAM_CONTROL_HOOK: - return qemu_rdma_registration_handle(f); - default: /* Shouldn't be called with any other values */ abort(); --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696424026; cv=none; d=zohomail.com; s=zohoarc; b=K2uiW69yZtXLw198T7twdbFlPt9aTzmRntaLiWmrGRvoQWEL+oEoB5UvfMk0q7Z2JU64xpPXAKiGdkjx1DXiOlBAf9yWb+FEgksylpXE8+fUEBzPBnj1dFltDUoEfryRrM2ZI6GjxS+psFREDoR70AjMYO6NNgVjOelc4CINf7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696424026; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8xS+kII0jvSdTKfFZqzKi2cAJZEjKFgKVl7CcotjwCA=; b=SSqdJIwmpB2MS48GuU+yPLaFp9jkHiP0Zfy6mLFqtjm2kyIu48fJq9OQMu/NUqK3/HWHgXKvHJbEBsdOPQMdQTYupIZ9hhPMSexBnHad/jA1mp8pOVtDwEuyqJHy2LMdaOcxCGTz9tH+EQrviyEfiS7j+yV9wrzQklZngbxvE4U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696424026005828.7699016509488; Wed, 4 Oct 2023 05:53:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Ji-0004JO-UL; Wed, 04 Oct 2023 08:49:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qo1Jg-0004In-PF for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:28 -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 1qo1Jd-0006kw-W5 for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:28 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-26-fU1-IfcmPvSyqHqJBtfaoQ-1; Wed, 04 Oct 2023 08:49:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 750D83801EF0; Wed, 4 Oct 2023 12:49:22 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62506C15BB8; Wed, 4 Oct 2023 12:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423764; 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=8xS+kII0jvSdTKfFZqzKi2cAJZEjKFgKVl7CcotjwCA=; b=QVJ658b3lMZKK+JCy3KmoA7q+kI/bwZ+YfyJp+RVY+Jzt7U3NNCFh27JpImWnKBevbnF4h Hczh21WFj5GrEWFUXCAStdDEvvtd8KQbnIuwQKA9NXENFeRYyJEbsQvmXnpv83IJ6R55kN Tn069AVhbBgIO7XKYkkrSu8YXe1zAVY= X-MC-Unique: fU1-IfcmPvSyqHqJBtfaoQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 05/10] migration/rdma: Unfold hook_ram_load() Date: Wed, 4 Oct 2023 14:49:08 +0200 Message-ID: <20231004124913.16360-6-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696424027868100007 Content-Type: text/plain; charset="utf-8" There is only one flag called with: RAM_CONTROL_BLOCK_REG. Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/qemu-file.h | 11 ----------- migration/rdma.h | 3 +++ migration/qemu-file.c | 10 ---------- migration/ram.c | 6 ++++-- migration/rdma.c | 34 +++++++++++----------------------- 5 files changed, 18 insertions(+), 46 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 14ff0d9cc4..80c30631dc 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,20 +29,12 @@ #include "exec/cpu-common.h" #include "io/channel.h" =20 -/* - * 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 =20 /* * This function allows override of where the RAM page @@ -54,7 +46,6 @@ typedef int (QEMURamSaveFunc)(QEMUFile *f, size_t size); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; =20 @@ -124,8 +115,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); =20 -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/rdma.h b/migration/rdma.h index 8bd277efb9..8df8b4089a 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -27,6 +27,7 @@ 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 static inline int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } @@ -34,5 +35,7 @@ static inline int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } static inline int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +static inline +int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } #endif #endif diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 35c5c9109b..a15d1f6635 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -289,16 +289,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =3D 0; } =20 -void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) -{ - if (f->hooks && f->hooks->hook_ram_load) { - int ret =3D f->hooks->hook_ram_load(f, flags, data); - if (ret < 0) { - qemu_file_set_error(f, ret); - } - } -} - int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { diff --git a/migration/ram.c b/migration/ram.c index b3abcad1b4..656e1dd96c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4015,8 +4015,10 @@ static int ram_load_precopy(QEMUFile *f) ret =3D -EINVAL; } } - ram_control_load_hook(f, RAM_CONTROL_BLOCK_REG, - block->idstr); + ret =3D 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 6208f1f818..65514999a3 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3817,22 +3817,23 @@ out: } =20 /* 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 RAMBlo= cks - * 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 =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); int curr; int found =3D -1; =20 + if (!migrate_rdma()) { + return 0; + } + RCU_READ_LOCK_GUARD(); - rdma =3D qatomic_rcu_read(&rioc->rdmain); + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); + RDMAContext *rdma =3D qatomic_rcu_read(&rioc->rdmain); =20 if (!rdma) { return -EIO; @@ -3858,18 +3859,6 @@ rdma_block_notification_handle(QEMUFile *f, const ch= ar *name) return 0; } =20 -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) { if (!migrate_rdma () || migration_in_postcopy()) { @@ -4007,7 +3996,6 @@ err: } =20 static const QEMUFileHooks rdma_read_hooks =3D { - .hook_ram_load =3D rdma_load_hook, }; =20 static const QEMUFileHooks rdma_write_hooks =3D { --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696423790; cv=none; d=zohomail.com; s=zohoarc; b=FSLTV+v0Y5HApAL4xw2sSsfpSte5NcetfkkYava/SBzc5lZ2xuUZ+V80kEtWBBFw3Zl6qRyDkvgCt9sEFd/npAWK/vppV4TatWp963kEJPcw1j9nR9ep2VDwqiA3eCe3ncSh0YN3ncnnzf+a9S160RHWwt8gWBHCb/O0vXuXjBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696423790; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=g8Pjmasy6+GRIBw3Fg1/G8cwMzWt0Q224997T/Po1Sc=; b=a5t/qSeovnj3WK0JnGvincCekN/XXmoDx7ov2MA10oL6gA0eFDJ3+eKm6qd00UpSDRBsCTYsV4M3dcr6rEvomo1hzkp6qBEcPHbv19skZ1hJUFbndMvWbKAQIb2VeAv+p3kGt8OVRst0JscxudoZ+k69HiyZikrwTYuA4v/nxb0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696423790837238.17596564049063; Wed, 4 Oct 2023 05:49:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jk-0004NY-2y; Wed, 04 Oct 2023 08:49: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 1qo1Jh-0004JM-Sn for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:29 -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 1qo1Jf-0006mV-VW for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:29 -0400 Received: from mimecast-mx02.redhat.com (mx-ext.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-386-iSrzpD2MOsK3mFYdkh_Fqw-1; Wed, 04 Oct 2023 08:49:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E00ED1C04199; Wed, 4 Oct 2023 12:49:23 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5843C15BB8; Wed, 4 Oct 2023 12:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423767; 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=g8Pjmasy6+GRIBw3Fg1/G8cwMzWt0Q224997T/Po1Sc=; b=BWikptjQqq5awUS3k9iQFB8q4cFYWCoh9RWXlEEDXIGeFg+SthJmzzgGDDni8G7dzwDqmr hJS40mZaGsNzZoW6Ki0q9S8KzYwMK7RnyQNIHKH6+OPkjxvMBzl7Bq1uEhF46/4i9FBRPk SBdlfmgmug3PaKfSv/Z2bP5ag6YCpNc= X-MC-Unique: iSrzpD2MOsK3mFYdkh_Fqw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 06/10] migration/rdma: Create rdma_control_save_page() Date: Wed, 4 Oct 2023 14:49:09 +0200 Message-ID: <20231004124913.16360-7-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696423792268100003 Content-Type: text/plain; charset="utf-8" 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(). Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/qemu-file.h | 12 ------------ migration/rdma.h | 10 ++++++++++ migration/qemu-file.c | 20 -------------------- migration/ram.c | 4 ++-- migration/rdma.c | 20 +++++++++++++++++++- 5 files changed, 31 insertions(+), 35 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 80c30631dc..60510a2819 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -36,17 +36,7 @@ #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 =20 -/* - * This function allows override of where the RAM page - * is saved (such as RDMA, for example.) - */ -typedef int (QEMURamSaveFunc)(QEMUFile *f, - ram_addr_t block_offset, - ram_addr_t offset, - size_t size); - typedef struct QEMUFileHooks { - QEMURamSaveFunc *save_page; } QEMUFileHooks; =20 QEMUFile *qemu_file_new_input(QIOChannel *ioc); @@ -125,8 +115,6 @@ int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t siz= e); #define RAM_SAVE_CONTROL_NOT_SUPP -1000 #define RAM_SAVE_CONTROL_DELAYED -2000 =20 -int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size); QIOChannel *qemu_file_get_ioc(QEMUFile *file); =20 #endif diff --git a/migration/rdma.h b/migration/rdma.h index 8df8b4089a..09a16c1e3c 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -17,6 +17,8 @@ #ifndef QEMU_MIGRATION_RDMA_H #define QEMU_MIGRATION_RDMA_H =20 +#include "exec/memory.h" + void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp); =20 @@ -28,6 +30,8 @@ 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); +int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size); #else static inline int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } @@ -37,5 +41,11 @@ static inline int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } static inline int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } +static inline +int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size) +{ + return RAM_SAVE_CONTROL_NOT_SUPP; +} #endif #endif diff --git a/migration/qemu-file.c b/migration/qemu-file.c index a15d1f6635..e3514740fb 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -289,26 +289,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =3D 0; } =20 -int ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size) -{ - if (f->hooks && f->hooks->save_page) { - int ret =3D f->hooks->save_page(f, block_offset, offset, size); - /* - * RAM_SAVE_CONTROL_* are negative values - */ - if (ret !=3D RAM_SAVE_CONTROL_DELAYED && - ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - 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/ram.c b/migration/ram.c index 656e1dd96c..e5d443daf2 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1189,8 +1189,8 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, { int ret; =20 - ret =3D ram_control_save_page(pss->pss_channel, block->offset, offset, - TARGET_PAGE_SIZE); + ret =3D rdma_control_save_page(pss->pss_channel, block->offset, offset, + TARGET_PAGE_SIZE); if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { return false; } diff --git a/migration/rdma.c b/migration/rdma.c index 65514999a3..7f10bfb81b 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3324,6 +3324,25 @@ err: return ret; } =20 +int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size) +{ + if (!migrate_rdma()) { + return RAM_SAVE_CONTROL_NOT_SUPP; + } + + int ret =3D qemu_rdma_save_page(f, block_offset, offset, size); + + if (ret !=3D RAM_SAVE_CONTROL_DELAYED && + ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { + if (ret < 0) { + qemu_file_set_error(f, ret); + } + } + return ret; +} + + static void rdma_accept_incoming_migration(void *opaque); =20 static void rdma_cm_poll_handler(void *opaque) @@ -3999,7 +4018,6 @@ static const QEMUFileHooks rdma_read_hooks =3D { }; =20 static const QEMUFileHooks rdma_write_hooks =3D { - .save_page =3D qemu_rdma_save_page, }; =20 =20 --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696423807; cv=none; d=zohomail.com; s=zohoarc; b=KjPonX9/LsLpeHnZvYll/CiHoANTQC3AIEy7sWnZy60aEV1LjuCrINnccdAizAJpeJsUlgnpnvcJLkq8PDu2g5kL9HR/mw+x23XeONwzDcaHyhquipvjUYkwTzmIP3IiQIqnzCWloQOHiLLgtPIGHCGd6MDLyOyUk8hrNU/g1fY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696423807; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f0oy7NU7qNwaSv6DKXuDG0U9gzTLoRBDG+LgTwRNog4=; b=nR6dqI8l60ai9MdLB9hUjlxeeNbHHjYnf2R8EWH/0PEohJ326tXAsMaAvNwdQXnoCsHZcw95OrdYkfLBO+z+IVqLEUQn3CGi7v3xEQmX5rXnXYoMy0HsCrhi/PNHmUW+nGB9W1KASgvDnWq9e8eSxC0yR+P9QAD5edkO57GsYv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696423807185250.51470123909564; Wed, 4 Oct 2023 05:50:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jm-0004On-MG; Wed, 04 Oct 2023 08:49:34 -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 1qo1Jk-0004NP-TJ for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:33 -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 1qo1Jh-0006nt-7d for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:31 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-342-Ibt-sZJTPr2VeYUyUstoKA-1; Wed, 04 Oct 2023 08:49:25 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 360678007A4; Wed, 4 Oct 2023 12:49:25 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2DA22C154CC; Wed, 4 Oct 2023 12:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423768; 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=f0oy7NU7qNwaSv6DKXuDG0U9gzTLoRBDG+LgTwRNog4=; b=Dc5DGYJvRyFwEK4DMRmeP8Kw+uk33mP0/w0oM9TOk79SctNt+tGtXnL5LEn86+r75wKi3R or3NmOcTS9/S8TrVna7KtVPgCuaQmQDMGIoHALO4atLSWUovGtBanFUHOy2zoymF4Brwnn Dw+4OJVc44u0fedZswwplloetHlhYLM= X-MC-Unique: Ibt-sZJTPr2VeYUyUstoKA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 07/10] qemu-file: Remove QEMUFileHooks Date: Wed, 4 Oct 2023 14:49:10 +0200 Message-ID: <20231004124913.16360-8-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696423808565100001 Content-Type: text/plain; charset="utf-8" The only user was rdma, and its use is gone. Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/qemu-file.h | 4 ---- migration/qemu-file.c | 6 ------ migration/rdma.c | 9 --------- 3 files changed, 19 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 60510a2819..0b22d8335f 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 =20 -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); =20 /* diff --git a/migration/qemu-file.c b/migration/qemu-file.c index e3514740fb..352bb320a2 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -38,7 +38,6 @@ #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) =20 struct QEMUFile { - const QEMUFileHooks *hooks; QIOChannel *ioc; bool is_writable; =20 @@ -133,11 +132,6 @@ QEMUFile *qemu_file_new_input(QIOChannel *ioc) return qemu_file_new_impl(ioc, false); } =20 -void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks) -{ - f->hooks =3D hooks; -} - /* * Get last error for stream f with optional Error* * diff --git a/migration/rdma.c b/migration/rdma.c index 7f10bfb81b..bcb6de14e7 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4014,13 +4014,6 @@ err: return ret; } =20 -static const QEMUFileHooks rdma_read_hooks =3D { -}; - -static const QEMUFileHooks rdma_write_hooks =3D { -}; - - static void qio_channel_rdma_finalize(Object *obj) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(obj); @@ -4072,7 +4065,6 @@ static QEMUFile *rdma_new_input(RDMAContext *rdma) rioc->file =3D qemu_file_new_input(QIO_CHANNEL(rioc)); rioc->rdmain =3D rdma; rioc->rdmaout =3D rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_read_hooks); =20 return rioc->file; } @@ -4084,7 +4076,6 @@ static QEMUFile *rdma_new_output(RDMAContext *rdma) rioc->file =3D qemu_file_new_output(QIO_CHANNEL(rioc)); rioc->rdmaout =3D rdma; rioc->rdmain =3D rdma->return_path; - qemu_file_set_hooks(rioc->file, &rdma_write_hooks); =20 return rioc->file; } --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696424013; cv=none; d=zohomail.com; s=zohoarc; b=PuNpaI0XtTVOn/6vYQ/Iqws4mWwnR7pgcNfbStw1xQy9AFSOFaJVW8k4RzcRKe1CTLPHjx0hBjviiUNAWiAr2YMiMtdVoFctn1h0wdB7QvxcwBf3qmqSfPJx8t9GbA18VVg4zwkmasMShZqt8tqiE8rDPYWbJx7BCyvCMoX8n5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696424013; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NAww9ifZU6DIVsqPpQv+zvXrEcr7jvwrYo1gmKjhqcM=; b=elwg/qGreFrJA3uMXu/aC7ms2uqCXi/YLebb5GDepc1K00syyj1bEJ7rjFBmgr+mGNlgf2Aqmg20j+kktO8bP//x6HS4isBbVdHhIcalPVprRRAgHQ+D2g5YsuMQZDZeUfGFbM922C/4p0dltEMN56l4LYj+iLPlV6lR3a4JgKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696424012872560.4504389878683; Wed, 4 Oct 2023 05:53:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jo-0004QV-Mf; Wed, 04 Oct 2023 08:49:36 -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 1qo1Jm-0004Om-IW for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:34 -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 1qo1Jk-0006pU-UI for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:34 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-9plFeFxzM0aYfHDXS__XWg-1; Wed, 04 Oct 2023 08:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7EF24101A550; Wed, 4 Oct 2023 12:49:26 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78214C15BB8; Wed, 4 Oct 2023 12:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423772; 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=NAww9ifZU6DIVsqPpQv+zvXrEcr7jvwrYo1gmKjhqcM=; b=ZQKeyPLhzopehcyNn1QeG2TLZ3La+Mv5IiAl8VBFdnz2yJG1JvtN33fu2eJVhGyEts1FmT QhekUrZkAwJ3lT/xTsu66Osj6G7A4Io1/O4T+ayVVbmdc15vPxMAQU0hmrcyC+3/tltI+t 8vO2W7Ssd1OqYjvzKe55rez86m6rS8E= X-MC-Unique: 9plFeFxzM0aYfHDXS__XWg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 08/10] migration/rdma: Move rdma constants from qemu-file.h to rdma.h Date: Wed, 4 Oct 2023 14:49:11 +0200 Message-ID: <20231004124913.16360-9-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696424013513100005 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/qemu-file.h | 17 ----------------- migration/rdma.h | 16 ++++++++++++++++ migration/ram.c | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 0b22d8335f..a29c37b0d0 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,13 +29,6 @@ #include "exec/cpu-common.h" #include "io/channel.h" =20 -/* - * 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); @@ -101,16 +94,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); =20 -/* 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); =20 #endif diff --git a/migration/rdma.h b/migration/rdma.h index 09a16c1e3c..1ff3718a76 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,6 +24,22 @@ void rdma_start_outgoing_migration(void *opaque, const c= har *host_port, =20 void rdma_start_incoming_migration(const char *host_port, Error **errp); =20 +/* + * 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 =20 #ifdef CONFIG_RDMA int qemu_rdma_registration_handle(QEMUFile *f); diff --git a/migration/ram.c b/migration/ram.c index e5d443daf2..f3bf7b9185 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -89,7 +89,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 */ --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696424016; cv=none; d=zohomail.com; s=zohoarc; b=bhF+5Fcs7SG3BUgUyKpeHCjP1mkzdlr3QW5Zd6MzXB56WqiDLWI2X2PcLrUy0czIT/7S/lfib0Ctg1DyHi3Qkdkh3fKq5/xC3PJ8ugX7nCRtsK3g+pipPdMWzWy1LNqeSLCyp6Ss2lZLmErrwFxbKXTrqoeXzOJOf4zMTVP2ogo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696424016; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9wRTD5giybEw68V1PDmeHnoeErlYmhxTKuys4OCt95M=; b=a+OqJy6Ecd8hJ4NuQWqpkQ0/pUN+3UXFfXvprsw8qWKBoBtnwNLqWTraLBuJctoD2HlallLOOc9XYS9+YLEaeFKQzONzlTt6myTN02YLGErRbd9wo0SrOZswJA2PDjpW5/j5lC7vtl7KfNnn7axXLBjdyS5MoApVPfVEcgccnlE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696424016298204.06134484132065; Wed, 4 Oct 2023 05:53:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1Jp-0004Qi-AY; Wed, 04 Oct 2023 08:49:37 -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 1qo1Jn-0004PD-Ai for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:35 -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 1qo1Jl-0006pa-4L for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-116-LNHBBVFOP0WThU0zbOi1rw-1; Wed, 04 Oct 2023 08:49:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EADDB81B13F; Wed, 4 Oct 2023 12:49:27 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id C2196C15BB8; Wed, 4 Oct 2023 12:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423772; 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=9wRTD5giybEw68V1PDmeHnoeErlYmhxTKuys4OCt95M=; b=EswDKGdIPzyQxnQVig2tHDvjjL8BsG0T3pQ+klnaM58cvESth9F/ZMV9mPSzfY9K8whcvw sfePMDd157lOi8+2Np6RbRvgPzlVwY5m8lbtUkqY0paWY89C9SGA69yeRBjGiHxjkfu0kN oJFCwdGJRxg6X08WQ9EeJaoLjXguNmU= X-MC-Unique: LNHBBVFOP0WThU0zbOi1rw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 09/10] migration/rdma: Remove qemu_ prefix from exported functions Date: Wed, 4 Oct 2023 14:49:12 +0200 Message-ID: <20231004124913.16360-10-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696424017675100003 Content-Type: text/plain; charset="utf-8" Functions are long enough even without this. Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/rdma.h | 12 ++++++------ migration/ram.c | 14 +++++++------- migration/rdma.c | 40 +++++++++++++++++++--------------------- migration/trace-events | 28 ++++++++++++++-------------- 4 files changed, 46 insertions(+), 48 deletions(-) diff --git a/migration/rdma.h b/migration/rdma.h index 1ff3718a76..30b15b4466 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -42,19 +42,19 @@ void rdma_start_incoming_migration(const char *host_por= t, Error **errp); #define RAM_SAVE_CONTROL_DELAYED -2000 =20 #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); +int rdma_registration_handle(QEMUFile *f); +int rdma_registration_start(QEMUFile *f, uint64_t flags); +int rdma_registration_stop(QEMUFile *f, uint64_t flags); int rdma_block_notification_handle(QEMUFile *f, const char *name); int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size); #else static inline -int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } +int rdma_registration_handle(QEMUFile *f) { return 0; } static inline -int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } static inline -int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } static inline int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } static inline diff --git a/migration/ram.c b/migration/ram.c index f3bf7b9185..abfc57a58c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3055,12 +3055,12 @@ static int ram_save_setup(QEMUFile *f, void *opaque) } } =20 - ret =3D qemu_rdma_registration_start(f, RAM_CONTROL_SETUP); + ret =3D rdma_registration_start(f, RAM_CONTROL_SETUP); if (ret < 0) { qemu_file_set_error(f, ret); } =20 - ret =3D qemu_rdma_registration_stop(f, RAM_CONTROL_SETUP); + ret =3D rdma_registration_stop(f, RAM_CONTROL_SETUP); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -3122,7 +3122,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) /* Read version before ram_list.blocks */ smp_rmb(); =20 - ret =3D qemu_rdma_registration_start(f, RAM_CONTROL_ROUND); + ret =3D rdma_registration_start(f, RAM_CONTROL_ROUND); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -3182,7 +3182,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque) * Must occur before EOS (or any QEMUFile operation) * because of RDMA protocol. */ - ret =3D qemu_rdma_registration_stop(f, RAM_CONTROL_ROUND); + ret =3D rdma_registration_stop(f, RAM_CONTROL_ROUND); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -3233,7 +3233,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) migration_bitmap_sync_precopy(rs, true); } =20 - ret =3D qemu_rdma_registration_start(f, RAM_CONTROL_FINISH); + ret =3D rdma_registration_start(f, RAM_CONTROL_FINISH); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -3259,7 +3259,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) =20 ram_flush_compressed_data(rs); =20 - int ret =3D qemu_rdma_registration_stop(f, RAM_CONTROL_FINISH); + int ret =3D rdma_registration_stop(f, RAM_CONTROL_FINISH); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -4066,7 +4066,7 @@ static int ram_load_precopy(QEMUFile *f) } break; case RAM_SAVE_FLAG_HOOK: - ret =3D qemu_rdma_registration_handle(f); + ret =3D rdma_registration_handle(f); if (ret < 0) { qemu_file_set_error(f, ret); } diff --git a/migration/rdma.c b/migration/rdma.c index bcb6de14e7..c73e610416 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3554,7 +3554,7 @@ static int dest_ram_sort_func(const void *a, const vo= id *b) * * Keep doing this until the source tells us to stop. */ -int qemu_rdma_registration_handle(QEMUFile *f) +int rdma_registration_handle(QEMUFile *f) { RDMAControlHeader reg_resp =3D { .len =3D sizeof(RDMARegisterResult), .type =3D RDMA_CONTROL_REGISTER_RESULT, @@ -3597,7 +3597,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) =20 local =3D &rdma->local_ram_blocks; do { - trace_qemu_rdma_registration_handle_wait(); + trace_rdma_registration_handle_wait(); =20 ret =3D qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_NONE); =20 @@ -3617,9 +3617,9 @@ int qemu_rdma_registration_handle(QEMUFile *f) comp =3D (RDMACompress *) rdma->wr_data[idx].control_curr; network_to_compress(comp); =20 - trace_qemu_rdma_registration_handle_compress(comp->length, - comp->block_idx, - comp->offset); + trace_rdma_registration_handle_compress(comp->length, + comp->block_idx, + comp->offset); if (comp->block_idx >=3D rdma->local_ram_blocks.nb_blocks) { error_report("rdma: 'compress' bad block index %u (vs %d)", (unsigned int)comp->block_idx, @@ -3636,11 +3636,11 @@ int qemu_rdma_registration_handle(QEMUFile *f) break; =20 case RDMA_CONTROL_REGISTER_FINISHED: - trace_qemu_rdma_registration_handle_finished(); + trace_rdma_registration_handle_finished(); goto out; =20 case RDMA_CONTROL_RAM_BLOCKS_REQUEST: - trace_qemu_rdma_registration_handle_ram_blocks(); + trace_rdma_registration_handle_ram_blocks(); =20 /* Sort our local RAM Block list so it's the same as the sourc= e, * we can do this since we've filled in a src_index in the list @@ -3680,7 +3680,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) rdma->dest_blocks[i].length =3D local->block[i].length; =20 dest_block_to_network(&rdma->dest_blocks[i]); - trace_qemu_rdma_registration_handle_ram_blocks_loop( + trace_rdma_registration_handle_ram_blocks_loop( local->block[i].block_name, local->block[i].offset, local->block[i].length, @@ -3702,7 +3702,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) =20 break; case RDMA_CONTROL_REGISTER_REQUEST: - trace_qemu_rdma_registration_handle_register(head.repeat); + trace_rdma_registration_handle_register(head.repeat); =20 reg_resp.repeat =3D head.repeat; registers =3D (RDMARegister *) rdma->wr_data[idx].control_curr; @@ -3716,7 +3716,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) =20 reg_result =3D &results[count]; =20 - trace_qemu_rdma_registration_handle_register_loop(count, + trace_rdma_registration_handle_register_loop(count, reg->current_index, reg->key.current_addr, reg->c= hunks); =20 if (reg->current_index >=3D rdma->local_ram_blocks.nb_bloc= ks) { @@ -3768,8 +3768,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) =20 reg_result->host_addr =3D (uintptr_t)block->local_host_add= r; =20 - trace_qemu_rdma_registration_handle_register_rkey( - reg_result->rke= y); + trace_rdma_registration_handle_register_rkey(reg_result->r= key); =20 result_to_network(reg_result); } @@ -3783,7 +3782,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) } break; case RDMA_CONTROL_UNREGISTER_REQUEST: - trace_qemu_rdma_registration_handle_unregister(head.repeat); + trace_rdma_registration_handle_unregister(head.repeat); unreg_resp.repeat =3D head.repeat; registers =3D (RDMARegister *) rdma->wr_data[idx].control_curr; =20 @@ -3791,7 +3790,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) reg =3D ®isters[count]; network_to_register(reg); =20 - trace_qemu_rdma_registration_handle_unregister_loop(count, + trace_rdma_registration_handle_unregister_loop(count, reg->current_index, reg->key.chunk); =20 block =3D &(rdma->local_ram_blocks.block[reg->current_inde= x]); @@ -3807,8 +3806,7 @@ int qemu_rdma_registration_handle(QEMUFile *f) =20 rdma->total_registrations--; =20 - trace_qemu_rdma_registration_handle_unregister_success( - reg->key.chunk); + trace_rdma_registration_handle_unregister_success(reg->key= .chunk); } =20 ret =3D qemu_rdma_post_send_control(rdma, NULL, &unreg_resp); @@ -3878,7 +3876,7 @@ int rdma_block_notification_handle(QEMUFile *f, const= char *name) return 0; } =20 -int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) +int rdma_registration_start(QEMUFile *f, uint64_t flags) { if (!migrate_rdma () || migration_in_postcopy()) { return 0; @@ -3893,7 +3891,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_= t flags) =20 CHECK_ERROR_STATE(); =20 - trace_qemu_rdma_registration_start(flags); + trace_rdma_registration_start(flags); qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); qemu_fflush(f); =20 @@ -3904,7 +3902,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. */ -int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) +int rdma_registration_stop(QEMUFile *f, uint64_t flags) { QIOChannelRDMA *rioc; RDMAContext *rdma; @@ -3937,7 +3935,7 @@ int qemu_rdma_registration_stop(QEMUFile *f, uint64_t= flags) int reg_result_idx, i, nb_dest_blocks; =20 head.type =3D RDMA_CONTROL_RAM_BLOCKS_REQUEST; - trace_qemu_rdma_registration_stop_ram(); + trace_rdma_registration_stop_ram(); =20 /* * Make sure that we parallelize the pinning on both sides. @@ -3999,7 +3997,7 @@ int qemu_rdma_registration_stop(QEMUFile *f, uint64_t= flags) } } =20 - trace_qemu_rdma_registration_stop(flags); + trace_rdma_registration_stop(flags); =20 head.type =3D RDMA_CONTROL_REGISTER_FINISHED; ret =3D qemu_rdma_exchange_send(rdma, &head, NULL, NULL, NULL, NULL); diff --git a/migration/trace-events b/migration/trace-events index 002abe3a4e..3f86575f41 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -229,20 +229,6 @@ qemu_rdma_post_send_control(const char *desc) "CONTROL= : sending %s.." qemu_rdma_register_and_get_keys(uint64_t len, void *start) "Registering %"= PRIu64 " bytes @ %p" qemu_rdma_register_odp_mr(const char *name) "Try to register On-Demand Pag= ing memory region: %s" qemu_rdma_advise_mr(const char *name, uint32_t len, uint64_t addr, const c= har *res) "Try to advise block %s prefetch at %" PRIu32 "@0x%" PRIx64 ": %s" -qemu_rdma_registration_handle_compress(int64_t length, int index, int64_t = offset) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 -qemu_rdma_registration_handle_finished(void) "" -qemu_rdma_registration_handle_ram_blocks(void) "" -qemu_rdma_registration_handle_ram_blocks_loop(const char *name, uint64_t o= ffset, uint64_t length, void *local_host_addr, unsigned int src_index) "%s:= @0x%" PRIx64 "/%" PRIu64 " host:@%p src_index: %u" -qemu_rdma_registration_handle_register(int requests) "%d requests" -qemu_rdma_registration_handle_register_loop(int req, int index, uint64_t a= ddr, uint64_t chunks) "Registration request (%d): index %d, current_addr %"= PRIu64 " chunks: %" PRIu64 -qemu_rdma_registration_handle_register_rkey(int rkey) "0x%x" -qemu_rdma_registration_handle_unregister(int requests) "%d requests" -qemu_rdma_registration_handle_unregister_loop(int count, int index, uint64= _t chunk) "Unregistration request (%d): index %d, chunk %" PRIu64 -qemu_rdma_registration_handle_unregister_success(uint64_t chunk) "%" PRIu64 -qemu_rdma_registration_handle_wait(void) "" -qemu_rdma_registration_start(uint64_t flags) "%" PRIu64 -qemu_rdma_registration_stop(uint64_t flags) "%" PRIu64 -qemu_rdma_registration_stop_ram(void) "" qemu_rdma_resolve_host_trying(const char *host, const char *ip) "Trying %s= =3D> %s" qemu_rdma_signal_unregister_append(uint64_t chunk, int pos) "Appending unr= egister chunk %" PRIu64 " at position %d" qemu_rdma_signal_unregister_already(uint64_t chunk) "Unregister chunk %" P= RIu64 " already in queue" @@ -261,6 +247,20 @@ qemu_rdma_write_one_zero(uint64_t chunk, int len, int = index, int64_t offset) "En rdma_add_block(const char *block_name, int block, uint64_t addr, uint64_t = offset, uint64_t len, uint64_t end, uint64_t bits, int chunks) "Added Block= : '%s':%d, addr: %" PRIu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: = %" PRIu64 " bits %" PRIu64 " chunks %d" rdma_block_notification_handle(const char *name, int index) "%s at %d" rdma_delete_block(void *block, uint64_t addr, uint64_t offset, uint64_t le= n, uint64_t end, uint64_t bits, int chunks) "Deleted Block: %p, addr: %" PR= Iu64 ", offset: %" PRIu64 " length: %" PRIu64 " end: %" PRIu64 " bits %" PR= Iu64 " chunks %d" +rdma_registration_handle_compress(int64_t length, int index, int64_t offse= t) "Zapping zero chunk: %" PRId64 " bytes, index %d, offset %" PRId64 +rdma_registration_handle_finished(void) "" +rdma_registration_handle_ram_blocks(void) "" +rdma_registration_handle_ram_blocks_loop(const char *name, uint64_t offset= , uint64_t length, void *local_host_addr, unsigned int src_index) "%s: @0x%= " PRIx64 "/%" PRIu64 " host:@%p src_index: %u" +rdma_registration_handle_register(int requests) "%d requests" +rdma_registration_handle_register_loop(int req, int index, uint64_t addr, = uint64_t chunks) "Registration request (%d): index %d, current_addr %" PRIu= 64 " chunks: %" PRIu64 +rdma_registration_handle_register_rkey(int rkey) "0x%x" +rdma_registration_handle_unregister(int requests) "%d requests" +rdma_registration_handle_unregister_loop(int count, int index, uint64_t ch= unk) "Unregistration request (%d): index %d, chunk %" PRIu64 +rdma_registration_handle_unregister_success(uint64_t chunk) "%" PRIu64 +rdma_registration_handle_wait(void) "" +rdma_registration_start(uint64_t flags) "%" PRIu64 +rdma_registration_stop(uint64_t flags) "%" PRIu64 +rdma_registration_stop_ram(void) "" rdma_start_incoming_migration(void) "" rdma_start_incoming_migration_after_dest_init(void) "" rdma_start_incoming_migration_after_rdma_listen(void) "" --=20 2.41.0 From nobody Sun May 19 15:05:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1696423928; cv=none; d=zohomail.com; s=zohoarc; b=l2P3gwc5LxbLxu5BkbbjYyLaujfmRqGg7ooopw2anpa6GE+3ZaWp5RjaxaUy4hykaZ0ACaTfnJ2Zs/Sh2QiGjmPstGKR2ZXD6Gi+egTbHUu/fy9lAgHBqAVU8gWS8qZLuGtmrJ8Fp0b2wrBFplEnD2dmSfnalO+/veyyCr4aYt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1696423928; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=M5eb0yuI4vnTN3ZsTIkFqXV6GouG2yDxVPAgnQXw9hA=; b=C2UWQyJJ5qBznzc1VZZDtkUx1QjMRwI4ayJs/YglGfeGqZnbNRnHyNKCLYiuhskC2q7gupbQ+dNw1+kN5ObN+32TsClwtRkHukW4hnb5+reF6LYt9L2NOhDyZvn+MbiyxxOnPz4xFubC8uCYIpjsqMICP/kIhtdJOqFVsE8YbF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1696423928852239.9807718090011; Wed, 4 Oct 2023 05:52:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qo1K1-0004YO-Ou; Wed, 04 Oct 2023 08:49:49 -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 1qo1K0-0004YB-6G for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:48 -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 1qo1Jv-0006qP-Jk for qemu-devel@nongnu.org; Wed, 04 Oct 2023 08:49:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-475-t_udXBFSOG6eq9gYba68aA-1; Wed, 04 Oct 2023 08:49:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FC32101A590; Wed, 4 Oct 2023 12:49:29 +0000 (UTC) Received: from secure.mitica (unknown [10.39.194.90]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38E91C15BB8; Wed, 4 Oct 2023 12:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1696423782; 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=M5eb0yuI4vnTN3ZsTIkFqXV6GouG2yDxVPAgnQXw9hA=; b=eufpir9NDxnX38eWFvZNLQolf00if2pyyfy2Wa6Sy9v1eqp+cz44XzzcIyLeFfzT5W81EG dIXXCS0e//iV26XZe/Mgxc1ckjK75/6x9br/D5PYy60Yd5zzGmYvJrxsIYwTl+8nY/cS7k jSSmPWpdI0W3/hblljzeCyYZ9fTgbhA= X-MC-Unique: t_udXBFSOG6eq9gYba68aA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Li Zhijian , Juan Quintela , Peter Xu , Fabiano Rosas , Leonardo Bras Subject: [PATCH v2 10/10] migration/rdma: Check sooner if we are in postcopy for save_page() Date: Wed, 4 Oct 2023 14:49:13 +0200 Message-ID: <20231004124913.16360-11-quintela@redhat.com> In-Reply-To: <20231004124913.16360-1-quintela@redhat.com> References: <20231004124913.16360-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1696423929347100001 Content-Type: text/plain; charset="utf-8" Reviewed-by: Peter Xu Signed-off-by: Juan Quintela --- migration/rdma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index c73e610416..62293ab1d6 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3253,10 +3253,6 @@ static int qemu_rdma_save_page(QEMUFile *f, ram_addr= _t block_offset, RDMAContext *rdma; int ret; =20 - if (migration_in_postcopy()) { - return RAM_SAVE_CONTROL_NOT_SUPP; - } - RCU_READ_LOCK_GUARD(); rdma =3D qatomic_rcu_read(&rioc->rdmaout); =20 @@ -3327,7 +3323,7 @@ err: int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - if (!migrate_rdma()) { + if (!migrate_rdma() || migration_in_postcopy()) { return RAM_SAVE_CONTROL_NOT_SUPP; } =20 --=20 2.41.0