From nobody Thu May 16 02:29:14 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=1683119980; cv=none; d=zohomail.com; s=zohoarc; b=WBjFTsFLyg4i2xVfiI+5zNkG6dGLLDNqj0EYKJx7B9Qnq7Y6fXiyGZcCxqwX/pKCcUC988zSQf0xI8iddHwQ+KoOwPoNXFepLw5SNoWJJblE/xvc3y4KZzt0uLaRiwLeUzCtDvJK4cx72xos+KWIuGn69QbeynYUSHku2bZTHzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683119980; 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=hsa55xZBuHFJZOxX72dTZkydmIYhYUyHSWRB1S7J1zU=; b=no2jLP0HomwgFb/tW7upvo9MhDS56mJvhtBhmRuKo7JdI1awVtD3QL9AArfVrsyEsdh+Ow40lcVH/j1rL00bE1y10ejvNzoLURv94JMkLawh/dfh9ejxSdBra+Pk31Lzb8xnq5H+zQqHZEoWbYO4KTQ/khjWNc4f/x8T51OPeDc= 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 1683119980297296.1521887831485; Wed, 3 May 2023 06:19:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCNw-0005RW-IK; Wed, 03 May 2023 09:19:09 -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 1puCNh-0005Np-Lm for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:53 -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 1puCNg-0006jJ-5l for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:53 -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-526-pEHa9mFmMcOVFqwnAhWTWA-1; Wed, 03 May 2023 09:18:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A688F1875043 for ; Wed, 3 May 2023 13:18:49 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7F2EC15BAD; Wed, 3 May 2023 13:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119931; 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=hsa55xZBuHFJZOxX72dTZkydmIYhYUyHSWRB1S7J1zU=; b=Hc7Uzxdcc0biUx3pLBumFtboQXZr5+Wn7Pi8jomIWS5LuewcnjxhLJB9hswhL4JR/uH1zh EkX6q4H2WwZwWld+1SCNTDSEwDcmyzso2aitgjQTAH15ewKx4b3f3+Tert/dEOH+emEEnK BNLKI3xm2z3ku89P8a1q9n+u5llkc5A= X-MC-Unique: pEHa9mFmMcOVFqwnAhWTWA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 01/16] migration: Create migrate_rdma() Date: Wed, 3 May 2023 15:18:32 +0200 Message-Id: <20230503131847.11603-2-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683119982398100003 Content-Type: text/plain; charset="utf-8" Helper to say if we are doing a migration over rdma. Signed-off-by: Juan Quintela --- migration/migration.h | 3 +++ migration/options.c | 7 +++++++ migration/options.h | 1 + migration/rdma.c | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/migration/migration.h b/migration/migration.h index 3a918514e7..47fe116167 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -432,6 +432,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 53b7fc5d5d..39843f9325 100644 --- a/migration/options.c +++ b/migration/options.c @@ -349,6 +349,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 3c322867cd..3c555e28c7 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 7e747b2595..b026e98519 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4119,6 +4119,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 @@ -4149,7 +4150,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; @@ -4225,6 +4226,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 Thu May 16 02:29:14 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=1683120014; cv=none; d=zohomail.com; s=zohoarc; b=jB0f6cWrIKhgNUACkTtjsnSDJI/YeYw6oWsn5/nKTWTmKZS/ic7Y7ly3rpVixCzniOoIoIzAx4vRCjMmcu3QVQwP3cCXJVzU1B6m1FKaylQDQGld7Pf7d0lrCMwMKoBmJziNwBUbFb12VmhOsy21rsFEvlmdAd4qzotAVaGNVzw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120014; 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=82GKF6jBsZ6yZicTA6C03KmhNS2Tm23Lf/xYhoERaSw=; b=eNFW2lBbQEdKjt2YgxiGtx3ZFv+aXG414dxHPEgMIVvWl7dgMXxxRj9tFbue/UkbxuNbHsevyLX4vrFTNOTYHXtZ7eINWrZonSl79/B3d7rgGNkxSelI4t/4q0GtSLOdhlhRaqrt1KIRmcyhBf7Xgz3M14ZxMJGciJGceYVyoeA= 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 1683120014934723.2289935859776; Wed, 3 May 2023 06:20:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCNv-0005QG-EA; Wed, 03 May 2023 09:19:08 -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 1puCNi-0005Nz-TI for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:55 -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 1puCNh-0006jf-7q for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:54 -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-596-PGI94O9_PJOU3fmUawc2NQ-1; Wed, 03 May 2023 09:18:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EBDAE811E7B for ; Wed, 3 May 2023 13:18:50 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC51DC15BAD; Wed, 3 May 2023 13:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119932; 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=82GKF6jBsZ6yZicTA6C03KmhNS2Tm23Lf/xYhoERaSw=; b=WpVAtH2vpZsSnQtZJ2BmvuO0G1cU8w9+/y0bkjAfYfMC9SutP1VCw9Hgbib6D+TZNV6oYH lG2o9x47x3JPfElmaQM3XIImJbphozWkdAQH2+k84xXWSy4s/R9QmDme30qCabjlKIVgxV GL4sBvyGcqpvx3GsOQtV1Z05en0RiXU= X-MC-Unique: PGI94O9_PJOU3fmUawc2NQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 02/16] migration/rdma: Unfold ram_control_before_iterate() Date: Wed, 3 May 2023 15:18:33 +0200 Message-Id: <20230503131847.11603-3-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120017125100003 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 --- migration/qemu-file.c | 13 +------------ migration/qemu-file.h | 2 -- migration/ram.c | 16 +++++++++++++--- migration/rdma.c | 8 +++++--- migration/rdma.h | 6 ++++++ 5 files changed, 25 insertions(+), 20 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index ee04240a21..b6dca23706 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -30,6 +30,7 @@ #include "qemu-file.h" #include "trace.h" #include "qapi/error.h" +#include "rdma.h" =20 #define IO_BUF_SIZE 32768 #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) @@ -314,18 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =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 d16cd50448..c898c5c537 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -56,7 +56,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *before_ram_iterate; QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; @@ -150,7 +149,6 @@ void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =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 7d81c4a39e..ce5dfc3c86 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -58,6 +58,7 @@ #include "qemu/iov.h" #include "multifd.h" #include "sysemu/runstate.h" +#include "rdma.h" #include "options.h" =20 #include "hw/boards.h" /* for machine_dump_guest_core() */ @@ -3277,7 +3278,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)); @@ -3337,7 +3341,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; @@ -3442,7 +3449,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 b026e98519..d8a194ff26 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3860,12 +3860,15 @@ static int rdma_load_hook(QEMUFile *f, uint64_t fla= gs, void *data) } } =20 -static int qemu_rdma_registration_start(QEMUFile *f, - uint64_t flags, void *data) +int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; =20 + if (!migrate_rdma()) { + return 0; + } + RCU_READ_LOCK_GUARD(); rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { @@ -4004,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 Thu May 16 02:29:14 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=1683119985; cv=none; d=zohomail.com; s=zohoarc; b=Lw4gV5Exd/hOOX7zlzMCgssG4CioeTxn9FzwbNczAmS5vFndoeUjS1OQN0fJb5A8GEBqBUgionY0OcxH2SDHXOXiC/HZRtsYVPkqJcorNAPWcFCbu1fFW7qzHvHGxtAOWqeudqoY9FmtVON4gGjJTPOYkcl4zmXumGoz0VDji6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683119985; 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=K9vR67xcAfqMAfIr7lgi1tpMr3s1sASzda0ICfYmT7o=; b=hVaCTlz7r+HCo3RWGS3xoJd5CprzOl27i0K7Im5BBN0R8cP2yQnHpueZA7TYiLmcHqf5LFgTLER7cS4Wr4Q0xMhjO2MVzrVN0vmx0C1WtG/TjCZLxIhh4ysb1klzbsm32u5JncxCrBVILFmWirt+GTKzKcXiIOGv+vSia7k96oc= 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 16831199852281004.177437398222; Wed, 3 May 2023 06:19:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO2-0005TJ-7e; Wed, 03 May 2023 09:19: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 1puCNl-0005OZ-Dr for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:58 -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 1puCNj-0006kF-Qv for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:57 -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-644-fEQ-muKvO96umbbmhQlYAg-1; Wed, 03 May 2023 09:18:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2C7AD1C0A581 for ; Wed, 3 May 2023 13:18:52 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A26EC15BAD; Wed, 3 May 2023 13:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119935; 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=K9vR67xcAfqMAfIr7lgi1tpMr3s1sASzda0ICfYmT7o=; b=cLn4/z6YpK/k/R+H8VChJ04jwPAsimzsYDfpHXod6/J79YTdM5M7DqIMKL5+T1+t/IyFYm EuUG1FbjUF5dmRZDRUAB/nL1daUBpSbmVLZXmoRyy5EHiti5hYP53yOvhai/xNKe8NTieW 6CpCPkACbdVGr6EMXXvbqg5NScmIwvQ= X-MC-Unique: fEQ-muKvO96umbbmhQlYAg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 03/16] migration/rdma: Unfold ram_control_after_iterate() Date: Wed, 3 May 2023 15:18:34 +0200 Message-Id: <20230503131847.11603-4-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683119986756100003 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 --- migration/qemu-file.c | 12 ------------ migration/qemu-file.h | 2 -- migration/ram.c | 17 ++++++++++++++--- migration/rdma.c | 8 +++++--- migration/rdma.h | 2 ++ 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index b6dca23706..22af45a5db 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,18 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =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) { int ret =3D -EINVAL; diff --git a/migration/qemu-file.h b/migration/qemu-file.h index c898c5c537..fac26d7869 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -56,7 +56,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *after_ram_iterate; QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; @@ -149,7 +148,6 @@ void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =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 ce5dfc3c86..a5109a0f77 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3282,7 +3282,11 @@ static int ram_save_setup(QEMUFile *f, void *opaque) if (ret < 0) { qemu_file_set_error(f, ret); } - ram_control_after_iterate(f, RAM_CONTROL_SETUP); + + ret =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; @@ -3401,7 +3405,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 @@ -3474,7 +3481,11 @@ static int ram_save_complete(QEMUFile *f, void *opaq= ue) qemu_mutex_unlock(&rs->bitmap_mutex); =20 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 d8a194ff26..ca893c0bba 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3892,14 +3892,17 @@ 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 (!migrate_rdma()) { + return 0; + } + RCU_READ_LOCK_GUARD(); rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { @@ -4007,7 +4010,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 Thu May 16 02:29:14 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=1683120246; cv=none; d=zohomail.com; s=zohoarc; b=VJP2geInx0y8wPB7cs9pgT1IXfLbZhDQI4JpfZfDK2BewPvitSl/ER523lXepFDlC6TPG8WkuMbVxtk5Zha/zKULScsk8KhY5IQSMWh9PrPKYLN6o169mPf36TyDKSXSpNjbaVKmCqhUGpC4xnmPezfeDe2eH64yFnFQhbHAsYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120246; 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=m5swpW0JMkzO+gt4Ban4GFGxcDH5gnLYFyk8V6a4n0M=; b=Ew2bcveTlulDku/WDGuGcX0Via85+w4SmCY2R4YscFtqxLo2YRUWJrRdc7dugRscKv5eQI965S/9Ml8019SZZsEe/gEC8kd2yZXNQ4FEhc/24zgpbXTmgE1XKkIzbO8RfYcW5RWW3CekoA2cmeTrADLmwiMJhtJajTEqNz+0Nig= 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 1683120246707816.2804573032957; Wed, 3 May 2023 06:24:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCOA-0005XU-6R; Wed, 03 May 2023 09:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNl-0005Od-Up for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:59 -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 1puCNk-0006kN-Iv for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:57 -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-361-cEU3vvlTN3SzAbq1JViU4A-1; Wed, 03 May 2023 09:18:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 40488185A7A4 for ; Wed, 3 May 2023 13:18:53 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72B20C15BAD; Wed, 3 May 2023 13:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119935; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m5swpW0JMkzO+gt4Ban4GFGxcDH5gnLYFyk8V6a4n0M=; b=Nx7OQpKiUIkNyvHtzZyzsU/JxzO5NE2zmIqnD2Z3oGdrYBBFGwdZ4bAmarMf5T/bI9Oyx1 FCYZd/T/tXesYZ49q6K3xM4grCUAoiOLjEg1o/JmMx2POPQp41cS018UgGRqP7XBCxBBMJ fBGHyk01FKovB9K3s+tZcP+uqyCQ4h0= X-MC-Unique: cEU3vvlTN3SzAbq1JViU4A-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 04/16] migration/rdma: simplify ram_control_load_hook() Date: Wed, 3 May 2023 15:18:35 +0200 Message-Id: <20230503131847.11603-5-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120247727100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/qemu-file.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 22af45a5db..9b5e14a2ef 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -317,10 +317,8 @@ void qemu_fflush(QEMUFile *f) =20 void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data) { - int ret =3D -EINVAL; - if (f->hooks && f->hooks->hook_ram_load) { - ret =3D f->hooks->hook_ram_load(f, flags, data); + int ret =3D f->hooks->hook_ram_load(f, flags, data); if (ret < 0) { qemu_file_set_error(f, ret); } @@ -330,7 +328,7 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags,= void *data) * that expects there to be a hook on the destination. */ if (flags =3D=3D RAM_CONTROL_HOOK) { - qemu_file_set_error(f, ret); + qemu_file_set_error(f, -EINVAL); } } } --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120257; cv=none; d=zohomail.com; s=zohoarc; b=G87b+o3nc4kYyavjQ9a8CqXSWkRI2W93K7xsszlmwdgvZrpc0A60fJh2oD7GLZPgyTz3hNHXGRadRxQ7hnonmfZbY0ovMQIiNxwkKLIimxJVVcRDNZ4zkpZ6m5TI4CdEDEf58zNj1fiEWaHgReQQNxxlLQWUCfWu/E9jL8oVjCo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120257; 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=wvMTiBc2jAaZuVGmbvUGpHEktK0wTAnyI+OEe8qr5ro=; b=jK9MlJhm3zbnzcxBoEEZv2oURYUno7xNqR6//4vBPCjbzfLBxtsDEyfdohi1wDuuHm0vgEBbWD/gvBMGcw49NNjCozghDvgpsAwe3M9GdX8/rvLnE1ACb65JYo5/M6FUzyDvZfeER29lvOzneY7CczK3ysvdQ1NLro84JxgtQu0= 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 1683120257493761.9085730327612; Wed, 3 May 2023 06:24:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCOA-0005XM-1O; Wed, 03 May 2023 09:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNm-0005Oe-Mx for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:59 -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 1puCNk-0006kR-Pt for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:58 -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-417-zFrq67pgOpS5zP1dgDtjYQ-1; Wed, 03 May 2023 09:18:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 514111C0A586 for ; Wed, 3 May 2023 13:18:54 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 881EAC15BAD; Wed, 3 May 2023 13:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119936; 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=wvMTiBc2jAaZuVGmbvUGpHEktK0wTAnyI+OEe8qr5ro=; b=aRXY8Kdm5rNkBNZ5d5cXP3voq1R/G+4hDcVrer/LRAwF3oK+/GtZiDWzCK+TzsYLGd+5Jm arJZ5AtfJqY2aCjcTjgT9oKVNrZZeMsDikLjk+UQjjZKl4Wh5S6a8pNOYHGsPZ4S1n1xj8 GlITzXm89Jbbmim9Dmv4vhEMcX6RKdA= X-MC-Unique: zFrq67pgOpS5zP1dgDtjYQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 05/16] migration/rdma: Don't pass the QIOChannelRDMA as an opaque Date: Wed, 3 May 2023 15:18:36 +0200 Message-Id: <20230503131847.11603-6-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120259608100001 Content-Type: text/plain; charset="utf-8" We can calculate it from the QEMUFile like the caller. Signed-off-by: Juan Quintela Reviewed-by: Daniel P. Berrang=C3=A9 --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index ca893c0bba..c37fcab88a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3527,7 +3527,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, void *opaque) +static int qemu_rdma_registration_handle(QEMUFile *f) { RDMAControlHeader reg_resp =3D { .len =3D sizeof(RDMARegisterResult), .type =3D RDMA_CONTROL_REGISTER_RESULT, @@ -3539,7 +3539,7 @@ static int qemu_rdma_registration_handle(QEMUFile *f,= void *opaque) }; RDMAControlHeader blocks =3D { .type =3D RDMA_CONTROL_RAM_BLOCKS_RESUL= T, .repeat =3D 1 }; - QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(opaque); + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); RDMAContext *rdma; RDMALocalBlocks *local; RDMAControlHeader head; @@ -3852,7 +3852,7 @@ static int rdma_load_hook(QEMUFile *f, uint64_t flags= , void *data) return rdma_block_notification_handle(rioc, data); =20 case RAM_CONTROL_HOOK: - return qemu_rdma_registration_handle(f, rioc); + return qemu_rdma_registration_handle(f); =20 default: /* Shouldn't be called with any other values */ --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120081; cv=none; d=zohomail.com; s=zohoarc; b=CQg9RJ7Zzys31A/+a2iVM1+hBr0keqJuwKAWuvqE/bx3LK59qEOehF+l/ZZP833+WtNkOoc4nNmEAwI0aH9O+KFvEo7dqAbhF/IWA0SNLG+/tLmEpWP1s56wjtUwx/PmQvEzOcrOofFFFUNiS+7eKvIPYvUjyS5NuI4UAuGZe28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120081; 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=LWBjviquZpV8hMsrV70Qkw8h1FWxcXgFqGwQsinTDv4=; b=g82EmPFYBe5BNtnHrOG77Peka50YeIfqa9zzFVOsED+z7rs6ObSZ1eDs5WErOBeHYGE9uQ6XNRBTvvB5Bq2P1DiEOR7zzTYe8tnNfCE6jW6b0mO+JMULzX6aWisMjNI1hKZrisFL7h9SpLyrwQnLWksK9gge0vIJiFTixc/aDR0= 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 1683120081360795.3254388904525; Wed, 3 May 2023 06:21:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO4-0005TY-Ob; Wed, 03 May 2023 09:19: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 1puCNn-0005P3-6p for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:59 -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 1puCNl-0006ke-Rp for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:58 -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-82-YnUbHhf4NPWE9wuKPR5zdQ-1; Wed, 03 May 2023 09:18:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79D5C3806707 for ; Wed, 3 May 2023 13:18:55 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E208C15BAD; Wed, 3 May 2023 13:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119937; 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=LWBjviquZpV8hMsrV70Qkw8h1FWxcXgFqGwQsinTDv4=; b=aynCFw0elz8DDLIzcHqDse5nvVqIToVJdu7qpc95wTFKF9ZmRRkw5tHTjjwCDmaRDKzgQh Fen0yD6asCo5IDhqPZcjZ/IehTud4ed/rGO6ll/GUg+rvfXNQgRL+ji4X0d2cLUFLxPm8K 9YehGjkHtQp0qlaMt34cAV8576IomGU= X-MC-Unique: YnUbHhf4NPWE9wuKPR5zdQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 06/16] migration/rdma: We can calculate the rioc from the QEMUFile Date: Wed, 3 May 2023 15:18:37 +0200 Message-Id: <20230503131847.11603-7-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120082261100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index c37fcab88a..11815d1c11 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3811,9 +3811,10 @@ out: * the source. */ static int -rdma_block_notification_handle(QIOChannelRDMA *rioc, const char *name) +rdma_block_notification_handle(QEMUFile *f, const char *name) { RDMAContext *rdma; + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); int curr; int found =3D -1; =20 @@ -3846,10 +3847,9 @@ rdma_block_notification_handle(QIOChannelRDMA *rioc,= const char *name) =20 static int rdma_load_hook(QEMUFile *f, uint64_t flags, void *data) { - QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(qemu_file_get_ioc(f)); switch (flags) { case RAM_CONTROL_BLOCK_REG: - return rdma_block_notification_handle(rioc, data); + return rdma_block_notification_handle(f, data); =20 case RAM_CONTROL_HOOK: return qemu_rdma_registration_handle(f); --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120236; cv=none; d=zohomail.com; s=zohoarc; b=W18d256OvuDz6Op22ug+ki6ozQ7HxHGSpjHOahX7TYJpciIFsEgaApBImuQ9TTYXW7mHPPHyzpKaFHsBJI2zRSOFJ637DqX5G2m0s48XbQJoHmChHoeAvyoMmynAlKmiIB2VoZF7JS5aVteG7HtFQD6hoIYKQQwbb3MEsAgcbNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120236; 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=Y1iUzXgl7Kpiayyw0jRzYGaGGHnXFr89XRU4iycxopk=; b=itQKqvVpKCDnc3XDzOIcuU2lwEGMUviAtv39ERRmNz+UTlo1iU02aPnR3bOGEaM6R/xpXxz8u8adzN0TvxSAJXbnijqwbgfmvsuA1VHGX6UlO6ZCbaojcbGqVnrwy1mElpxU8XZaR9yeyW8S4xUFRUewZzZghtTGf34vVXha87s= 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 1683120236779891.0455056166306; Wed, 3 May 2023 06:23:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO4-0005TL-47; Wed, 03 May 2023 09:19: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 1puCNo-0005P6-2z for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:01 -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 1puCNm-0006kn-N6 for qemu-devel@nongnu.org; Wed, 03 May 2023 09:18:59 -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-130-b_tAtNXWMqOEhPEi_Wea8w-1; Wed, 03 May 2023 09:18:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 866411C0A584 for ; Wed, 3 May 2023 13:18:56 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDBF2C15BAD; Wed, 3 May 2023 13:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y1iUzXgl7Kpiayyw0jRzYGaGGHnXFr89XRU4iycxopk=; b=TUktmXx9lqHLotAaGJxu5glRcOAcCoKm/1EXWSIO+utF6FAqv+VTWES+gPydJLE2jlHOco 6Gvh1CatxcyDw/v5FNTnTitaaoyJHBISGFdezi+9hbQL4UpkHl3/kX/UaeLTJJszcptjYR clKdNBiQ/VuRo7FsRA6kmL1bxM/Hdoc= X-MC-Unique: b_tAtNXWMqOEhPEi_Wea8w-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 07/16] migration/rdma: It makes no sense to recive that flag without RDMA Date: Wed, 3 May 2023 15:18:38 +0200 Message-Id: <20230503131847.11603-8-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120237486100001 Content-Type: text/plain; charset="utf-8" This could only happen if the source send RAM_SAVE_FLAG_HOOK (i.e. rdma) and destination don't have CONFIG_RDMA. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9b5e14a2ef..014db96984 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -322,14 +322,6 @@ void ram_control_load_hook(QEMUFile *f, uint64_t flags= , void *data) if (ret < 0) { qemu_file_set_error(f, ret); } - } else { - /* - * Hook is a hook specifically requested by the source sending a f= lag - * that expects there to be a hook on the destination. - */ - if (flags =3D=3D RAM_CONTROL_HOOK) { - qemu_file_set_error(f, -EINVAL); - } } } =20 --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120082; cv=none; d=zohomail.com; s=zohoarc; b=IqUnuBB7zQVsRdS0+lhjCTEfglv8wGmF2K0aVL/rvwIG2m00QxWOyOQd5Wb+fvhnaYS9/DN9nmcpls8wXUPdWdQ2KeZ0Z1UxKmsOwdCs2OW4cc7exULENVsY53uUnEoMupTupjv2sGG1+9afoJZelX9QmzTiYdK84pSaFTDxOoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120082; 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=vFVSz2sLMTWKc6+hkxmZlMqk9lYsjx+Z706drG9kI7I=; b=gvL6FULCU6Us18CBk82UU81kPIZ2uOzDj1k6Uhx25H5i4RdgNKpPR+O+1XUs5og3FJQ486J03vc3PAqnXK3Fe383lpsbme+h9gkxHEfWevTbZaAgQFSaWnlvlMrD629nNZdC9MgzFq2n6U6y4vLi9vG9KcVev0UAF92vlBGysCU= 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 1683120082320615.6587398451106; Wed, 3 May 2023 06:21:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO5-0005Th-A2; Wed, 03 May 2023 09:19: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 1puCNp-0005P7-4q for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:01 -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 1puCNn-0006l4-NN for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:00 -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-41-jf-jaid7Nmm4oHcDdEcJGQ-1; Wed, 03 May 2023 09:18:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91767109DCE5 for ; Wed, 3 May 2023 13:18:57 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9EE0C15BAE; Wed, 3 May 2023 13:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119939; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vFVSz2sLMTWKc6+hkxmZlMqk9lYsjx+Z706drG9kI7I=; b=OtzYBPZGUlDpjMhmfcTOvLiCO0oOBepPGOOMp4yDVla5WrrEy0Hd1yhplBUh5tDOyU4X05 /LPbkj5hbyxkA7Pn9DMWSNgZ/a1P09n5/40Ue1C1fSbxx1pMO81GbXguL5jN1D+xFzfg3p P0mh+0Bj2F12LCwRr9ALx+IvmU+dy18= X-MC-Unique: jf-jaid7Nmm4oHcDdEcJGQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 08/16] migration: Make RAM_SAVE_FLAG_HOOK a normal case entry Date: Wed, 3 May 2023 15:18:39 +0200 Message-Id: <20230503131847.11603-9-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120084269100007 Content-Type: text/plain; charset="utf-8" Fixes this commit, clearly a bad merge after a rebase or similar, it should have been its own case since that point. commit 5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7 Author: Peter Lieven Date: Tue Jun 24 11:32:36 2014 +0200 migration: catch unknown flag combinations in ram_load Signed-off-by: Juan Quintela --- migration/ram.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index a5109a0f77..67ba2d7f7e 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4466,14 +4466,12 @@ static int ram_load_precopy(QEMUFile *f) multifd_recv_sync_main(); } break; + case RAM_SAVE_FLAG_HOOK: + ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); + break; default: - if (flags & RAM_SAVE_FLAG_HOOK) { - ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); - } else { - error_report("Unknown combination of migration flags: 0x%x= ", - flags); - ret =3D -EINVAL; - } + error_report("Unknown combination of migration flags: 0x%x", f= lags); + ret =3D -EINVAL; } if (!ret) { ret =3D qemu_file_get_error(f); --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120058; cv=none; d=zohomail.com; s=zohoarc; b=UZxMO+c5irZUNtOXovlU1W5kGGNg44t4TYleFKc5KbrxtOyuTQ7O+vS5P+vSANgCvdTdIysBN8uliBgR9IVHdCcwW2Uo2RznIL6KRFJR0rkqregJF5lOW2BFRVL7w/h3s2rCl+F73KQD08LYQdvfptdMtqKopqNAEqDHn/z2VJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120058; 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=slmpBi/ajrQJwvyTgGB3cSFhRnyJJz2E2j4SHH6C/M0=; b=mJVKEtOioXnipohJEHf3eKw6dV0WEcLGvBYP1hLWfrEUqjtp+HXaK8glzu3MVAXHa2V9gVfAtd/+JXvUAT4FxnuleCXn71h2bwjFUvlALFDw97fonqPKwpNqPm7MdBN9iURMfHs2o/gY7P83umRa58Vk8Ef5f89nwymL68KGU24= 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 1683120058858197.4869144115977; Wed, 3 May 2023 06:20:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO4-0005TX-Kj; Wed, 03 May 2023 09:19: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 1puCNr-0005Pt-Mw for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:06 -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 1puCNo-0006lE-Pp for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:02 -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-577-Fi2rxVVBPrCQPApfIZ6tKg-1; Wed, 03 May 2023 09:18:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A03183C10EC5 for ; Wed, 3 May 2023 13:18:58 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3DC1C15BAD; Wed, 3 May 2023 13:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119940; 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=slmpBi/ajrQJwvyTgGB3cSFhRnyJJz2E2j4SHH6C/M0=; b=YrrRsy9y2sJmzGopAM3OIRHL0E7RcBvC5JMQ9J0UjBJa3/L59owTqfuKYI4mCC72znlYhl IMD9LXBai2XSuVpOn6ZXMePL8fCQFCj7Kaw5IGWHKKqYTIHwc8JU2SchjKvqYjoclw7Y/W z/Zqn4GhTqSU8iir68iuk2dVtoorEBs= X-MC-Unique: Fi2rxVVBPrCQPApfIZ6tKg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 09/16] migration/rdma: Remove all uses of RAM_CONTROL_HOOK Date: Wed, 3 May 2023 15:18:40 +0200 Message-Id: <20230503131847.11603-10-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120059360100001 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 --- 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 fac26d7869..7623e3c475 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -41,7 +41,6 @@ typedef int (QEMURamHookFunc)(QEMUFile *f, uint64_t flags= , void *data); */ #define RAM_CONTROL_SETUP 0 #define RAM_CONTROL_ROUND 1 -#define RAM_CONTROL_HOOK 2 #define RAM_CONTROL_FINISH 3 #define RAM_CONTROL_BLOCK_REG 4 =20 diff --git a/migration/ram.c b/migration/ram.c index 67ba2d7f7e..c0110ca8cb 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4467,7 +4467,10 @@ static int ram_load_precopy(QEMUFile *f) } break; case RAM_SAVE_FLAG_HOOK: - ram_control_load_hook(f, RAM_CONTROL_HOOK, NULL); + ret =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 11815d1c11..e0f41a9b97 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3527,7 +3527,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, @@ -3554,6 +3554,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 @@ -3851,9 +3855,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 Thu May 16 02:29:14 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=1683120226; cv=none; d=zohomail.com; s=zohoarc; b=R9Z6AswljKAB0Yc+iDg6epz8xmK9FAS2BmXFHwVK+bvExH5vIu110pkVp/TzszketOJNvZVvDdHiSFiIUHHKeKIZ5Hj+aMRyqHFaToVfZjcMSjGGpLM6BqWVZOgvNnaL/RVQfkMg8g5lqZiUj8cDyY6pe4GlwroxUSmA1FTGG8I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120226; 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=AoMBupkDnax3XOyyrhIpeOXx1zgE7ZIh5OIZIiLCckc=; b=c+wBQVJk0VJWRvC6aM/mUbzBrzvIqI4Jo1ObbdiPFo3vka4xg6as14h0SmHQkMcllBuC/uW/3vez3OKKczqwRQdOv/ps774pXtNQtyrRWUjuV1nwBmdVa9Oucbnp7S4I2gBZmttT0lTWQr33TdAVGnZeGV4TndIzjvTtEoiCFgA= 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 1683120226375616.1417498006591; Wed, 3 May 2023 06:23:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO6-0005UX-2g; Wed, 03 May 2023 09:19: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 1puCNu-0005QF-6u for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNr-0006lO-Eo for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:04 -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-621-GEPqJt-XOIuGSgjXZZGGMw-1; Wed, 03 May 2023 09:19:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E732829AA388 for ; Wed, 3 May 2023 13:18:59 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id F29A7C15BAD; Wed, 3 May 2023 13:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119942; 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=AoMBupkDnax3XOyyrhIpeOXx1zgE7ZIh5OIZIiLCckc=; b=N4Vt78dpKw+auqkXx0sa2u1BT4bWyPozqQLNguKM/w/G7diFLjYHZPti0lDDfO2umHeBYc ch9A108fYALuxkUg5Bzk66WHM7BDBX8FiGMb5lgRIfxY3NdSmlqCVdmTZ6NxuHfNyO2Uu6 MJdpIavD1+fee0FKtmu5CcX4IzK0OSI= X-MC-Unique: GEPqJt-XOIuGSgjXZZGGMw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 10/16] migration/rdma: Unfold hook_ram_load() Date: Wed, 3 May 2023 15:18:41 +0200 Message-Id: <20230503131847.11603-11-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120227355100001 Content-Type: text/plain; charset="utf-8" There is only one flag called with: RAM_CONTROL_BLOCK_REG. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 10 ---------- migration/qemu-file.h | 11 ----------- migration/ram.c | 6 ++++-- migration/rdma.c | 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 014db96984..9d86900efe 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,16 +315,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); - } - } -} - size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 7623e3c475..d69f5d65e8 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,20 +29,12 @@ #include "exec/cpu-common.h" #include "io/channel.h" =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 @@ -55,7 +47,6 @@ typedef size_t (QEMURamSaveFunc)(QEMUFile *f, uint64_t *bytes_sent); =20 typedef struct QEMUFileHooks { - QEMURamHookFunc *hook_ram_load; QEMURamSaveFunc *save_page; } QEMUFileHooks; =20 @@ -147,8 +138,6 @@ void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =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 c0110ca8cb..d29dd67d5f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -4418,8 +4418,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 e0f41a9b97..a326606fd2 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3808,20 +3808,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 @@ -3849,18 +3851,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)); @@ -4007,7 +3997,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 Thu May 16 02:29:14 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=1683120088; cv=none; d=zohomail.com; s=zohoarc; b=IH15njIT0Ebwd3/zQ5Ge+DcXnw6KUdjKxYJ4qvqyKcDEE0FkrvgUoTCpxX2PKPU5Kcf4BWv0HldQwFI6ub3PKtUNLVFn90rQQJ7ERVbVtVLCWR63xwIe0H8hVbwajeAhLKbsUeFRP80qwYi9s/ajZPzJYDma3ekZn6y9kv+gdXk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120088; 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=6yMHYrA9NrI4BEISNh357klwmig/KwcB8MVZWi34Mqk=; b=gTN6EqVnX/A4PObJ8gLwi+HC3QJ9c/nbRwR/avD51cLmuDy4m+j6f0Lb97V+qZs1BZtj5VCUpLWFnbksi7DrLe2VsVRHpd22MERkyiGzpudMFXP8VRILOCdC/z8VkksZFnL4PqZub+kbRyWl7kQdOObi8rg3gP12p4VDEaWzzcY= 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 168312008841690.8631151932251; Wed, 3 May 2023 06:21:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO6-0005Ul-O1; Wed, 03 May 2023 09:19: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 1puCNw-0005RA-4e for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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 1puCNu-0006li-Lj for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:07 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-256-93IkJGAOMDiGhOsGggvvTA-1; Wed, 03 May 2023 09:19:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1BE5858F0E for ; Wed, 3 May 2023 13:19:01 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 352A3C15BAD; Wed, 3 May 2023 13:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119945; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6yMHYrA9NrI4BEISNh357klwmig/KwcB8MVZWi34Mqk=; b=KDpOZ/3f7oGrW9p9XZmV0ZTyFZvbjpLPATrzQvmD/7W7MFEfYfKluAmdh36yDfFQf/Rqc/ VcJGOwQCL8U0i4XECCLBmO4SJWWjw4rc36S3FuEeQV6b+wdE+nbtWy4OJ7Jl4XNPluq0ug NwwE2/KmIc6h9rz3lc5Vd1gKokLt3z4= X-MC-Unique: 93IkJGAOMDiGhOsGggvvTA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 11/16] migration/rdma: Make ram_control_save_page() use exported interfaces Date: Wed, 3 May 2023 15:18:42 +0200 Message-Id: <20230503131847.11603-12-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120090313100007 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/qemu-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 9d86900efe..17b3c2ea21 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -323,7 +323,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t bl= ock_offset, int ret =3D f->hooks->save_page(f, block_offset, offset, size, bytes_sent); if (ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - f->rate_limit_used +=3D size; + qemu_file_acct_rate_limit(f, size); } =20 if (ret !=3D RAM_SAVE_CONTROL_DELAYED && --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683119988; cv=none; d=zohomail.com; s=zohoarc; b=VNz+bYGQvhhJDTHGzFthHNxX7jpJDViYLV5UpjHpHX0vdUvTNXVhOTuU9pB/0YfAre6a/kr/j+vemDgL7dDZVGqJZ5GM3tbZkhrjJ8GZkSEqdAInZbxAiK+T3uT4wqkaBQe901RCrSZ7ejQWysp+bmDacIR0rdjyKohjKX56yBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683119988; 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=3vmUvMwbzVwaIcEEddXBsKdk54fXvMPMBkckFGrC8bM=; b=YE6EDkQAX88bkxmrsicmF79gGgLY0GGASJ/KbdTRtcW03xEHa0VL6aza08S63j/4xaWYqDuhkluBxOQyCu0qORueKHKQnZp5AlAlkFKijborwMaGxHbGnsw5j6mmewIz4FYPqI7bOybbQ1uJDrPtYoIEs7jHOKmpW4ZoNrOknOY= 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 16831199880021019.0024414352773; Wed, 3 May 2023 06:19:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO9-0005WO-Dg; Wed, 03 May 2023 09:19:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNx-0005S3-Iv for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNv-0006ld-EI for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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-613-x_VWcflHO9STLiWlb-vuHA-1; Wed, 03 May 2023 09:19:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2978811E7D for ; Wed, 3 May 2023 13:19:02 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id E4678C15BAD; Wed, 3 May 2023 13:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119944; 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=3vmUvMwbzVwaIcEEddXBsKdk54fXvMPMBkckFGrC8bM=; b=MgUiBcAB7uMOPdH+pm402+jYj3pqO5jkrDZj24bKXfQu5Fs8XsQfff4UnndBmlvMOJpNs9 PG9iSIXsAnp/Od36RdETd1yg+FJKEmWoIFa3i7Q12xGwBTknNPpTKlJOz9+G127nUEC+1t jHHnexfcNEv9UQPeB6aVqYjNxuI1+U4= X-MC-Unique: x_VWcflHO9STLiWlb-vuHA-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 12/16] migration/rdma: Create rdma_control_save_page() Date: Wed, 3 May 2023 15:18:43 +0200 Message-Id: <20230503131847.11603-13-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683119988696100005 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 --- migration/qemu-file.c | 26 -------------------------- migration/qemu-file.h | 14 -------------- migration/ram.c | 4 ++-- migration/rdma.c | 26 +++++++++++++++++++++++++- migration/rdma.h | 8 ++++++++ 5 files changed, 35 insertions(+), 43 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 17b3c2ea21..8d3f33fe41 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -315,32 +315,6 @@ void qemu_fflush(QEMUFile *f) f->iovcnt =3D 0; } =20 -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent) -{ - if (f->hooks && f->hooks->save_page) { - int ret =3D f->hooks->save_page(f, block_offset, - offset, size, bytes_sent); - if (ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - qemu_file_acct_rate_limit(f, size); - } - - if (ret !=3D RAM_SAVE_CONTROL_DELAYED && - ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { - if (bytes_sent && *bytes_sent > 0) { - qemu_file_credit_transfer(f, *bytes_sent); - } else if (ret < 0) { - qemu_file_set_error(f, ret); - } - } - - return ret; - } - - return RAM_SAVE_CONTROL_NOT_SUPP; -} - /* * Attempt to fill the buffer from the underlying file * Returns the number of bytes read, or negative value for an error. diff --git a/migration/qemu-file.h b/migration/qemu-file.h index d69f5d65e8..ae3a704772 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -36,18 +36,7 @@ #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 =20 -/* - * This function allows override of where the RAM page - * is saved (such as RDMA, for example.) - */ -typedef size_t (QEMURamSaveFunc)(QEMUFile *f, - ram_addr_t block_offset, - ram_addr_t offset, - size_t size, - uint64_t *bytes_sent); - typedef struct QEMUFileHooks { - QEMURamSaveFunc *save_page; } QEMUFileHooks; =20 QEMUFile *qemu_file_new_input(QIOChannel *ioc); @@ -148,9 +137,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 -size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, - ram_addr_t offset, size_t size, - uint64_t *bytes_sent); QIOChannel *qemu_file_get_ioc(QEMUFile *file); =20 #endif diff --git a/migration/ram.c b/migration/ram.c index d29dd67d5f..a085ce8cae 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1342,8 +1342,8 @@ static bool control_save_page(PageSearchStatus *pss, = RAMBlock *block, int ret; =20 *pages =3D -1; - ret =3D ram_control_save_page(pss->pss_channel, block->offset, offset, - TARGET_PAGE_SIZE, &bytes_xmit); + ret =3D rdma_control_save_page(pss->pss_channel, block->offset, offset, + TARGET_PAGE_SIZE, &bytes_xmit); if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { return false; } diff --git a/migration/rdma.c b/migration/rdma.c index a326606fd2..c984a2840a 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3315,6 +3315,31 @@ err: return ret; } =20 +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent) +{ + if (!migrate_rdma()) { + return RAM_SAVE_CONTROL_NOT_SUPP; + } + + int ret =3D qemu_rdma_save_page(f, block_offset, offset, size, bytes_s= ent); + if (ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { + qemu_file_acct_rate_limit(f, size); + } + + if (ret !=3D RAM_SAVE_CONTROL_DELAYED && + ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { + if (bytes_sent && *bytes_sent > 0) { + qemu_file_credit_transfer(f, *bytes_sent); + } else if (ret < 0) { + qemu_file_set_error(f, ret); + } + } + return ret; +} + + static void rdma_accept_incoming_migration(void *opaque); =20 static void rdma_cm_poll_handler(void *opaque) @@ -4000,7 +4025,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..ed3650ef67 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,16 @@ int qemu_rdma_registration_handle(QEMUFile *f); int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags); int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags); int rdma_block_notification_handle(QEMUFile *f, const char *name); +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent); #else int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } int rdma_block_notification_handle(QEMUFile *f, const char *name) { return= 0; } +size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, + ram_addr_t offset, size_t size, + uint64_t *bytes_sent) { return false; } #endif #endif --=20 2.40.0 From nobody Thu May 16 02:29:14 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=1683120074; cv=none; d=zohomail.com; s=zohoarc; b=g+bHzgymq9Fz5l7wS3u5iX5jDErlsHaxb7DQ6K3wN/ryM3/H107Ff20dKMykk3UEO8w2HPbALvU4JeXQiU09/EjGUUH4+XPFvtB8Ks1Tze85WvadWtHU9yZc2PKGks8ugXfVZL22PFd0Djev/3uLj5A224aTk3c2LPIUbIzn03U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120074; 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=Fl0epjSKhpGNi8MqyrXiQY+3YRvXKVYBVvQbsVkLOFM=; b=Z9R8ghTFAYKZlN3SoNc6vwaARi0r6mFut8/cG76lbL2uXzhdjifhvfpil0sIjEDmJY6QwMB9ogHli6GFcfAEnfF3DXce12wWqpvTptwt6ycUN/WO2AXbKcAEWBwf5kqb5gmkxXpbUHuNmS5GDMsITPCZLK3hSmtGHcKiomdf8ec= 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 1683120074068235.04909679471712; Wed, 3 May 2023 06:21:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO5-0005Tj-Cn; Wed, 03 May 2023 09:19: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 1puCNw-0005Rj-Q5 for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNv-0006lj-8i for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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-201-qrQoGzl7PfycX2b7a1Dtqw-1; Wed, 03 May 2023 09:19:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F03A4A0F3A3 for ; Wed, 3 May 2023 13:19:03 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34D8FC15BAD; Wed, 3 May 2023 13:19:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119945; 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=Fl0epjSKhpGNi8MqyrXiQY+3YRvXKVYBVvQbsVkLOFM=; b=DdWer+KclzUkNLG97vKMErvm8ISD18YRIzq3zrV5Wg5KheJUNEeHdzgn2q52ocIbFXc3Vq hRlpT2OoQfQ3fOh5V2vXW+lmflYr37xq80WAIrpVUKyrsYgoA5f4vF0PRlhbeK4iJ4fyA9 xkVO1bgzHvTnR5wjdyfn/0IA/smQhEE= X-MC-Unique: qrQoGzl7PfycX2b7a1Dtqw-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 13/16] qemu-file: Remove QEMUFileHooks Date: Wed, 3 May 2023 15:18:44 +0200 Message-Id: <20230503131847.11603-14-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120074715100001 Content-Type: text/plain; charset="utf-8" The only user was rdma, and its use is gone. Signed-off-by: Juan Quintela --- migration/qemu-file.c | 6 ------ migration/qemu-file.h | 4 ---- migration/rdma.c | 9 --------- 3 files changed, 19 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 8d3f33fe41..c0c2195a6e 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -36,7 +36,6 @@ #define MAX_IOV_SIZE MIN_CONST(IOV_MAX, 64) =20 struct QEMUFile { - const QEMUFileHooks *hooks; QIOChannel *ioc; bool is_writable; =20 @@ -160,11 +159,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 ae3a704772..9c99914b21 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -36,12 +36,8 @@ #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 =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 c984a2840a..78d8f5a199 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -4021,13 +4021,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); @@ -4086,12 +4079,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 Thu May 16 02:29:14 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=1683120096; cv=none; d=zohomail.com; s=zohoarc; b=HZjaDX1uaiEdi2QmYCiuv+mV3U/ZM7rtnjkzW0W+/GsmQJyIDaZrrXV/Olycto/MiXYzTO4WZJ9GHbe80qimY+P8XelTN3KWdupD4kc7pRe1qOOmfw1dy7UU8jp0oENUynkP7zUl5fbyeA4Xvg0XEn1b5C3Lqdk0u6E3SjKzCyg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120096; 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=6PblU6H1oK6jH35HJlGBHarLzSB+RlIpEk1lgmkn1qE=; b=akw83BEPQGsRztBd11YRD5rHIi8BF6iUmuuKom/mjuscX55xlb4A1i4pZbZyitP1PQjGU54yPkpsGbqbc9B7V05QIulAXSHGwdBuC144W9emLtsentxYdxLaOTf7aih8DbIqeDN/3NJR1ghvYgUt1AFlYGVEG286b3qfrw/5DhQ= 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 1683120096465486.97039622832017; Wed, 3 May 2023 06:21:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO7-0005Uu-D3; Wed, 03 May 2023 09:19:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNx-0005S2-H8 for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNv-0006lq-HX for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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-1-QiEwNprIN6W2tSF8XpXwqg-1; Wed, 03 May 2023 09:19:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 06FACA0F385 for ; Wed, 3 May 2023 13:19:05 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FFA1C15BAD; Wed, 3 May 2023 13:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119946; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6PblU6H1oK6jH35HJlGBHarLzSB+RlIpEk1lgmkn1qE=; b=LR7HkJBOa45aZWVBaAjI+pSCAjo+WyIO2l8HYMiykoymbpanobaRyjzdY+SA+TUfmOepbD w/MXZsx3Rb4odLm1gHvAW/NQPYyQA+/A7nqAKv2vt63pf37kkZ8ADU/YIsw3Fi7gQWZrF3 OUMkvBT/KcLsPtaWQCCG+fhNNWxqiH8= X-MC-Unique: QiEwNprIN6W2tSF8XpXwqg-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 14/16] migration/rdma: Move rdma constants from qemu-file.h to rdma.h Date: Wed, 3 May 2023 15:18:45 +0200 Message-Id: <20230503131847.11603-15-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120097648100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/qemu-file.h | 17 ----------------- migration/ram.c | 2 +- migration/rdma.h | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index 9c99914b21..5129b6f196 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -29,13 +29,6 @@ #include "exec/cpu-common.h" #include "io/channel.h" =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); @@ -123,16 +116,6 @@ void qemu_fflush(QEMUFile *f); void qemu_file_set_blocking(QEMUFile *f, bool block); int qemu_file_get_to_fd(QEMUFile *f, int fd, size_t size); =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 a085ce8cae..ac2296d740 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -86,7 +86,7 @@ #define RAM_SAVE_FLAG_EOS 0x10 #define RAM_SAVE_FLAG_CONTINUE 0x20 #define RAM_SAVE_FLAG_XBZRLE 0x40 -/* 0x80 is reserved in qemu-file.h for RAM_SAVE_FLAG_HOOK */ +/* 0x80 is reserved in rdma.h for RAM_SAVE_FLAG_HOOK */ #define RAM_SAVE_FLAG_COMPRESS_PAGE 0x100 #define RAM_SAVE_FLAG_MULTIFD_FLUSH 0x200 /* We can't use any flag that is bigger than 0x200 */ diff --git a/migration/rdma.h b/migration/rdma.h index ed3650ef67..96ec2cc8f0 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -24,6 +24,22 @@ void rdma_start_outgoing_migration(void *opaque, const 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 Thu May 16 02:29:14 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=1683120329; cv=none; d=zohomail.com; s=zohoarc; b=N8jFq54C8DSROEhtcZPipkxuYxqN6uy/HIy41Ojr2F0dOIJ4EgFIt/FEbbvQ36B/Uvrp1djACOuoDNAN19SV7hQ3XuPJq3uyJn9gtKVtOmPR1rPxkf9TN2q8n2aGWSMRLR7u2cYzRgOx2uEX719gkUa1JcJt6dAyBD25b+81hPs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120329; 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=m649xLG+ESZJ3DGH6Rkd1PzCaV3pL6QuvdXZRUHKtHI=; b=UYPlsPqYLfZzp+DSwuG0gV4SKmM5iKZZBGWS5buvcDZrdb9BlAhBJVsTJaC1ksJdRaaFgpBYGn09Kmy5kwxOsfmIdhbqpFS3lt9C4q3+hXZOFdjpaogmzUqphvGvbR67VUDUEcnTmZJ4v83MheUODh4ISvIJk72Rxj1fU/hvLVM= 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 1683120329315485.0512987058306; Wed, 3 May 2023 06:25:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO5-0005Ti-BR; Wed, 03 May 2023 09:19: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 1puCO0-0005T1-Gg for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:12 -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 1puCNy-0006mk-D5 for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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-298-hq9sF7yJPSidZsEFk7eSRQ-1; Wed, 03 May 2023 09:19:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 347EA811E7E for ; Wed, 3 May 2023 13:19:06 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C602C15BAD; Wed, 3 May 2023 13:19:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119949; 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=m649xLG+ESZJ3DGH6Rkd1PzCaV3pL6QuvdXZRUHKtHI=; b=FnVYIfT8uD5u8Zy6LfryRtbgXUzdFqFAds14ZWupYxsExBDM03B9bRuuiCJDpUyTzAsZJM iB21TOA/UcAQKO9PAj3E/sJYkQEH9ruCpPJ1Ri8/KUi6DqFgdL+YRhYpuFeGWT0Gvw8xMj wFdyFV8/ZoJWs/qwpzRo9NGRV8UuwDM= X-MC-Unique: hq9sF7yJPSidZsEFk7eSRQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 15/16] migration/rdma: Remove qemu_ prefix from exported functions Date: Wed, 3 May 2023 15:18:46 +0200 Message-Id: <20230503131847.11603-16-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120330523100003 Content-Type: text/plain; charset="utf-8" Functions are long enough even without this. Signed-off-by: Juan Quintela --- 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 ac2296d740..0694b9dfec 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3278,12 +3278,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); } @@ -3345,7 +3345,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); } @@ -3405,7 +3405,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); } @@ -3456,7 +3456,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); } @@ -3482,7 +3482,7 @@ static int ram_save_complete(QEMUFile *f, void *opaqu= e) =20 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); } @@ -4469,7 +4469,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 78d8f5a199..d6b4398620 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3552,7 +3552,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, @@ -3594,7 +3594,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 @@ -3614,9 +3614,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, @@ -3633,11 +3633,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 @@ -3677,7 +3677,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, @@ -3699,7 +3699,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; @@ -3713,7 +3713,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) { @@ -3765,8 +3765,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); } @@ -3780,7 +3779,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 @@ -3788,7 +3787,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]); @@ -3804,8 +3803,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); @@ -3876,7 +3874,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; @@ -3897,7 +3895,7 @@ int qemu_rdma_registration_start(QEMUFile *f, uint64_= t flags) return 0; } =20 - trace_qemu_rdma_registration_start(flags); + trace_rdma_registration_start(flags); qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); qemu_fflush(f); =20 @@ -3908,7 +3906,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; @@ -3944,7 +3942,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. @@ -4006,7 +4004,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 96ec2cc8f0..982063abc0 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -42,17 +42,17 @@ 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); size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent); #else -int qemu_rdma_registration_handle(QEMUFile *f) { return 0; } -int qemu_rdma_registration_start(QEMUFile *f, uint64_t flags) { return 0; } -int qemu_rdma_registration_stop(QEMUFile *f, uint64_t flags) { return 0; } +int rdma_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; } size_t rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, diff --git a/migration/trace-events b/migration/trace-events index 92161eeac5..7aa6d2b2fc 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -221,20 +221,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" @@ -253,6 +239,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 Thu May 16 02:29:14 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=1683120087; cv=none; d=zohomail.com; s=zohoarc; b=INPMZzNjXcdoO+dg3wdAWWfI7MbUHvgpm7reKdKNZ+aBcB3dFI5UPv07376knC+ZRa0l/SKolpFTFzY8zhFhbVtDnu9mzD74qUr11oZuTFKiKcRi5DDLX+Fugx2NSKG0foro4p42PnZsWaDa6zLwLRyNVvcwIg9CA3okCgm6Z7E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683120087; 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=QTodSp/PhnjrR1P9iaM2nwu2PZjN+aaUzx1fblb92+E=; b=OswRVdpRfaH9FgXd3mDo0NqBdfOJAVo5Kn7MW/bc3uSSaINSv/dTu6LUZTEZJDXXwyh6W6eO2aWJmcqbzZLjkFMJjVl7/0Pkni4Qk3GBCWf2c4jwV7/VWqcVPZU5zo1y13o0b5or+Ipwf/no4x94Gs/wDWtAyclOSDV7aa9fPzQ= 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 1683120087445146.84441006521774; Wed, 3 May 2023 06:21:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puCO7-0005Un-1q; Wed, 03 May 2023 09:19:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puCNy-0005SD-Td for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19:12 -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 1puCNx-0006mG-E5 for qemu-devel@nongnu.org; Wed, 03 May 2023 09:19: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-222-GiJEUkq0PjOtAW1L6xXcgQ-1; Wed, 03 May 2023 09:19:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 40F5128237C0 for ; Wed, 3 May 2023 13:19:07 +0000 (UTC) Received: from secure.mitica (unknown [10.39.193.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7881DC15BAD; Wed, 3 May 2023 13:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683119948; 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=QTodSp/PhnjrR1P9iaM2nwu2PZjN+aaUzx1fblb92+E=; b=f5JjuIrAKxSqiQwd+Oewf7pVfcICosLkLMe9KC/e8HTgj21WyKJaxkqX6eR67otfAfcBzW MzxwSDo6F758kaxsXutJDnW6YZ7b6NHvMWO/GVkxXxfHHpGQ2fGgYVgf9Mygigk3xtw6AN +ZhSNjOy1o3PprovV+JnzBBJdy4OnQs= X-MC-Unique: GiJEUkq0PjOtAW1L6xXcgQ-1 From: Juan Quintela To: qemu-devel@nongnu.org Cc: Peter Xu , Juan Quintela , Leonardo Bras Subject: [PATCH v2 16/16] migration/rdma: If we are in postcopy don't do anything Date: Wed, 3 May 2023 15:18:47 +0200 Message-Id: <20230503131847.11603-17-quintela@redhat.com> In-Reply-To: <20230503131847.11603-1-quintela@redhat.com> References: <20230503131847.11603-1-quintela@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=quintela@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, 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: 1683120089609100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Juan Quintela --- migration/rdma.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index d6b4398620..4bc9c5cb91 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3243,10 +3243,6 @@ static size_t qemu_rdma_save_page(QEMUFile *f, =20 CHECK_ERROR_STATE(); =20 - if (migration_in_postcopy()) { - return RAM_SAVE_CONTROL_NOT_SUPP; - } - qemu_fflush(f); =20 /* @@ -3323,6 +3319,10 @@ size_t rdma_control_save_page(QEMUFile *f, ram_addr_= t block_offset, return RAM_SAVE_CONTROL_NOT_SUPP; } =20 + if (migration_in_postcopy()) { + return RAM_SAVE_CONTROL_NOT_SUPP; + } + int ret =3D qemu_rdma_save_page(f, block_offset, offset, size, bytes_s= ent); if (ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { qemu_file_acct_rate_limit(f, size); @@ -3883,6 +3883,10 @@ int rdma_registration_start(QEMUFile *f, uint64_t fl= ags) return 0; } =20 + if (migration_in_postcopy()) { + return 0; + } + RCU_READ_LOCK_GUARD(); rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { @@ -3891,10 +3895,6 @@ int rdma_registration_start(QEMUFile *f, uint64_t fl= ags) =20 CHECK_ERROR_STATE(); =20 - if (migration_in_postcopy()) { - return 0; - } - trace_rdma_registration_start(flags); qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); qemu_fflush(f); @@ -3917,6 +3917,10 @@ int rdma_registration_stop(QEMUFile *f, uint64_t fla= gs) return 0; } =20 + if (migration_in_postcopy()) { + return 0; + } + RCU_READ_LOCK_GUARD(); rdma =3D qatomic_rcu_read(&rioc->rdmaout); if (!rdma) { @@ -3925,10 +3929,6 @@ int rdma_registration_stop(QEMUFile *f, uint64_t fla= gs) =20 CHECK_ERROR_STATE(); =20 - if (migration_in_postcopy()) { - return 0; - } - qemu_fflush(f); ret =3D qemu_rdma_drain_cq(f, rdma); =20 --=20 2.40.0