Message ID | 20190103101819.7418-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 96A206C5 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 3 Jan 2019 10:20:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 84D4328563 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 3 Jan 2019 10:20:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7930D28620; Thu, 3 Jan 2019 10:20:59 +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 17ACE28563 for <patchwork-qemu-devel@patchwork.kernel.org>; Thu, 3 Jan 2019 10:20:59 +0000 (UTC) Received: from localhost ([127.0.0.1]:50419 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 1gf07W-0006Bh-8f for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 Jan 2019 05:20:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gf05k-00042N-EW for qemu-devel@nongnu.org; Thu, 03 Jan 2019 05:19:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gf05g-0002hT-D2 for qemu-devel@nongnu.org; Thu, 03 Jan 2019 05:19:08 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:39548) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from <elohimes@gmail.com>) id 1gf05e-0002f3-Gq for qemu-devel@nongnu.org; Thu, 03 Jan 2019 05:19:04 -0500 Received: by mail-pl1-x643.google.com with SMTP id 101so15737684pld.6 for <qemu-devel@nongnu.org>; Thu, 03 Jan 2019 02:19:00 -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=hbNbxGkxjdP4/dOUZrYSeCa9q8Wcw7j7pvDTdflCEHY=; b=AZKYgHHS20/Nbk+sTmr7GsYXHOTlwVAkf64/2Jyk7ihpIXKHquXUw8sWxKwuribEu3 JFr0IihNvIdIcLyMB3w0cglWkBqW98QFnIyBcn6ijQmvMhM8mmTCdjQvmVTAmuR/nRZE fQ5M+Qlj/t2s9tBrTi7I/1qle+rukKxGFAxwoi024cvCN/4U/UjZK27nhmu7S6MN4ADH OaK5n3zXbj6uvNi9vIghCm7nkTV9Mwz5aNKdSSpocOgkFqqRyQrpDoT/JPpXKpkNVIkp Xl5ppvhLTprW8HwKUhze1vJKeUdv5r4zxBcpYJd8U2MvEsrJyapr4zZuFdxTWh8i2hRH ERqg== 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=hbNbxGkxjdP4/dOUZrYSeCa9q8Wcw7j7pvDTdflCEHY=; b=LwQQ2Ru6+4RdHf+wZo2dYJb5ltTwgvuD6zWnjaXPcOZ5cUDxbMPTttfpFPK0HOo2BN YAej5TAHN51jWhKdK8pupI+czuSKBIvQJPzumL3XHlyUOpztXmTvsIO2WdhVni4yggtm hYzjecHiaYZ97REpPJluVnIMvex9inFiUKV6Lp01Ff4jbxDreggp6Fyf5GN821O9Olf8 ZYe1XisDClY0ej6iDxtmtYmtyGKv9NZZE4opxPsuB9o0a2oLTPBJFpdbhWPbjynmYfPS UxwTcyohhO5GsxllUlJ/2opv7Nh6NlwYf/NfgK/gya+HwOv7De7ggH0xud5YSc3SBPBM JdJg== X-Gm-Message-State: AJcUukc7nvsY2NlrF2EjnH6B+sA9spT1wbiEm72YvGlw8lVrGyQakJ5j jt2dekx+1c1XHrUNllLSRpc= X-Google-Smtp-Source: ALg8bN6F9sOdHMHJ0mkIKOYhLzjnSM5i4Sl2bWTCgx2sEVDEpAjIwioerqHTHku8Anszg/xpwOCWNg== X-Received: by 2002:a17:902:6948:: with SMTP id k8mr45934307plt.2.1546510739271; Thu, 03 Jan 2019 02:18:59 -0800 (PST) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id i2sm17867209pfi.66.2019.01.03.02.18.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Jan 2019 02:18:58 -0800 (PST) From: elohimes@gmail.com X-Google-Original-From: xieyongji@baidu.com To: mst@redhat.com, marcandre.lureau@redhat.com, berrange@redhat.com, jasowang@redhat.com, maxime.coquelin@redhat.com, yury-kotov@yandex-team.ru, wrfsh@yandex-team.ru Date: Thu, 3 Jan 2019 18:18:12 +0800 Message-Id: <20190103101819.7418-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::643 Subject: [Qemu-devel] [PATCH v3 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 uses exisiting wait/nowait options to make QEMU not do a connect on client sockets during initialization of the chardev. 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,nowait,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. V2 to V3: - Using exisiting wait/nowait options to control connection on client sockets instead of introducing "disconnected" option. - Support the case that vhost-user backend restart during initialzation of vhost-user-blk device. 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): char-socket: Enable "nowait" option on client sockets 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 | 56 ++--- 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 | 223 ++++++++++++++--- 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 | 9 +- 13 files changed, 799 insertions(+), 114 deletions(-)