Message ID | 20181218100002.11219-1-xieyongji@baidu.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> 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 2196E6C5 for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Dec 2018 10:02:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11AC92A3AE for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Dec 2018 10:02:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05F5D2A3C8; Tue, 18 Dec 2018 10:02:29 +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 9046A2A3AE for <patchwork-qemu-devel@patchwork.kernel.org>; Tue, 18 Dec 2018 10:02:28 +0000 (UTC) Received: from localhost ([::1]:52869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1gZCCo-0000Do-P0 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 18 Dec 2018 05:02:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gZCB6-0007QY-1B for qemu-devel@nongnu.org; Tue, 18 Dec 2018 05:00:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gZCB0-0001Z4-4a for qemu-devel@nongnu.org; Tue, 18 Dec 2018 05:00:39 -0500 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:39921) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gZCAz-0001YN-UU for qemu-devel@nongnu.org; Tue, 18 Dec 2018 05:00:34 -0500 Received: by mail-pf1-x442.google.com with SMTP id r136so841916pfc.6 for <qemu-devel@nongnu.org>; Tue, 18 Dec 2018 02:00:33 -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=SlyZostnPnUZJvyZ5JxauI7QUot5gsiEOOoBnvrTV+E=; b=E5Er21T4KZELy4HxPCsChVJtorvddar0I0r+A4NxjYOxlfvCTskXX5FuAJea7GC4nz R4YSGyx9Nes9fccoUlGrhUNFg85HP/iADEBPGn1i4wtDS+kOqUQbRuo3CLelD6dQPuZv EIMnoO2IX2NfTrkIJpYDors1NZbg2Cr2j5BsVIxfTLCuOnzzwMhPZ99h1qLn6kia9zhy VYbCItdhI5f2yukgDSgVXlG5jooA//mbymPR9MAz3z4hGxECwkfA8r18jkYzaNHI4D26 9iTo7DRPJ2dQO+HzSdGdZrquGfiwvPxiZw1cEoSvOH7T+EZ5ZqL5HZWwwSfbpSonIUp7 W2dw== 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=SlyZostnPnUZJvyZ5JxauI7QUot5gsiEOOoBnvrTV+E=; b=FAnZSoVximGjRdbz1rP1BsqnqHYGHsK7hfgKhHQRX1IZycdAK7TJI/EyUwe3+L5PjE r6XY1v71vaserVUNTLvtE+ykn95SH7qpBOAjx4Ziemn9seRoY+gmF4L3BaIzajOV7lZb ytQQCnnFl664GB5MEhYXXTnGCmPJv8NeyKvuWRD4y1NM8QewQeulVUJaX9W4lED0fN5x 0XT32qMVQ+7R5xFIklfB7URJxZ/1HruoVmFRopzB9Cv+zgxhogXQQklisfjij56SPnVO MCOJC1sccAD7KO9GLVrvHSl2gslK9Bz8cYoODpVaqBKUyAiqH2hKfjwMYNewcRAz1A02 jnOQ== X-Gm-Message-State: AA+aEWZjIhNkNm5P+mXoF6UJSsKNSPDrdw2A1EL4kXdnD3FLQ7bxUOCg gE3SCCkz4DCcY7VlJ0ug9ao= X-Google-Smtp-Source: AFSGD/WYD/CNCjGVBgMYTmj/cJ6MGcS+g4kpPW5dZ2zi9YJyn9lohucAkfkv3Ywipt8+ksNVbyIz5w== X-Received: by 2002:a63:31cc:: with SMTP id x195mr15404249pgx.52.1545127232714; Tue, 18 Dec 2018 02:00:32 -0800 (PST) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id p2sm20923222pfp.125.2018.12.18.02.00.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Dec 2018 02:00:32 -0800 (PST) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, marcandre.lureau@redhat.com, jasowang@redhat.com, yury-kotov@yandex-team.ru, maxime.coquelin@redhat.com Date: Tue, 18 Dec 2018 17:59:55 +0800 Message-Id: <20181218100002.11219-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 v2 for-4.0 0/7] vhost-user-blk: Add support for backend reconnecting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: nixun@baidu.com, qemu-devel@nongnu.org, lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com, Xie Yongji <xieyongji@baidu.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
vhost-user-blk: Add support for backend reconnecting
|
expand
|
From: Xie Yongji <xieyongji@baidu.com> This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart. The patch 1 adds a "disconnected" option to init the chardev socket in disconnected state. The patch 2 introduces two new messages VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD to support providing shared memory to backend. The patch 3,4 are the corresponding libvhost-user patches of patch 2. Make libvhost-user support VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD. The patch 5 allows vhost-user-blk to use the two new messages to provide shared memory to backend. The patch 6 supports vhost-user-blk to reconnect backend when connection closed. The patch 7 introduces VHOST_USER_PROTOCOL_F_SLAVE_SHMFD to vhost-user-blk backend which is used to tell 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,disconnected,reconnect=1, \ -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. V1 to V2: - Introduce "disconnected" option for chardev instead of reuse "wait" option - Support the case that QEMU starts before vhost-user backend - Drop message VHOST_USER_SET_VRING_INFLIGHT - Introduce two new messages VHOST_USER_GET_SHM_SIZE and VHOST_USER_SET_SHM_FD Xie Yongji (7): chardev: Add disconnected option for chardev socket vhost-user: Support providing shared memory to backend libvhost-user: Introduce vu_queue_map_desc() libvhost-user: Support recording inflight I/O in shared memory vhost-user-blk: Add support to provide shared memory to backend vhost-user-blk: Add support to reconnect backend contrib/vhost-user-blk: enable inflight I/O recording chardev/char-socket.c | 10 + chardev/char.c | 3 + contrib/libvhost-user/libvhost-user.c | 309 ++++++++++++++++++++---- contrib/libvhost-user/libvhost-user.h | 33 +++ contrib/vhost-user-blk/vhost-user-blk.c | 3 +- docs/interop/vhost-user.txt | 41 ++++ hw/block/vhost-user-blk.c | 205 ++++++++++++++-- hw/virtio/vhost-user.c | 86 +++++++ hw/virtio/vhost.c | 117 +++++++++ include/hw/virtio/vhost-backend.h | 9 + include/hw/virtio/vhost-user-blk.h | 5 + include/hw/virtio/vhost.h | 19 ++ qapi/char.json | 3 + qemu-options.hx | 28 ++- 14 files changed, 790 insertions(+), 81 deletions(-)