From patchwork Mon Aug 6 13:29:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 953873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="iS+8Vg3h"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41kdwW2YYzz9s0R for ; Mon, 6 Aug 2018 23:36:41 +1000 (AEST) Received: from localhost ([::1]:34146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmfgc-00005c-Jo for incoming@patchwork.ozlabs.org; Mon, 06 Aug 2018 09:36:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmfa9-0003JB-0s for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:29:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmfa6-0008GS-8I for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:29:57 -0400 Received: from mail-pl0-x233.google.com ([2607:f8b0:400e:c01::233]:44032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmfa6-0008G9-2X for qemu-devel@nongnu.org; Mon, 06 Aug 2018 09:29:54 -0400 Received: by mail-pl0-x233.google.com with SMTP id ba4-v6so5655936plb.11 for ; Mon, 06 Aug 2018 06:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i+9cu6YEw6HZ98kuAAxb7164x+SFub9Zft6Br89mO6c=; b=iS+8Vg3huZzx+eJGQKc1pji34nxMVzUxJHM0ps6N22WovhQyRvsiXhHGaQ1ME95RGf dQLfvtC7Bdj140gFmQ9jhNlxZosWOxtk5uNUuYDRWuhLmBFEg/jpHHmm7c2QU8P5HWfG sGWO8Fzio83DrUrOl7iBt/2Zd2JZM1dh8fBGS03WH1eF7uJ4h4rfltdoAkZyYRqcjsmw bs6PT8AtVf3YRhMPR3RVvf6ubIVT/EtufReplPmxxTh2HsbuEEh8F04NYGIZk5tTLjLI 5qTaLesEbS8MdGCAYh190L1Lumkai1VW6gPCcgwACNrmGbzwN9eXIsji7CUPutfCleRs xxpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i+9cu6YEw6HZ98kuAAxb7164x+SFub9Zft6Br89mO6c=; b=nywCx4/s8vhOOOkE0S72LWJYK18wDdWNYrKLM13QjVtNraN1ck+g706IQEvuZ2CUkD 9UnQWnETRqunIkNimjQxafIr6PeiGh19+LBOA0iKUQvmoDWf5iQ4e6LCjBUqBesS8D88 RMj+Gp/TbR6USrhjDtaNJXFFbJs5dQg2fj3UiI8a6zo7FqP5+YjyJ+BXukXb4RSERxI3 iGnYmr/d5JW+wuvtSGbjbiQJyhcahQBR78nVMKApou7q9vv5NxzqzvcYKSqod/rqP9Xk Xk/JUOP3BIHcY9BmJHNtpEBo4Fc2YQmfZzJJgv64kEnx6Fx/kTDc873pCdxJ2v8JJHCN AePQ== X-Gm-Message-State: AOUpUlGz9eKWKcPXafjDWolL0utC67s+zIX16LCBycfRRREo55JXqIKe 4gtGEGLqPDnG12FlcXRqsyA= X-Google-Smtp-Source: AAOMgpfAjStctzjgbD4qa5dAuIE7O646EhwB2+xRU0JSHDc9/SX6GQXTgBgiFySq3Sq0TrHmz6eb0g== X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr13849580plu.211.1533562193258; Mon, 06 Aug 2018 06:29:53 -0700 (PDT) Received: from VM_120_46_centos.localdomain ([119.28.87.64]) by smtp.gmail.com with ESMTPSA id f11-v6sm11756302pfa.131.2018.08.06.06.29.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 06:29:52 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com Date: Mon, 6 Aug 2018 21:29:31 +0800 Message-Id: <1533562177-16447-6-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533562177-16447-1-git-send-email-lidongchen@tencent.com> References: <1533562177-16447-1-git-send-email-lidongchen@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::233 Subject: [Qemu-devel] [PATCH v6 05/11] 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: Lidong Chen , qemu-devel@nongnu.org, Lidong Chen Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=0x38111e0, ctx=0x3726080, io_read=0x8db841 , io_write=0x0, opaque=0x38111e0) at io/channel.c: #2 0x00000000008db952 in qio_channel_set_aio_fd_handlers (ioc=0x38111e0) at io/channel.c:438 #3 0x00000000008dbab4 in qio_channel_yield (ioc=0x38111e0, condition=G_IO_IN) at io/channel.c:47 #4 0x00000000007a870b in channel_get_buffer (opaque=0x38111e0, buf=0x440c038 "", pos=0, size=327 at migration/qemu-file-channel.c:83 #5 0x00000000007a70f6 in qemu_fill_buffer (f=0x440c000) at migration/qemu-file.c:299 #6 0x00000000007a79d0 in qemu_peek_byte (f=0x440c000, offset=0) at migration/qemu-file.c:562 #7 0x00000000007a7a22 in qemu_get_byte (f=0x440c000) at migration/qemu-file.c:575 #8 0x00000000007a7c78 in qemu_get_be32 (f=0x440c000) at migration/qemu-file.c:655 #9 0x00000000007a0508 in qemu_loadvm_state (f=0x440c000) at migration/savevm.c:2126 #10 0x0000000000794141 in process_incoming_migration_co (opaque=0x0) at migration/migration.c:366 #11 0x000000000095c598 in coroutine_trampoline (i0=84033984, i1=0) 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 Reviewed-by: Juan Quintela --- migration/rdma.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/migration/rdma.c b/migration/rdma.c index cfb0671..d6bbf28 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2963,6 +2963,21 @@ static GSource *qio_channel_rdma_create_watch(QIOChannel *ioc, return source; } +static void qio_channel_rdma_set_aio_fd_handler(QIOChannel *ioc, + AioContext *ctx, + IOHandler *io_read, + IOHandler *io_write, + void *opaque) +{ + QIOChannelRDMA *rioc = 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); + } +} 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 = qio_channel_rdma_set_blocking; ioc_klass->io_close = qio_channel_rdma_close; ioc_klass->io_create_watch = qio_channel_rdma_create_watch; + ioc_klass->io_set_aio_fd_handler = qio_channel_rdma_set_aio_fd_handler; } static const TypeInfo qio_channel_rdma_info = {