From patchwork Thu Dec 6 06:35:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 10715305 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3B7618B8 for ; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E257D2E7F8 for ; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6BEB2E80B; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F7B12E7F8 for ; Thu, 6 Dec 2018 06:38:01 +0000 (UTC) Received: from localhost ([::1]:39094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUnIO-0002JX-KX for patchwork-qemu-devel@patchwork.kernel.org; Thu, 06 Dec 2018 01:38:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUnH4-0001Jr-I2 for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUnGz-00038x-Ud for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:38 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:41105) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gUnGz-000364-Dr for qemu-devel@nongnu.org; Thu, 06 Dec 2018 01:36:33 -0500 Received: by mail-pf1-x442.google.com with SMTP id b7so11279920pfi.8 for ; Wed, 05 Dec 2018 22:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=GUBw/y7GxS0EfUbJRo1pggNioNLiFHhRNKjj3pv3geQ=; b=s/cSFfJmcnyKsV2DV1+cn7VQ+lnkBDQiU5X+XfEKWz94l/YX6CQ4mXkhEmaasl9DnX 9c3L0p7oXeccA7e8Ve8mvibaxWlNMXvIboEsY9AK9ZCHBUdPhSnGQZDZ/0KWZXJ/xGC7 4SFcxNMlyurDz8n/zdqeiaTODCXkmVxdlr1Pr6lsQ1FaZjpxrp4fSL9fFz1oLnrmSWE7 UZL/rqALUOxN0Fqgo7xFc7+owlValqMxcPlcKczn9jCkf2ohz2KQercyr0Lughlre1qx 3mUBKF7/gfgteJGfKSl1NXsEa5/1xy5gQsZ+CUNtnHzut/B1DuLNbl4pTb5NLUuR+2hf rk0Q== 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; bh=GUBw/y7GxS0EfUbJRo1pggNioNLiFHhRNKjj3pv3geQ=; b=rgt/nr/Pd6kHIyWOvvK7InYe/9GVQ3AKVTJWeNV6s9Z3KRmGyAQhXy5xFkx5R6arFF iMgMzI6lypKsUx/qim2S3y5jj+EGtX7JIkX0SxQY662kScv8qdNj02o8MwR4BtEu43Fr Q2RvSx9S7R8vFo1UubTm1vugQboh2G3KjMchVdNa/5ORYtA+YX8f1QIzIiDpcPxDIG9V ZaifoHlq/G6/0VwrF8q4XrC31ZXHwx4GqxdMvzpavP9gf8nnHX8OXA2WzNsUS2kNt5mu 1/QQeGwMd/Rfs3uh5PBN3I/A+Z1+dTGkz0hghdvC+IBJuHfoddmqhUy487sVP+OgsUcn X8dg== X-Gm-Message-State: AA+aEWZoOXWVj7l8G6ou4Q+upaMfOFeey1zBEiXAJird34i/6kHu61Kl DyEeGrK1Nznvwn1BN8w8sdc= X-Google-Smtp-Source: AFSGD/UHgXuD2UCI+TRq3lWEIgw2YrKcQ5L+oT5Qa4gzntixtJO7MtTXCFdFKFl1aSFgfA8thHEsBA== X-Received: by 2002:a63:b54f:: with SMTP id u15mr22920540pgo.420.1544078190132; Wed, 05 Dec 2018 22:36:30 -0800 (PST) Received: from yongji-Ubuntu.internal.baidu.com ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id x186sm26175249pfb.59.2018.12.05.22.36.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 22:36:29 -0800 (PST) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, marcandre.lureau@redhat.com Date: Thu, 6 Dec 2018 14:35:46 +0800 Message-Id: <20181206063552.6701-1-xieyongji@baidu.com> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH for-4.0 0/6] vhost-user-blk: Add support for backend reconnecting 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: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Xie Yongji This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 tries to implenment the sync connection for "reconnect socket". The patch 2 introduces a new message VHOST_USER_SET_VRING_INFLIGHT to support offering shared memory to backend to record its inflight I/O. The patch 3,4 are the corresponding libvhost-user patches of patch 2. Make libvhost-user support VHOST_USER_SET_VRING_INFLIGHT. The patch 5 supports vhost-user-blk to reconnect backend when connection closed. The patch 6 tells qemu that we support reconnecting now. To use it, we could start qemu with: qemu-system-x86_64 \ -chardev socket,id=char0,path=/path/vhost.socket,reconnect=1,wait \ -device vhost-user-blk-pci,chardev=char0 \ and start vhost-user-blk backend with: vhost-user-blk -b /path/file -s /path/vhost.socket Then we can restart vhost-user-blk at any time during VM running. Xie Yongji (6): char-socket: Enable "wait" option for client mode vhost-user: Add shared memory to record inflight I/O libvhost-user: Introduce vu_queue_map_desc() libvhost-user: Support recording inflight I/O in shared memory vhost-user-blk: Add support for reconnecting backend contrib/vhost-user-blk: enable inflight I/O recording chardev/char-socket.c | 5 +- contrib/libvhost-user/libvhost-user.c | 215 ++++++++++++++++++++---- contrib/libvhost-user/libvhost-user.h | 19 +++ contrib/vhost-user-blk/vhost-user-blk.c | 3 +- hw/block/vhost-user-blk.c | 169 +++++++++++++++++-- hw/virtio/vhost-user.c | 69 ++++++++ hw/virtio/vhost.c | 8 + include/hw/virtio/vhost-backend.h | 4 + include/hw/virtio/vhost-user-blk.h | 4 + include/hw/virtio/vhost-user.h | 8 + 10 files changed, 452 insertions(+), 52 deletions(-)