From nobody Wed Nov 5 15:02:40 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534939934679362.7256471292061; Wed, 22 Aug 2018 05:12:14 -0700 (PDT) Received: from localhost ([::1]:58697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRzd-0000eo-3e for importer@patchew.org; Wed, 22 Aug 2018 08:12:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fsRp8-0006fu-Uu for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fsRp7-0008Oq-PP for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:18 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46184 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fsRp7-0008Of-Jq for qemu-devel@nongnu.org; Wed, 22 Aug 2018 08:01:17 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44DAC7A7EA; Wed, 22 Aug 2018 12:01:17 +0000 (UTC) Received: from secure.mitica (ovpn-116-35.ams2.redhat.com [10.36.116.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E055A9E66; Wed, 22 Aug 2018 12:01:14 +0000 (UTC) From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 22 Aug 2018 14:00:39 +0200 Message-Id: <20180822120050.12694-10-quintela@redhat.com> In-Reply-To: <20180822120050.12694-1-quintela@redhat.com> References: <20180822120050.12694-1-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 22 Aug 2018 12:01:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 22 Aug 2018 12:01:17 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'quintela@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 09/20] migration: implement io_set_aio_fd_handler function for RDMA QIOChannel X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, Lidong Chen , dgilbert@redhat.com, peterx@redhat.com, Lidong Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lidong Chen if qio_channel_rdma_readv return QIO_CHANNEL_ERR_BLOCK, the destination qemu crash. The backtrace is: (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00000000008db50e in qio_channel_set_aio_fd_handler (ioc=3D0x38111= e0, ctx=3D0x3726080, io_read=3D0x8db841 , io_write=3D0x0, opaq= ue=3D0x38111e0) at io/channel.c: #2 0x00000000008db952 in qio_channel_set_aio_fd_handlers (ioc=3D0x3811= 1e0) at io/channel.c:438 #3 0x00000000008dbab4 in qio_channel_yield (ioc=3D0x38111e0, condition= =3DG_IO_IN) at io/channel.c:47 #4 0x00000000007a870b in channel_get_buffer (opaque=3D0x38111e0, buf= =3D0x440c038 "", pos=3D0, size=3D327 at migration/qemu-file-channel.c:83 #5 0x00000000007a70f6 in qemu_fill_buffer (f=3D0x440c000) at migration= /qemu-file.c:299 #6 0x00000000007a79d0 in qemu_peek_byte (f=3D0x440c000, offset=3D0) at= migration/qemu-file.c:562 #7 0x00000000007a7a22 in qemu_get_byte (f=3D0x440c000) at migration/qe= mu-file.c:575 #8 0x00000000007a7c78 in qemu_get_be32 (f=3D0x440c000) at migration/qe= mu-file.c:655 #9 0x00000000007a0508 in qemu_loadvm_state (f=3D0x440c000) at migratio= n/savevm.c:2126 #10 0x0000000000794141 in process_incoming_migration_co (opaque=3D0x0) = at migration/migration.c:366 #11 0x000000000095c598 in coroutine_trampoline (i0=3D84033984, i1=3D0) = at util/coroutine-ucontext.c:1 #12 0x00007f9c0db56d40 in ?? () from /lib64/libc.so.6 #13 0x00007f96fe858760 in ?? () #14 0x0000000000000000 in ?? () RDMA QIOChannel not implement io_set_aio_fd_handler. so qio_channel_set_aio_fd_handler will access NULL pointer. Signed-off-by: Lidong Chen Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/rdma.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index cfb0671b09..d6bbf28fdc 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2963,6 +2963,21 @@ static GSource *qio_channel_rdma_create_watch(QIOCha= nnel *ioc, return source; } =20 +static void qio_channel_rdma_set_aio_fd_handler(QIOChannel *ioc, + AioContext *ctx, + IOHandler *io_read, + IOHandler *io_write, + void *opaque) +{ + QIOChannelRDMA *rioc =3D QIO_CHANNEL_RDMA(ioc); + if (io_read) { + aio_set_fd_handler(ctx, rioc->rdmain->comp_channel->fd, + false, io_read, io_write, NULL, opaque); + } else { + aio_set_fd_handler(ctx, rioc->rdmaout->comp_channel->fd, + false, io_read, io_write, NULL, opaque); + } +} =20 static int qio_channel_rdma_close(QIOChannel *ioc, Error **errp) @@ -3822,6 +3837,7 @@ static void qio_channel_rdma_class_init(ObjectClass *= klass, ioc_klass->io_set_blocking =3D qio_channel_rdma_set_blocking; ioc_klass->io_close =3D qio_channel_rdma_close; ioc_klass->io_create_watch =3D qio_channel_rdma_create_watch; + ioc_klass->io_set_aio_fd_handler =3D qio_channel_rdma_set_aio_fd_handl= er; } =20 static const TypeInfo qio_channel_rdma_info =3D { --=20 2.17.1