From nobody Sat May 11 09:32:55 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=1683634137; cv=none; d=zohomail.com; s=zohoarc; b=Don3YHWhOnly4MZ7UBREMMVzQa5kyG2un7cQtm8D5kbRnPhOJhSTIISpqigMcoxCMzm/IAR+l7XWo5btI43QiS6TFfzxmOMpDXmbdJic/smnEoNymc9xVAVFusY7MZRpLq/zh98jFQPUahhEN8HAlyp7sSeS5zxqRTFEDfZcxXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634137; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3+gFHIP3F/fIRxEqxSTM3k1zNntou4t88kY1r3SdORM=; b=Zr/fcTptldYw7Bvmr/Tuaybb4DwW25EGQMthkvFSkRs2gbRD+DHC8X5nKZX9nAuje4BHvtnLF0gTRXG9xIAA/9sbZefQoQOhxhVfVuN9n6Mh6ulfVoSNH72WaNl/FZH7MFnaSbYxqmYqlINzimNWJRi1uL6kQGgjGMEBXokPQ/0= 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 1683634137549386.00791563222424; Tue, 9 May 2023 05:08:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7a-0006Gq-H9; Tue, 09 May 2023 08:07:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwM7Y-0006GC-Ig for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:08 -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 1pwM7W-0007L9-JQ for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:08 -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-540--3HRp-fvMMW4tI0JlrDbqA-1; Tue, 09 May 2023 08:07:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B7274857ECE for ; Tue, 9 May 2023 12:07:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6BC163F86; Tue, 9 May 2023 12:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634025; 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=3+gFHIP3F/fIRxEqxSTM3k1zNntou4t88kY1r3SdORM=; b=FScU1yw8PLREFNRWEIwZEyQm0gDkHOMGtb4D79plFi8Yw8qaYxxMmGKOCueJVi7WN7Na7K B/h2jvcrAdZE5GRdzAu1gNyeKld4DnF9EmUtJ1fHxy4b8kr0BCvMTJR22FYglffpZ11por Ugk5M6g8Rn/qNes1knp8hNvSRCS9uLU= X-MC-Unique: -3HRp-fvMMW4tI0JlrDbqA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 01/10] migration: Create migrate_rdma() Date: Tue, 9 May 2023 14:06:51 +0200 Message-Id: <20230509120700.78359-2-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634138845100003 Content-Type: text/plain; charset="utf-8" Helper to say if we are doing a migration over rdma. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- Cleanup rdma_migration in migration_prepare (danp) --- migration/migration.c | 1 + migration/migration.h | 3 +++ migration/options.c | 7 +++++++ migration/options.h | 1 + migration/rdma.c | 4 +++- 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/migration/migration.c b/migration/migration.c index 0bf31068a7..cef694e3a9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1410,6 +1410,7 @@ void migrate_init(MigrationState *s) s->vm_was_running =3D false; s->iteration_initial_bytes =3D 0; s->threshold_size =3D 0; + s->rdma_migration =3D false; } =20 int migrate_add_blocker_internal(Error *reason, Error **errp) diff --git a/migration/migration.h b/migration/migration.h index 7f554455ac..22f7c8942e 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -431,6 +431,9 @@ struct MigrationState { =20 /* QEMU_VM_VMDESCRIPTION content filled for all non-iterable devices. = */ JSONWriter *vmdesc; + + /* 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.c b/migration/options.c index a024fa3ce6..22def37ec4 100644 --- a/migration/options.c +++ b/migration/options.c @@ -350,6 +350,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/options.h b/migration/options.h index 5cca3326d6..ef545edf85 100644 --- a/migration/options.h +++ b/migration/options.h @@ -61,6 +61,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/rdma.c b/migration/rdma.c index afdd359878..93a1b8b5ad 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4123,6 +4123,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 @@ -4153,7 +4154,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; @@ -4229,6 +4230,7 @@ void rdma_start_outgoing_migration(void *opaque, =20 trace_rdma_start_outgoing_migration_after_rdma_connect(); =20 + s->rdma_migration =3D true; s->to_dst_file =3D qemu_fopen_rdma(rdma, "wb"); migrate_fd_connect(s, NULL); return; --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634091; cv=none; d=zohomail.com; s=zohoarc; b=aEd3WFTIjWklPesDv10CTM1UUaE5R6/aQvGxtTctORAX4vZW9wAqt7JI/eNjWwz5R6qpHdJ0HadJgG43zI22ZBxe5liV0iiHjUMEUsrICwY10bFccUbd8C5pmtVYflHVKXv+CSgpIzNYSRoWyOx1pLpYehGCK38F3syw9d/cOHQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634091; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I5E0xL3kMgDYRotKkMDKzlI4ppNIn8Q5rpj8cg+vwoY=; b=ceyo1YBP+7EliaRzJ6Sacn7Z1nxxnqrSuu242Nv1J1mNXiHBQ/KM5rr/YOM3XdVGvEdNu+CMUdAxE7rsEuVD1kQe5mXZeo6sfy7XxMoVTPK3CPJej6npnGV7zB2w6gnJBNv3ctYA5fv4q3IgtEyvGmMw1dpecGKBD6BhpkT3BUc= 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 1683634091091394.8401932003985; Tue, 9 May 2023 05:08:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7d-0006Hi-7K; Tue, 09 May 2023 08:07:13 -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 1pwM7Z-0006GZ-UR for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:09 -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 1pwM7X-0007LF-Ev for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:09 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-3unPtbcPP3CRElNMFfKLwA-1; Tue, 09 May 2023 08:07:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C345B84AF32 for ; Tue, 9 May 2023 12:07:04 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0716363F5F; Tue, 9 May 2023 12:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634026; 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=I5E0xL3kMgDYRotKkMDKzlI4ppNIn8Q5rpj8cg+vwoY=; b=B8T+tGupvCKWyMoAMIZCgAhlnpdrtS8qNSXvln4ImAkz8JEFVlGfycJyfGtkpWxzxlhx4U MBz01hsysPJkysGzsVrpbxyPsxtIg/GMV8Lkp0QwoyrfLtXWO6WCB39zPVMVXN3lfnATCi QhT/WozsIQm1Iw+tO42iDMWEfV2eg0Q= X-MC-Unique: 3unPtbcPP3CRElNMFfKLwA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 02/10] migration/rdma: Unfold ram_control_before_iterate() Date: Tue, 9 May 2023 14:06:52 +0200 Message-Id: <20230509120700.78359-3-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634093162100006 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() Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 13 +------------ migration/qemu-file.h | 2 -- migration/ram.c | 16 +++++++++++++--- migration/rdma.c | 6 ++---- migration/rdma.h | 6 ++++++ 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 32ef5e9651..6243d6ac59 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) @@ -302,18 +303,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/qemu-file.h b/migration/qemu-file.h index ed77996201..ced2202137 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; @@ -131,7 +130,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/ram.c b/migration/ram.c index 1ab9900dda..a8acabe64c 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -58,6 +58,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "rdma.h" #include "options.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ @@ -3047,7 +3048,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)); @@ -3110,7 +3114,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; @@ -3216,7 +3223,10 @@ static int ram_save_complete(QEMUFile *f, void *opaq= ue) migration_bitmap_sync_precopy(rs); } =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 93a1b8b5ad..421a061278 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3864,13 +3864,12 @@ 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; =20 - if (migration_in_postcopy()) { + if (!migrate_rdma () || migration_in_postcopy()) { return 0; } =20 @@ -4008,7 +4007,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, }; diff --git a/migration/rdma.h b/migration/rdma.h index de2ba09dc5..901c829c8b 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -22,4 +22,10 @@ void rdma_start_outgoing_migration(void *opaque, const 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 +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +#endif #endif --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634083; cv=none; d=zohomail.com; s=zohoarc; b=BWQz11OW1onaMdF8Tj3THGcGsfDpp5JW/HHoLTxBIq53nTMTL1K4+ZIKM6rkVPzcdz2pE8OTseKvf8fSqMDAfa0rF8mnyaMN5Hrm0MRE8jmizYUKNdqoqgKzQs33ssC9gbwwbwDDWr6iie7KUrvHos0NoyuPhHRKZtsnWzITWBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634083; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WA4yk8tU42gjpMNzm0/ukyzMRA3ukynyOVE/VfTXNpM=; b=g5H/UwjKcMhehw0+TUBBpsqVwjiw+K3t037rnX5PcauK2PB2C+f2OtaGPPsL1rHaF+avgunGcas4N1AweK2b6nxzmFOmb/5KFqIotK7BljGQK1uij34wOU5F0ciEj8/XgfaA7WLpGcDOCLg/0P1h6BTDSaFECMb4x4qYNUEhmUA= 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 1683634082998859.3738777823156; Tue, 9 May 2023 05:08:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7b-0006Ha-El; Tue, 09 May 2023 08:07:11 -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 1pwM7a-0006Gc-39 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:10 -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 1pwM7Y-0007LL-6X for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:09 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-478-rrRjU1kRPOaDjO-_PixNEg-1; Tue, 09 May 2023 08:07:06 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F06413C025AC for ; Tue, 9 May 2023 12:07:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1407763F5F; Tue, 9 May 2023 12:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634027; 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=WA4yk8tU42gjpMNzm0/ukyzMRA3ukynyOVE/VfTXNpM=; b=GxJPHLmm4LaM1K27hrjQPErJXbuyjnCg9qo8YMJ8+x3DDexXytT+iOitmHIvwVN+KIq+sr 32iquxmWwzNk3EZtS3hin6vDXdUhut308038t/m3UgBaZcZBPoQYnjPs1fT2Z/Krzq01Fh Ug9z6vYXK1634ExSUk4c5KBn/RL1Hfs= X-MC-Unique: rrRjU1kRPOaDjO-_PixNEg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 03/10] migration/rdma: Unfold ram_control_after_iterate() Date: Tue, 9 May 2023 14:06:53 +0200 Message-Id: <20230509120700.78359-4-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634084396100003 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() Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 12 ------------ migration/qemu-file.h | 2 -- migration/ram.c | 17 ++++++++++++++--- migration/rdma.c | 6 ++---- migration/rdma.h | 2 ++ 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 6243d6ac59..918df83035 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -303,18 +303,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/qemu-file.h b/migration/qemu-file.h index ced2202137..323af5682f 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; @@ -130,7 +129,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/ram.c b/migration/ram.c index a8acabe64c..2b36e802c4 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3052,7 +3052,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; @@ -3174,7 +3178,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 @@ -3248,7 +3255,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 421a061278..3707230554 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3892,15 +3892,14 @@ 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)); 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 @@ -4007,7 +4006,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 diff --git a/migration/rdma.h b/migration/rdma.h index 901c829c8b..a16a8d8bc6 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -25,7 +25,9 @@ void rdma_start_incoming_migration(const char *host_port,= Error **errp); =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 int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } #endif #endif --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634132; cv=none; d=zohomail.com; s=zohoarc; b=eP/tbrthc2rbBoU4WcJT5LqlvtRnPsE/ZvIAZNfEQYyVxxrC9Ms8tEr1ht+MTe09eOzgwBICDsuIHR5qTViN8uXEMjZYsvwAp42gN2hIIXMjtWf4+WSfecz00EHYtSbd2qNaHNh3NYK1a5eiCpR7oapoxCzYP7vl+/XftthgX8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634132; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zmgif8DVfJrkv9QRWejmAQYS+0o+Z4PYLh2BsXtfm2E=; b=UHQWxmQbXbTXuvWM3As2qZIGGM7kZq7O3va/c09SUKXxi0iMghBg1YJ7xDNu+WYP2xB+PfVCXy7YsuLA4+vLM/lujfy66oWlyNOhQ1lTutGKzvDKgDdQsGlvXXTTq/13mvma60WPokyrEUcKyDFUuSPqObZhgwTdYmFl8lYFsMo= 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 1683634132127181.5886092311282; Tue, 9 May 2023 05:08:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7f-0006Id-1q; Tue, 09 May 2023 08:07:15 -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 1pwM7d-0006Hh-4B for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:13 -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 1pwM7b-0007M0-J3 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:12 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-ImD2yLOJPZ2w0EXs-RnEMQ-1; Tue, 09 May 2023 08:07:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 05CAB805F58 for ; Tue, 9 May 2023 12:07:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40E3863F84; Tue, 9 May 2023 12:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634030; 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=zmgif8DVfJrkv9QRWejmAQYS+0o+Z4PYLh2BsXtfm2E=; b=TBcE7W/nMy2UfrphVB0fzi6bOF/kdkWcpWxpRzy9kNwV/aEDvSMJT5npv7g4jkmsUOh9f9 wWq0lOpFxwe3fz84qNzuDGIDEt65kJVBtTJ3XSLjVrVU+By45VdvSLUEIdaJA7Fx0N1sUH vPFf2Y1012oNFfI1Bd4/+VC6CZy0cr4= X-MC-Unique: ImD2yLOJPZ2w0EXs-RnEMQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 04/10] migration/rdma: Remove all uses of RAM_CONTROL_HOOK Date: Tue, 9 May 2023 14:06:54 +0200 Message-Id: <20230509120700.78359-5-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634133300100003 Content-Type: text/plain; charset="utf-8" Instead of going trhough ram_control_load_hook(), call qemu_rdma_registration_handle() directly. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.h | 1 - migration/ram.c | 5 ++++- migration/rdma.c | 9 +++++---- migration/rdma.h | 2 ++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 323af5682f..7cfc20825e 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/ram.c b/migration/ram.c index 2b36e802c4..e967cc06bb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4053,7 +4053,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 3707230554..821646b4c1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3531,7 +3531,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, @@ -3558,6 +3558,10 @@ 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(); rdma =3D qatomic_rcu_read(&rioc->rdmain); =20 @@ -3855,9 +3859,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(); diff --git a/migration/rdma.h b/migration/rdma.h index a16a8d8bc6..8d0253047c 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,9 +24,11 @@ void rdma_start_incoming_migration(const char *host_port= , Error **errp); =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 +int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } #endif --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634106; cv=none; d=zohomail.com; s=zohoarc; b=U629iZWqPesni1YuIdxAPI8kY6etNaoCRi8Q9fdmv9dgTHI0v87laeJlaxM6IRKmQoorDASmQbqHAinoId9ZdsW4HGEFgimdVmS+x3iC3TJlyqvpVeHAhd5KIn8B86kczrsim2eicaH+m4sOS7m6+N0ryPBQzI01grciPdClW64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634106; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=58EpwBpa4wywvdv1HS1/44EwZZHLRgSKRzpJx3BLD5U=; b=fH9LMqZCyrssiPa7QS5hTmFGiZKLOitFLF1OGOE8ADVa/3tjgX6Ik4U1JVk/LkXQ19/beng5KXzztcbBUNUA04+PlwwspZ6lTsG5rbi1ctPjvT3X24kL5GRlEDe/kr+pAtx83a3hq8KCoDkNk/2m1caoUOajeOYH7R67KK1AZ4w= 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 16836341067331002.3365594750626; Tue, 9 May 2023 05:08:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7h-0006Je-8W; Tue, 09 May 2023 08:07:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwM7e-0006IM-NI for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:14 -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 1pwM7c-0007MK-O7 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:14 -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-664-xq9ng_isPuqvnvkZSTMLvg-1; Tue, 09 May 2023 08:07:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E42A185A7A4 for ; Tue, 9 May 2023 12:07:08 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 479F763F84; Tue, 9 May 2023 12:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634032; 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=58EpwBpa4wywvdv1HS1/44EwZZHLRgSKRzpJx3BLD5U=; b=adOcu0h9eiJcdgyI7JpeOV92PtSIt/CZ8NdqJF5gxeAnk3Tv1I2VZo4JJ4CpbXZL6YxzrV dNDX9iR06CQK4/JYGWRaxKtVz9Gr5BCnm3vi6eSnJjOxxk2zAeItN6HVRDIzHS0vV+UJxI 2lTDcwoJw5uMJpEqisWveKfzloQ74AM= X-MC-Unique: xq9ng_isPuqvnvkZSTMLvg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 05/10] migration/rdma: Unfold hook_ram_load() Date: Tue, 9 May 2023 14:06:55 +0200 Message-Id: <20230509120700.78359-6-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634107213100006 Content-Type: text/plain; charset="utf-8" There is only one flag called with: RAM_CONTROL_BLOCK_REG. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 10 ---------- migration/qemu-file.h | 11 ----------- migration/ram.c | 6 ++++-- migration/rdma.c | 29 +++++++++-------------------- migration/rdma.h | 2 ++ 5 files changed, 15 insertions(+), 43 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 918df83035..08bbc29e64 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -303,16 +303,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/qemu-file.h b/migration/qemu-file.h index 7cfc20825e..6791db6b08 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 @@ -128,8 +119,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/ram.c b/migration/ram.c index e967cc06bb..e2c0c0e314 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4004,8 +4004,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 821646b4c1..696a4bf9f5 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3812,20 +3812,22 @@ 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); =20 @@ -3853,18 +3855,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) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); @@ -4003,7 +3993,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 { diff --git a/migration/rdma.h b/migration/rdma.h index 8d0253047c..1266a90e07 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -27,9 +27,11 @@ void rdma_start_incoming_migration(const char *host_port= , Error **errp); int qemu_rdma_registration_handle(QEMUFile *f); int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); +int rdma_block_notification_handle(QEMUFile *f, const char *name); #else int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } #endif #endif --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634131; cv=none; d=zohomail.com; s=zohoarc; b=mJl2dkLs++ILLCU7DfDPD3IUdI7o8G+2cywWAyCKiWoPqnwF/kgIGYr1LcFzdk5485ZWKV0vlL9G96we1Fsqmy19VJmRmItBrEXIgFpCJeYAFubf+643UCATK7NsQhoVePiOmIE0Lveof99ONKpJydwGUb276eaODobvCTADASg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634131; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4VESAlXGQecC5+Af0HuSQ/LLzXzG2gBW7lCBZIB4unM=; b=n3x4yHZzf9M1PPEqtQKpdIPeyFjlaZHeMxbA5VS5oNwxqeIFpPoK1DU6fdIYxrKDnHfepRc/5Tpbk7kbjCa854XMR6E0tmZh/m362gt7YzfFA92Pi1NRJSVo3R9aR/kC4dG6fjfECFe0D61B7FfBSYFzbHMh8Rns3LMCObF+thc= 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 1683634131977142.71845012356084; Tue, 9 May 2023 05:08:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7e-0006IF-IY; Tue, 09 May 2023 08:07:14 -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 1pwM7d-0006Hl-5n for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:13 -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 1pwM7b-0007M2-FB for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:12 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-204-OMW8qEf3M6Wj1AzluvESOQ-1; Tue, 09 May 2023 08:07:09 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5B7743C025AC for ; Tue, 9 May 2023 12:07:09 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71D0363F5F; Tue, 9 May 2023 12:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634030; 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=4VESAlXGQecC5+Af0HuSQ/LLzXzG2gBW7lCBZIB4unM=; b=Nvwxi4KyEAfC++/2qnfXRTPNOfPSxaCwW6T5Qvi3z0I6IfndIzXQmqR+EqTk50AP9IlBw6 Cf5Zy/uayUbi2K2BFAGnazQtYBJtUy+BGIN1u243X/z6EwROJkviaWxlzPXK2ktnTwpkP6 m9cb1dbjkfENv29lvS9MdaesWvmvo3E= X-MC-Unique: OMW8qEf3M6Wj1AzluvESOQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 06/10] migration/rdma: Create rdma_control_save_page() Date: Tue, 9 May 2023 14:06:56 +0200 Message-Id: <20230509120700.78359-7-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634133289100002 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(). Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 20 -------------------- migration/qemu-file.h | 12 ------------ migration/ram.c | 4 ++-- migration/rdma.c | 20 +++++++++++++++++++- migration/rdma.h | 6 ++++++ 5 files changed, 27 insertions(+), 35 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 08bbc29e64..a222daeaab 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -303,26 +303,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/qemu-file.h b/migration/qemu-file.h index 6791db6b08..c43c410168 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); @@ -129,8 +119,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/ram.c b/migration/ram.c index e2c0c0e314..d329c36c16 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1176,8 +1176,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 696a4bf9f5..f22ba89eaf 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3319,6 +3319,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) @@ -3996,7 +4015,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 diff --git a/migration/rdma.h b/migration/rdma.h index 1266a90e07..4674dceb4a 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,10 +30,14 @@ 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 int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } +int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size) { return false;= } #endif #endif --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634157; cv=none; d=zohomail.com; s=zohoarc; b=IcCVfzBMbAKLjfCWpHlIGNJvKL3xgv4HKKrBKOOMxnBu5RJ/5vMWGP2QtqVlnARa7Vm70gMQoUMlgbplpPlAfgC1o7U/CBOI31HdOHo79y+cOVXS57fOH/fZ5s6MIYou8EvO4dpJGGYvLlbATGXpas4fhXwBIA7Io/8PwmT9zNw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634157; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yphklbZrODKzLYt4aNTVh24I2kA8pAn23MY2gx+IstU=; b=WubTBXHV24J567ALZqYmhiPXKaJSbLBVm/X/KcVdheePmAmDzcft48W34lMq6fMAISACRdqHluymZOoE4BCp538KDVtSsP2XZwa+D4Tn5k4kF5g8GtIKrZ7kyoWnxYnlo8vnkmxMf044LQ7Rg2M7CuRS6UADHlT82PB9ZYwOOvI= 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 1683634157613559.9345799117197; Tue, 9 May 2023 05:09:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7g-0006Iz-9l; Tue, 09 May 2023 08:07:16 -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 1pwM7e-0006IG-IA for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:14 -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 1pwM7c-0007MC-Fd for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:14 -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-408-syUPm1lhM020EovNSR9ByA-1; Tue, 09 May 2023 08:07:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 67A0C857ED8 for ; Tue, 9 May 2023 12:07:10 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FC3163F5F; Tue, 9 May 2023 12:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634032; 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=yphklbZrODKzLYt4aNTVh24I2kA8pAn23MY2gx+IstU=; b=YANwXXlv+jZU5p9qpGPHCcutPKlWs6+872kDUcWyjUwJBceT8gonry1loVTsq4cUmXjNxn unC3c8X9CtCgr23GHugx3jElCmn2on8FzWCEsIVddDM2ctRXUmi+EJKCQeHO/fY2crTMM2 TWhFK3PthGw1p3dlqOZPt7xDeSLiu5M= X-MC-Unique: syUPm1lhM020EovNSR9ByA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 07/10] qemu-file: Remove QEMUFileHooks Date: Tue, 9 May 2023 14:06:57 +0200 Message-Id: <20230509120700.78359-8-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634159385100006 Content-Type: text/plain; charset="utf-8" The only user was rdma, and its use is gone. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.c | 6 ------ migration/qemu-file.h | 4 ---- migration/rdma.c | 9 --------- 3 files changed, 19 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index a222daeaab..c94b667726 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 @@ -147,11 +146,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/qemu-file.h b/migration/qemu-file.h index c43c410168..c7c832d200 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/rdma.c b/migration/rdma.c index f22ba89eaf..d39dc4db29 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4011,13 +4011,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); @@ -4076,12 +4069,10 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma,= const char *mode) 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); } else { 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; --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634280; cv=none; d=zohomail.com; s=zohoarc; b=GSDsV+UjyERHH5sKmOJmF6N2/qcH0jqesmV4rTqJateUTCCVrepgbOsLA6D9RxOp+b4zqLMaKlnWr3vNJLKdBeMc8cj6V7dn7uVtKm3v8p54Il/1DDwxNRxwnLDgK9OkUz5JB6nv8QoLGbW9zGdWujcnA5R+blFC+pX/vTp+oAw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634280; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q+OYFTQDLo2hPw+W3librz25YjPdfcHejCgXDTWQyjQ=; b=UVYb3BsvIwMnRQiZxtRdYF2XNDhlrudjwyIYNM/ufIgtoXapFN9ZJL9H6Gs22ABnhvx6HTdwhdJXpS0DmIwcJfal6fXoJtiFfJg7eVEcap4tDx4fodprzOWcmYZrtvvqR2qySiH7l5YdFq2doqcqM135UcRhM9BrU9VYqrKjNZU= 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 1683634280884420.6150136675748; Tue, 9 May 2023 05:11:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwMBU-0006SH-F3; Tue, 09 May 2023 08:11:13 -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 1pwMBS-0006Rs-I8 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:11:10 -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 1pwMBN-0008LH-RW for qemu-devel@nongnu.org; Tue, 09 May 2023 08:11:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-511-su1u0oeNMciBMhsQo0RTyw-1; Tue, 09 May 2023 08:07:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 757FE3C0F67A for ; Tue, 9 May 2023 12:07:11 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC35B63F8B; Tue, 9 May 2023 12:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634264; 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=q+OYFTQDLo2hPw+W3librz25YjPdfcHejCgXDTWQyjQ=; b=KV8jNdl3/B95L0fjA4NMIx6Wbke0IaA9J9/8TaTnUJkYhy0fvAG701mCDKTtYQqYjhnaZ7 8LlojeWeAmx1a+lIV40/u6xlUyrizy3HyZEvakPqVnYBAiQae8Pm1vbPouDbOIe2VYYWUW OoYO3HTcd6tX6eYj+oSGD9NNSW5Dgcc= X-MC-Unique: su1u0oeNMciBMhsQo0RTyw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 08/10] migration/rdma: Move rdma constants from qemu-file.h to rdma.h Date: Tue, 9 May 2023 14:06:58 +0200 Message-Id: <20230509120700.78359-9-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634282624100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/qemu-file.h | 17 ----------------- migration/ram.c | 2 +- migration/rdma.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index c7c832d200..83b8fb10de 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); @@ -105,16 +98,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/ram.c b/migration/ram.c index d329c36c16..4960f5960f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -86,7 +86,7 @@ #define RAM_SAVE_FLAG_EOS 0x10 #define RAM_SAVE_FLAG_CONTINUE 0x20 #define RAM_SAVE_FLAG_XBZRLE 0x40 -/* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ +/* 0x80 is reserved in rdma.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 #define RAM_SAVE_FLAG_MULTIFD_FLUSH 0x200 /* We can't use any flag that is bigger than 0x200 */ diff --git a/migration/rdma.h b/migration/rdma.h index 4674dceb4a..9f3ace0900 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); --=20 2.40.0 From nobody Sat May 11 09:32:55 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=1683634090; cv=none; d=zohomail.com; s=zohoarc; b=k2RvfKpuoZwdeBjOhoh8jD4LPbytU1qXEka+a/ptBVb8eM8s3X89bU0kofXyfBTsYK5yzfkyeaOFtn9JirJDOur3rZ5Qr9Rjd8VYG2slM5VpwYOs9Nbff8r3wdG4LDdAnyBiMCz46ACUC+FYRU9Xk2ViauoFYJJSCWxceSU0yRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634090; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QpFOEwsLe7bx77F8zJCxXbJL9xRhv1zHxv9HFRQcgtM=; b=eYvIfzIUdpkUX5WsekNACY7uHcZogLZmNhUsmRbi2sE+Bhe7h2S/uH2zo2MKR2LQwMrzYgaB3krGrYXm2UrLiwxiUFb+uwiUg2GN2QqqYJCtzu7O6hOl0kxtBBUPOMx+ctDSGhaGxZFm74a+cEMURYf2U1BPsldMDresdWJHCw4= 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 1683634090420532.6870642818736; Tue, 9 May 2023 05:08:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7i-0006Jh-5d; Tue, 09 May 2023 08:07:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwM7g-0006JQ-V1 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:16 -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 1pwM7e-0007N6-O7 for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-526-tyADG4vgPYmkujoUh1rjwg-1; Tue, 09 May 2023 08:07:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82D273C0F675 for ; Tue, 9 May 2023 12:07:12 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB5D563F5F; Tue, 9 May 2023 12:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634034; 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=QpFOEwsLe7bx77F8zJCxXbJL9xRhv1zHxv9HFRQcgtM=; b=L71VlB1uA4I/1AJ8KZBuH68Huzc5PyABCdE3PwddBVOL+X/JIp/a6qJ1zcsFzEhUP/qOPE Sz48oLwbpX0EolYSeW1sqyBfhduXS1nEH7mUhSukZLGI2/T46Q6RP+3l+WFF9Wyi2d0RiV HtOKZLfX4jxAV5KXTySwBbwqRFb5xsM= X-MC-Unique: tyADG4vgPYmkujoUh1rjwg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 09/10] migration/rdma: Remove qemu_ prefix from exported functions Date: Tue, 9 May 2023 14:06:59 +0200 Message-Id: <20230509120700.78359-10-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634092495100003 Content-Type: text/plain; charset="utf-8" Functions are long enough even without this. Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/ram.c | 14 +++++++------- migration/rdma.c | 40 +++++++++++++++++++--------------------- migration/rdma.h | 12 ++++++------ migration/trace-events | 28 ++++++++++++++-------------- 4 files changed, 46 insertions(+), 48 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 4960f5960f..ae1c2c75be 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3048,12 +3048,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); } @@ -3118,7 +3118,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); } @@ -3178,7 +3178,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); } @@ -3230,7 +3230,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) migration_bitmap_sync_precopy(rs); } =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); } @@ -3256,7 +3256,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); } @@ -4055,7 +4055,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 d39dc4db29..c84138ef17 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3550,7 +3550,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, @@ -3592,7 +3592,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 @@ -3612,9 +3612,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, @@ -3631,11 +3631,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 @@ -3675,7 +3675,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, @@ -3697,7 +3697,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; @@ -3711,7 +3711,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) { @@ -3763,8 +3763,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); } @@ -3778,7 +3777,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 @@ -3786,7 +3785,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]); @@ -3802,8 +3801,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); @@ -3874,7 +3872,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) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; @@ -3891,7 +3889,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 @@ -3902,7 +3900,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 =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; @@ -3934,7 +3932,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. @@ -3996,7 +3994,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/rdma.h b/migration/rdma.h index 9f3ace0900..9b28736902 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -42,16 +42,16 @@ 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 -int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } -int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } -int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_registration_handle(QEMUFile *f) { return 0; } +int rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { return false;= } diff --git a/migration/trace-events b/migration/trace-events index 800cfce547..fdd448ae2f 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -224,20 +224,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" @@ -256,6 +242,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.40.0 From nobody Sat May 11 09:32:55 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=1683634104; cv=none; d=zohomail.com; s=zohoarc; b=d9bsmpMfM2m3LA60vfsYPuYsaJ6EsU/Q35kIQrEWfd4G7wxY6sIdBFmKMAAylJHOdqo/TzH1e7zX0RE7tHVlTuU1hRbZsgl3kEIokUY23diHiqepH+9qBCQ2s7sH1O6xnqbbegvC4e8UtMkBuAIrofO4PlixZXN088/pkTehwzM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683634104; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KJQEApA2GeCA1oGyUfJw3/xLKAMQTXRRSDvxrrDj4Wc=; b=fFdzRWe+yTjsBjFjRYUpaTqv7R55YopeDNAgF9R9Q+A1dB2oqLk8ljV3RNeIb546kBSds4a7Jsa2gRXceesigpbcqhYJvAsfBDPWd1MiOijvDjrhLgTy1qpqkqwgaJAX1Fcv0DECleSpmHmAfu9ZIIskfVJJsPULPLYBxeF3uyA= 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 1683634104731802.2039881818256; Tue, 9 May 2023 05:08:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pwM7i-0006KT-Se; Tue, 09 May 2023 08:07:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pwM7g-0006JR-VM for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:16 -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 1pwM7f-0007NY-Jg for qemu-devel@nongnu.org; Tue, 09 May 2023 08:07:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-142-9wzp-0LfOMut_D2ci0QFVg-1; Tue, 09 May 2023 08:07:13 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C811886461 for ; Tue, 9 May 2023 12:07:13 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id C470663F86; Tue, 9 May 2023 12:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683634035; 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=KJQEApA2GeCA1oGyUfJw3/xLKAMQTXRRSDvxrrDj4Wc=; b=PI3XQTdHuBNbTQ0Ftdyn85yIng89hFQ7fbYI246/n7nNQAR87PRI0MpVXSNxiM0PJDSLYf W6g5dEjpwht6ZepHBOcYBx7Gs8v8pVOpo3mnY1KA4pIOmU73470bqzaMsNaXbuhQN2l7x/ PeALZrmZoyl8GDycQDd9OilTZvS97nU= X-MC-Unique: 9wzp-0LfOMut_D2ci0QFVg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Leonardo Bras , Juan Quintela , Peter Xu Subject: [PATCH v3 10/10] migration/rdma: Check sooner if we are in postcopy for save_page() Date: Tue, 9 May 2023 14:07:00 +0200 Message-Id: <20230509120700.78359-11-quintela@redhat.com> In-Reply-To: <20230509120700.78359-1-quintela@redhat.com> References: <20230509120700.78359-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683634105121100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela Reviewed-by: Peter Xu --- migration/rdma.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index c84138ef17..30ee74f035 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3250,10 +3250,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 @@ -3322,7 +3318,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.40.0