Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07B01C001DE for ; Mon, 31 Jul 2023 11:35:44 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qQRB7-00013z-BA; Mon, 31 Jul 2023 07:35:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qQRB5-00013i-C1 for qemu-devel@nongnu.org; Mon, 31 Jul 2023 07:35:07 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qQRB1-0003B5-7C for qemu-devel@nongnu.org; Mon, 31 Jul 2023 07:35:07 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1bbf3da0ea9so14522115ad.2 for ; Mon, 31 Jul 2023 04:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20221208.gappssmtp.com; s=20221208; t=1690803179; x=1691407979; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=m3OZPOJyezwqBRoSnh57/gryU51kIwcnfGZWX1RLong=; b=QX9htMwBalfqhtC/ciX+0vRqcIP2eeNbQbOCw7YuckpxcnR/7uA6U05q4qoQIu01ch FdqtaD7MKzq36vjLmibU7nPP9jGujKKTmnWDfeTQOmuKaRGfzWxYEUwdjGxp6Il3fgjU md1wDdvSrv2lU+FxR5FNcD1dypB0Iet9rcwAxT6MPAyw/1RecFP3JQrSgpVjCvaZ3Fhb XqxrW2FkVUK00b0sDO+0uduudvG9a4CfwavUsQqL+oYH3hwYRFU3LAOEYf5pkAdCerD9 iIVr0SteuryDGgNSayXQXnUzCZZhwFuqaUHvplWbjhYbvPRpLmeuEuQh3kyhdoXbuQ6+ ROjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690803179; x=1691407979; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=m3OZPOJyezwqBRoSnh57/gryU51kIwcnfGZWX1RLong=; b=Q6LQ77vYJ1Hyhb32LUbdiy1Fjr2xuLzukGNBS2HB8cuh2JjHmLxGOeji6Yi6Wvtsjv X7Au8W5bY9KEoMe0vI1XrbqVeUZwWYSNKypB4UX8TEINJIZAAfR+D3USXaCpxFApGmxy +URWYhGS7YwLpoK8UUhiQXRkZYWKdmH+TKXu5aXtGHLABE6gM9cKeWM0LoPIJnesYx4g xk1uYOP3Fmn7YyWZaoqEvf4TXP8n6iHbX3+p/UWYsEcSGoMFXW/NCDfvvQmxNFBx5gsf iFtloiR9kDy1eM87Iu0TtKMPaKtclBJr1q5n7aR1pTZIQmmWcq0tVQddlS6RbgxP+1JE XxFg== X-Gm-Message-State: ABy/qLa3LEcFe23OQkUnBfyC1w/3J6ZF2TkCGr+hGgOHO4Mni4jJuzY+ A7CGkfy5hmgUkAADwJTh7Uyzcg== X-Google-Smtp-Source: APBJJlE149P26L60KAuwOc8lIbZ/tzQ1XVj+flI4likTQiWntO8/Una4IxzzrTTxwJPV+Shi5sjGYA== X-Received: by 2002:a17:903:1cb:b0:1b8:2ba0:c9c0 with SMTP id e11-20020a17090301cb00b001b82ba0c9c0mr9682516plh.59.1690803178845; Mon, 31 Jul 2023 04:32:58 -0700 (PDT) Received: from smtpclient.apple ([47.75.78.161]) by smtp.gmail.com with ESMTPSA id w8-20020a170902e88800b001b83e5ec666sm8383072plg.6.2023.07.31.04.32.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2023 04:32:58 -0700 (PDT) From: Li Feng Message-Id: <3CE8EB18-6E86-4E83-8675-8722D954830D@smartx.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_C7363ABD-8574-4088-9DAA-702D6DA28F8F" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Subject: Re: [PATCH] vhost-user-scsi: support reconnect to backend Date: Mon, 31 Jul 2023 19:32:41 +0800 In-Reply-To: Cc: "Michael S. Tsirkin" , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Fam Zheng , "open list:Block layer core" , "open list:All patches CC here" To: Raphael Norwitz References: <20230721105205.1714449-1-fengli@smartx.com> <15166F8E-9F1C-4AEB-9941-E83E5776B3A7@smartx.com> <1C6B7B1C-5B5A-4CAC-9FE4-3BB29B8BD625@nutanix.com> <58D37DBE-A5A2-4875-B129-A21F667E6615@smartx.com> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: none client-ip=2607:f8b0:4864:20::632; envelope-from=fengli@smartx.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org --Apple-Mail=_C7363ABD-8574-4088-9DAA-702D6DA28F8F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 2023=E5=B9=B47=E6=9C=8831=E6=97=A5 06:09=EF=BC=8CRaphael Norwitz = =E5=86=99=E9=81=93=EF=BC=9A >=20 >=20 >=20 >> On Jul 28, 2023, at 3:48 AM, Li Feng wrote: >>=20 >> Thanks for your reply. >>=20 >>> 2023=E5=B9=B47=E6=9C=8828=E6=97=A5 =E4=B8=8A=E5=8D=885:21=EF=BC=8CRaph= ael Norwitz =E5=86=99=E9=81=93=EF=BC=9A >>>=20 >>>=20 >>>=20 >>>> On Jul 25, 2023, at 6:19 AM, Li Feng wrote: >>>>=20 >>>> Thanks for your comments. >>>>=20 >>>>> 2023=E5=B9=B47=E6=9C=8825=E6=97=A5 =E4=B8=8A=E5=8D=881:21=EF=BC=8CRa= phael Norwitz =E5=86=99=E9=81=93=EF=BC=9A >>>>>=20 >>>>> Very excited to see this. High level looks good modulo a few small = things. >>>>>=20 >>>>> My major concern is around existing vhost-user-scsi backends which = don=E2=80=99t support VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD. IMO we = should hide the reconnect behavior behind a = VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD check. We may want to do the same = for vhost-user-blk. >>>>>=20 >>>>> The question is then what happens if the check is false. IIUC = without an inflight FD, if a device processes requests out of order, = it=E2=80=99s not safe to continue execution on reconnect, as there=E2=80=99= s no way for the backend to know how to replay IO. Should we permanently = wedge the device or have QEMU fail out? May be nice to have a toggle for = this. >>>>=20 >>>> Based on what MST said, is there anything else I need to do? >>>=20 >>> I don=E2=80=99t think so. >>>=20 >>>>>=20 >>>>>> On Jul 21, 2023, at 6:51 AM, Li Feng wrote: >>>>>>=20 >>>>>> If the backend crashes and restarts, the device is broken. >>>>>> This patch adds reconnect for vhost-user-scsi. >>>>>>=20 >>>>>> Tested with spdk backend. >>>>>>=20 >>>>>> Signed-off-by: Li Feng >>>>>> --- >>>>>> hw/block/vhost-user-blk.c | 2 - >>>>>> hw/scsi/vhost-scsi-common.c | 27 ++--- >>>>>> hw/scsi/vhost-user-scsi.c | 163 = +++++++++++++++++++++++++--- >>>>>> include/hw/virtio/vhost-user-scsi.h | 3 + >>>>>> include/hw/virtio/vhost.h | 2 + >>>>>> 5 files changed, 165 insertions(+), 32 deletions(-) >>>>>>=20 >>>>>> diff --git a/hw/block/vhost-user-blk.c = b/hw/block/vhost-user-blk.c >>>>>> index eecf3f7a81..f250c740b5 100644 >>>>>> --- a/hw/block/vhost-user-blk.c >>>>>> +++ b/hw/block/vhost-user-blk.c >>>>>> @@ -32,8 +32,6 @@ >>>>>> #include "sysemu/sysemu.h" >>>>>> #include "sysemu/runstate.h" >>>>>>=20 >>>>>> -#define REALIZE_CONNECTION_RETRIES 3 >>>>>> - >>>>>> static const int user_feature_bits[] =3D { >>>>>> VIRTIO_BLK_F_SIZE_MAX, >>>>>> VIRTIO_BLK_F_SEG_MAX, >>>>>> diff --git a/hw/scsi/vhost-scsi-common.c = b/hw/scsi/vhost-scsi-common.c >>>>>=20 >>>>> Why can=E2=80=99t all the vhost-scsi-common stuff be moved to a = separate change? >>>>=20 >>>> I will move this code to separate patch. >>>>>=20 >>>>> Especially the stuff introduced for vhost-user-blk in = 1b0063b3048af65dfaae6422a572c87db8575a92 should be moved out. >>>> OK. >>>>=20 >>>>>=20 >>>>>> index a06f01af26..08801886b8 100644 >>>>>> --- a/hw/scsi/vhost-scsi-common.c >>>>>> +++ b/hw/scsi/vhost-scsi-common.c >>>>>> @@ -52,16 +52,22 @@ int vhost_scsi_common_start(VHostSCSICommon = *vsc) >>>>>>=20 >>>>>> vsc->dev.acked_features =3D vdev->guest_features; >>>>>>=20 >>>>>> - assert(vsc->inflight =3D=3D NULL); >>>>>> - vsc->inflight =3D g_new0(struct vhost_inflight, 1); >>>>>> - ret =3D vhost_dev_get_inflight(&vsc->dev, >>>>>> - vs->conf.virtqueue_size, >>>>>> - vsc->inflight); >>>>>> + ret =3D vhost_dev_prepare_inflight(&vsc->dev, vdev); >>>>>> if (ret < 0) { >>>>>> - error_report("Error get inflight: %d", -ret); >>>>>> + error_report("Error setting inflight format: %d", -ret); >>>>>> goto err_guest_notifiers; >>>>>> } >>>>>>=20 >>>>>> + if (!vsc->inflight->addr) { >>>>>> + ret =3D vhost_dev_get_inflight(&vsc->dev, >>>>>> + vs->conf.virtqueue_size, >>>>>> + vsc->inflight); >>>>>> + if (ret < 0) { >>>>>> + error_report("Error get inflight: %d", -ret); >>>>>> + goto err_guest_notifiers; >>>>>> + } >>>>>> + } >>>>>> + >>>>>> ret =3D vhost_dev_set_inflight(&vsc->dev, vsc->inflight); >>>>>> if (ret < 0) { >>>>>> error_report("Error set inflight: %d", -ret); >>>>>> @@ -85,9 +91,6 @@ int vhost_scsi_common_start(VHostSCSICommon = *vsc) >>>>>> return ret; >>>>>>=20 >>>>>> err_guest_notifiers: >>>>>> - g_free(vsc->inflight); >>>>>> - vsc->inflight =3D NULL; >>>>>> - >>>>>> k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, false); >>>>>> err_host_notifiers: >>>>>> vhost_dev_disable_notifiers(&vsc->dev, vdev); >>>>>> @@ -111,12 +114,6 @@ void vhost_scsi_common_stop(VHostSCSICommon = *vsc) >>>>>> } >>>>>> assert(ret >=3D 0); >>>>>>=20 >>>>>=20 >>>>> In the vhost-scsi (kernel backend) path, what will cleanup = vsc->inflight now? >>>> OK, we should check the vsc->inflight if it is null, the vhost-scsi = doesn=E2=80=99t allocate the >>>> inflight object memory. >>>=20 >>> Are you saying vhost-scsi never allocates inflight so we don=E2=80=99t= need to check for it? >> We have checked the vsc->inflight, and only if allocated, we send the = get/set_inflight_fd. >> This works with vhost-user-scsi/vhost-scsi both. >=20 > So then it sounds like this code introduces a resource leak. = g_free(vsc->inflight) should be added to the vhost-scsi code in = vhost_scsi_stop(). No, the vhost-scsi doesn=E2=80=99t need =E2=80=98inflight', it doesn=E2=80= =99t allocate the inflight memory. The rule is =E2=80=98who allocates, who free it=E2=80=99. >=20 >>>=20 >>>>=20 >>>>>=20 >>>>>> - if (vsc->inflight) { >>>>>> - vhost_dev_free_inflight(vsc->inflight); >>>>>> - g_free(vsc->inflight); >>>>>> - vsc->inflight =3D NULL; >>>>>> - } >>>>>> - >>>>>> vhost_dev_disable_notifiers(&vsc->dev, vdev); >>>>>> } >>>>>>=20 >>>>>> diff --git a/hw/scsi/vhost-user-scsi.c = b/hw/scsi/vhost-user-scsi.c >>>>>> index ee99b19e7a..e0e88b0c42 100644 >>>>>> --- a/hw/scsi/vhost-user-scsi.c >>>>>> +++ b/hw/scsi/vhost-user-scsi.c >>>>>> @@ -89,14 +89,126 @@ static void = vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq) >>>>>> { >>>>>> } >>>>>>=20 >>>>>> +static int vhost_user_scsi_connect(DeviceState *dev, Error = **errp) >>>>>> +{ >>>>>> + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); >>>>>> + VHostUserSCSI *s =3D VHOST_USER_SCSI(vdev); >>>>>> + VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); >>>>>> + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>> + int ret =3D 0; >>>>>> + >>>>>> + if (s->connected) { >>>>>> + return 0; >>>>>> + } >>>>>> + s->connected =3D true; >>>>>> + >>>>>> + vsc->dev.num_queues =3D vs->conf.num_queues; >>>>>> + vsc->dev.nvqs =3D VIRTIO_SCSI_VQ_NUM_FIXED + = vs->conf.num_queues; >>>>>> + vsc->dev.vqs =3D s->vhost_vqs; >>>>>> + vsc->dev.vq_index =3D 0; >>>>>> + vsc->dev.backend_features =3D 0; >>>>>> + >>>>>> + ret =3D vhost_dev_init(&vsc->dev, &s->vhost_user, = VHOST_BACKEND_TYPE_USER, 0, >>>>>> + errp); >>>>>> + if (ret < 0) { >>>>>> + return ret; >>>>>> + } >>>>>> + >>>>>> + /* restore vhost state */ >>>>>=20 >>>>> Should this use virtio_device_should_start like vhost_user_blk? >>>> I will change this. >>>>>=20 >>>>>> + if (virtio_device_started(vdev, vdev->status)) { >>>>>> + ret =3D vhost_scsi_common_start(vsc); >>>>>> + if (ret < 0) { >>>>>> + return ret; >>>>>> + } >>>>>> + } >>>>>> + >>>>>> + return 0; >>>>>> +} >>>>>> + >>>>>> +static void vhost_user_scsi_event(void *opaque, QEMUChrEvent = event); >>>>>> + >>>>>> +static void vhost_user_scsi_disconnect(DeviceState *dev) >>>>>> +{ >>>>>> + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); >>>>>> + VHostUserSCSI *s =3D VHOST_USER_SCSI(vdev); >>>>>> + VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); >>>>>> + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>> + >>>>>=20 >>>>> I don=E2=80=99t think we want to execute vhost_scsi_common_stop() = if the device hasn=E2=80=99t been started. I remember that caused a = number of races with the vhost_user_blk connecting/disconnecting on = startup. >>>>>=20 >>>>> Let=E2=80=99s add a similar started_vu check? >>>> I will add it. >>>>>=20 >>>>>> + if (!s->connected) { >>>>>> + return; >>>>>> + } >>>>>> + s->connected =3D false; >>>>>> + >>>>>> + vhost_scsi_common_stop(vsc); >>>>>> + >>>>>> + vhost_dev_cleanup(&vsc->dev); >>>>>> + >>>>>> + /* Re-instate the event handler for new connections */ >>>>>> + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, >>>>>> + vhost_user_scsi_event, NULL, dev, = NULL, true); >>>>>> +} >>>>>> + >>>>>> +static void vhost_user_scsi_event(void *opaque, QEMUChrEvent = event) >>>>>> +{ >>>>>> + DeviceState *dev =3D opaque; >>>>>> + VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); >>>>>> + VHostUserSCSI *s =3D VHOST_USER_SCSI(vdev); >>>>>> + VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); >>>>>> + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>> + Error *local_err =3D NULL; >>>>>> + >>>>>> + switch (event) { >>>>>> + case CHR_EVENT_OPENED: >>>>>> + if (vhost_user_scsi_connect(dev, &local_err) < 0) { >>>>>> + error_report_err(local_err); >>>>>> + qemu_chr_fe_disconnect(&vs->conf.chardev); >>>>>> + return; >>>>>> + } >>>>>> + break; >>>>>> + case CHR_EVENT_CLOSED: >>>>>> + /* defer close until later to avoid circular close */ >>>>>> + vhost_user_async_close(dev, &vs->conf.chardev, = &vsc->dev, >>>>>> + vhost_user_scsi_disconnect); >>>>>> + break; >>>>>> + case CHR_EVENT_BREAK: >>>>>> + case CHR_EVENT_MUX_IN: >>>>>> + case CHR_EVENT_MUX_OUT: >>>>>> + /* Ignore */ >>>>>> + break; >>>>>> + } >>>>>> +} >>>>>> + >>>>>> +static int vhost_user_scsi_realize_connect(VHostUserSCSI *s, = Error **errp) >>>>>> +{ >>>>>> + DeviceState *dev =3D = &s->parent_obj.parent_obj.parent_obj.parent_obj; >>>>>> + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>> + int ret; >>>>>> + >>>>>> + s->connected =3D false; >>>>>> + >>>>>> + ret =3D qemu_chr_fe_wait_connected(&vs->conf.chardev, errp); >>>>>> + if (ret < 0) { >>>>>> + return ret; >>>>>> + } >>>>>> + >>>>>> + ret =3D vhost_user_scsi_connect(dev, errp); >>>>>> + if (ret < 0) { >>>>>> + qemu_chr_fe_disconnect(&vs->conf.chardev); >>>>>> + return ret; >>>>>> + } >>>>>> + assert(s->connected); >>>>>> + >>>>>> + return 0; >>>>>> +} >>>>>> + >>>>>> static void vhost_user_scsi_realize(DeviceState *dev, Error = **errp) >>>>>> { >>>>>> VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>> VHostUserSCSI *s =3D VHOST_USER_SCSI(dev); >>>>>> VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); >>>>>> - struct vhost_virtqueue *vqs =3D NULL; >>>>>> Error *err =3D NULL; >>>>>> int ret; >>>>>> + int retries =3D REALIZE_CONNECTION_RETRIES; >>>>>>=20 >>>>>> if (!vs->conf.chardev.chr) { >>>>>> error_setg(errp, "vhost-user-scsi: missing chardev"); >>>>>> @@ -112,21 +224,31 @@ static void = vhost_user_scsi_realize(DeviceState *dev, Error **errp) >>>>>> } >>>>>>=20 >>>>>> if (!vhost_user_init(&s->vhost_user, &vs->conf.chardev, errp)) { >>>>>=20 >>>>> Why execute vhost_user_cleanup() if vhost_user_init() fails? >>>> OK, move this line up in v2. >>>>=20 >>>>>=20 >>>>>> - goto free_virtio; >>>>>> + goto free_vhost; >>>>>> } >>>>>>=20 >>>>>> - vsc->dev.nvqs =3D VIRTIO_SCSI_VQ_NUM_FIXED + = vs->conf.num_queues; >>>>>> - vsc->dev.vqs =3D g_new0(struct vhost_virtqueue, = vsc->dev.nvqs); >>>>>> - vsc->dev.vq_index =3D 0; >>>>>> - vsc->dev.backend_features =3D 0; >>>>>> - vqs =3D vsc->dev.vqs; >>>>>> + vsc->inflight =3D g_new0(struct vhost_inflight, 1); >>>>>> + s->vhost_vqs =3D g_new0(struct vhost_virtqueue, >>>>>> + VIRTIO_SCSI_VQ_NUM_FIXED + = vs->conf.num_queues); >>>>>> + >>>>>> + assert(!*errp); >>>>>> + do { >>>>>> + if (*errp) { >>>>>> + error_prepend(errp, "Reconnecting after error: "); >>>>>> + error_report_err(*errp); >>>>>> + *errp =3D NULL; >>>>>> + } >>>>>> + ret =3D vhost_user_scsi_realize_connect(s, errp); >>>>>> + } while (ret < 0 && retries--); >>>>>>=20 >>>>>> - ret =3D vhost_dev_init(&vsc->dev, &s->vhost_user, >>>>>> - VHOST_BACKEND_TYPE_USER, 0, errp); >>>>>> if (ret < 0) { >>>>>> - goto free_vhost; >>>>>> + goto free_vqs; >>>>>> } >>>>>>=20 >>>>>> + /* we're fully initialized, now we can operate, so add the = handler */ >>>>>> + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, >>>>>> + vhost_user_scsi_event, NULL, (void = *)dev, >>>>>> + NULL, true); >>>>>> /* Channel and lun both are 0 for bootable vhost-user-scsi disk = */ >>>>>> vsc->channel =3D 0; >>>>>> vsc->lun =3D 0; >>>>>> @@ -134,10 +256,15 @@ static void = vhost_user_scsi_realize(DeviceState *dev, Error **errp) >>>>>>=20 >>>>>> return; >>>>>>=20 >>>>>> +free_vqs: >>>>>> + g_free(s->vhost_vqs); >>>>>> + s->vhost_vqs =3D NULL; >>>>>> + g_free(vsc->inflight); >>>>>> + vsc->inflight =3D NULL; >>>>>> + >>>>>> free_vhost: >>>>>> vhost_user_cleanup(&s->vhost_user); >>>>>> - g_free(vqs); >>>>>> -free_virtio: >>>>>> + >>>>>> virtio_scsi_common_unrealize(dev); >>>>>> } >>>>>>=20 >>>>>> @@ -146,16 +273,22 @@ static void = vhost_user_scsi_unrealize(DeviceState *dev) >>>>>> VirtIODevice *vdev =3D VIRTIO_DEVICE(dev); >>>>>> VHostUserSCSI *s =3D VHOST_USER_SCSI(dev); >>>>>> VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s); >>>>>> - struct vhost_virtqueue *vqs =3D vsc->dev.vqs; >>>>>> + VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev); >>>>>>=20 >>>>>> /* This will stop the vhost backend. */ >>>>>> vhost_user_scsi_set_status(vdev, 0); >>>>>> + qemu_chr_fe_set_handlers(&vs->conf.chardev, NULL, NULL, = NULL, NULL, NULL, >>>>>> + NULL, false); >>>>>>=20 >>>>>> vhost_dev_cleanup(&vsc->dev); >>>>>> - g_free(vqs); >>>>>=20 >>>>> Nit: Why not put vhost_dev_free_inflight next to the remaining = inflight cleanup? >>>> OK. >>>>>=20 >>>>>> + vhost_dev_free_inflight(vsc->inflight); >>>>>> + g_free(s->vhost_vqs); >>>>>> + s->vhost_vqs =3D NULL; >>>>>> + g_free(vsc->inflight); >>>>>> + vsc->inflight =3D NULL; >>>>>>=20 >>>>>=20 >>>>> Curiosity - why reorder here? Is something in vhost_user_cleanup() = dependent on state freed in virtio_scsi_common_unrealize()? >>>>>=20 >>>>> If so, should that go as a standalone fix? >>>>=20 >>>> Because in vhost_user_scsi_realize, we initialize in order: >>>> virtio_scsi_common_realize >>>> vhost_user_init >>>>=20 >>>> And in the error handler of vhost_user_scsi_realize, the = uninitialize in order: >>>> vhost_user_cleanup >>>> virtio_scsi_common_unrealize >>>>=20 >>>> I think in vhost_user_scsi_unrealize we should keep it the same = order, right? >>>=20 >>> I=E2=80=99m not saying it=E2=80=99s wrong. If there=E2=80=99s no = dependency (i.e. this is not fixing a bug, just a stylistic improvement) = it can stay in the same change. >> OK. >>>=20 >>>>=20 >>>>>=20 >>>>>> - virtio_scsi_common_unrealize(dev); >>>>>> vhost_user_cleanup(&s->vhost_user); >>>>>> + virtio_scsi_common_unrealize(dev); >>>>>> } >>>>>>=20 >>>>>> static Property vhost_user_scsi_properties[] =3D { >>>>>> diff --git a/include/hw/virtio/vhost-user-scsi.h = b/include/hw/virtio/vhost-user-scsi.h >>>>>> index 521b08e559..c66acc68b7 100644 >>>>>> --- a/include/hw/virtio/vhost-user-scsi.h >>>>>> +++ b/include/hw/virtio/vhost-user-scsi.h >>>>>> @@ -29,6 +29,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSCSI, = VHOST_USER_SCSI) >>>>>> struct VHostUserSCSI { >>>>>> VHostSCSICommon parent_obj; >>>>>> VhostUserState vhost_user; >>>>>=20 >>>>> See above - we should probably have started_vu here/ >>>> I will add it. >>>>>=20 >>>>> Maybe we should have some shared struct with vhost_user_blk for = connectivity params? >>>>=20 >>>> In the future vhost-user-blk/scsi can be refactored to share the = same code. >>>=20 >>> Sure - this can be done at some point in the future. >>>=20 >>>>>=20 >>>>>> + bool connected; >>>>>> + >>>>>> + struct vhost_virtqueue *vhost_vqs; >>>>>> }; >>>>>>=20 >>>>>> #endif /* VHOST_USER_SCSI_H */ >>>>>> diff --git a/include/hw/virtio/vhost.h = b/include/hw/virtio/vhost.h >>>>>> index 6a173cb9fa..b904346fe1 100644 >>>>>> --- a/include/hw/virtio/vhost.h >>>>>> +++ b/include/hw/virtio/vhost.h >>>>>> @@ -8,6 +8,8 @@ >>>>>> #define VHOST_F_DEVICE_IOTLB 63 >>>>>> #define VHOST_USER_F_PROTOCOL_FEATURES 30 >>>>>>=20 >>>>>=20 >>>>> Should the macro name indicate that this is for vhost-user? >>>>>=20 >>>>> VU_REALIZE_CONN_RETRIES?=20 >>>> I will rename it in v2. >>>>=20 >>>>>=20 >>>>>> +#define REALIZE_CONNECTION_RETRIES 3 >>>>>> + >>>>>> /* Generic structures common for any vhost based device. */ >>>>>>=20 >>>>>> struct vhost_inflight { >>>>>> --=20 >>>>>> 2.41.0 >>=20 >> Any comments about other patches? >=20 > I=E2=80=99ll send shortly. --Apple-Mail=_C7363ABD-8574-4088-9DAA-702D6DA28F8F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

2023=E5=B9=B47=E6=9C=8831=E6=97=A5 06:09=EF=BC=8CRaphae= l Norwitz <raphael.norwitz@nutanix.com> =E5=86=99=E9=81=93=EF=BC=9A<= /div>


On Jul 28, 2023, = at 3:48 AM, Li Feng <fengli@smartx.com> wrote:

Thanks for = your reply.

2023=E5=B9=B47=E6=9C=8828=E6=97= =A5 =E4=B8=8A=E5=8D=885:21=EF=BC=8CRaphael Norwitz = <raphael.norwitz@nutanix.com> =E5=86=99=E9=81=93=EF=BC=9A


On Jul 25, 2023, at 6:19 AM, Li Feng = <fengli@smartx.com> wrote:

Thanks for your = comments.

2023=E5=B9=B47=E6=9C=8825=E6=97= =A5 =E4=B8=8A=E5=8D=881:21=EF=BC=8CRaphael Norwitz = <raphael.norwitz@nutanix.com> =E5=86=99=E9=81=93=EF=BC=9A

Ver= y excited to see this. High level looks good modulo a few small = things.

My major concern is around existing vhost-user-scsi = backends which don=E2=80=99t support = VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD. IMO we should hide the reconnect = behavior behind a VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD check. We may = want to do the same for vhost-user-blk.

The question is then what = happens if the check is false. IIUC without an inflight FD, if a device = processes requests out of order, it=E2=80=99s not safe to continue = execution on reconnect, as there=E2=80=99s no way for the backend to = know how to replay IO. Should we permanently wedge the device or have = QEMU fail out? May be nice to have a toggle for = this.

Based on what MST said, is there anything else = I need to do?

I don=E2=80=99t think = so.


On Jul 21, 2023, at 6:51 AM, = Li Feng <fengli@smartx.com> wrote:

If the backend crashes = and restarts, the device is broken.
This patch adds reconnect for = vhost-user-scsi.

Tested with spdk backend.

Signed-off-by: = Li Feng <fengli@smartx.com>
---
hw/block/vhost-user-blk.c =           | =   2 -
hw/scsi/vhost-scsi-common.c =         |  27 = ++---
hw/scsi/vhost-user-scsi.c =           | 163 = +++++++++++++++++++++++++---
include/hw/virtio/vhost-user-scsi.h | =   3 +
include/hw/virtio/vhost.h =           | =   2 +
5 files changed, 165 insertions(+), 32 = deletions(-)

diff --git a/hw/block/vhost-user-blk.c = b/hw/block/vhost-user-blk.c
index eecf3f7a81..f250c740b5 = 100644
--- a/hw/block/vhost-user-blk.c
+++ = b/hw/block/vhost-user-blk.c
@@ -32,8 +32,6 @@
#include = "sysemu/sysemu.h"
#include "sysemu/runstate.h"

-#define = REALIZE_CONNECTION_RETRIES 3
-
static const int = user_feature_bits[] =3D = {
 VIRTIO_BLK_F_SIZE_MAX,
 VIRTIO_BLK_F_SEG_MAX,
diff = --git a/hw/scsi/vhost-scsi-common.c = b/hw/scsi/vhost-scsi-common.c

Why can=E2=80=99t all = the vhost-scsi-common stuff be moved to a separate = change?

I will move this code to separate = patch.

Especially the stuff introduced = for vhost-user-blk in 1b0063b3048af65dfaae6422a572c87db8575a92 should be = moved out.
OK.


index a06f01af26..08801886b8 = 100644
--- a/hw/scsi/vhost-scsi-common.c
+++ = b/hw/scsi/vhost-scsi-common.c
@@ -52,16 +52,22 @@ int = vhost_scsi_common_start(VHostSCSICommon = *vsc)

 vsc->dev.acked_features =3D = vdev->guest_features;

- =    assert(vsc->inflight =3D=3D NULL);
- =    vsc->inflight =3D g_new0(struct vhost_inflight, = 1);
-    ret =3D = vhost_dev_get_inflight(&vsc->dev,
- =             &n= bsp;           &nbs= p;       vs->conf.virtqueue_size,- =             &n= bsp;           &nbs= p;       vsc->inflight);
+ =    ret =3D vhost_dev_prepare_inflight(&vsc->dev, = vdev);
 if (ret < 0) {
- =        error_report("Error get = inflight: %d", -ret);
+ =        error_report("Error setting = inflight format: %d", -ret);
     goto = err_guest_notifiers;
 }

+    if = (!vsc->inflight->addr) {
+ =        ret =3D = vhost_dev_get_inflight(&vsc->dev,
+ =             &n= bsp;           &nbs= p;          vs->conf.= virtqueue_size,
+ =             &n= bsp;           &nbs= p;          vsc->infl= ight);
+        if (ret < 0) = {
+ =            error_re= port("Error get inflight: %d", -ret);
+ =            goto = err_guest_notifiers;
+ =        }
+ =    }
+
 ret =3D = vhost_dev_set_inflight(&vsc->dev, vsc->inflight);
 if = (ret < 0) {
     error_report("Error set = inflight: %d", -ret);
@@ -85,9 +91,6 @@ int = vhost_scsi_common_start(VHostSCSICommon *vsc)
 return = ret;

err_guest_notifiers:
- =    g_free(vsc->inflight);
- =    vsc->inflight =3D = NULL;
-
 k->set_guest_notifiers(qbus->parent, = vsc->dev.nvqs, = false);
err_host_notifiers:
 vhost_dev_disable_notifiers(&v= sc->dev, vdev);
@@ -111,12 +114,6 @@ void = vhost_scsi_common_stop(VHostSCSICommon = *vsc)
 }
 assert(ret >=3D = 0);


In the vhost-scsi (kernel backend) path, = what will cleanup vsc->inflight now?
OK, we should = check the vsc->inflight if it is null, the vhost-scsi doesn=E2=80=99t = allocate the
inflight object memory.

Are you = saying vhost-scsi never allocates inflight so we don=E2=80=99t need to = check for it?
We have checked the vsc->inflight, and = only if allocated, we send the get/set_inflight_fd.
This works with = vhost-user-scsi/vhost-scsi both.

So then = it sounds like this code introduces a resource leak. = g_free(vsc->inflight) should be added to the vhost-scsi code in = vhost_scsi_stop().

No, the = vhost-scsi doesn=E2=80=99t need =E2=80=98inflight', it doesn=E2=80=99t = allocate the inflight memory.

The rule is = =E2=80=98who allocates, who free it=E2=80=99.





-    if = (vsc->inflight) {
- =        vhost_dev_free_inflight(vsc->= inflight);
- =        g_free(vsc->inflight);
- =        vsc->inflight =3D = NULL;
- =    }
-
 vhost_dev_disable_notifiers(&vsc->= ;dev, vdev);
}

diff --git a/hw/scsi/vhost-user-scsi.c = b/hw/scsi/vhost-user-scsi.c
index ee99b19e7a..e0e88b0c42 = 100644
--- a/hw/scsi/vhost-user-scsi.c
+++ = b/hw/scsi/vhost-user-scsi.c
@@ -89,14 +89,126 @@ static void = vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue = *vq)
{
}

+static int vhost_user_scsi_connect(DeviceState = *dev, Error **errp)
+{
+    VirtIODevice *vdev =3D = VIRTIO_DEVICE(dev);
+    VHostUserSCSI *s =3D = VHOST_USER_SCSI(vdev);
+    VHostSCSICommon *vsc =3D = VHOST_SCSI_COMMON(s);
+    VirtIOSCSICommon *vs =3D = VIRTIO_SCSI_COMMON(dev);
+    int ret =3D 0;
+
+ =    if (s->connected) {
+ =        return 0;
+ =    }
+    s->connected =3D = true;
+
+    vsc->dev.num_queues =3D = vs->conf.num_queues;
+    vsc->dev.nvqs =3D = VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
+ =    vsc->dev.vqs =3D s->vhost_vqs;
+ =    vsc->dev.vq_index =3D 0;
+ =    vsc->dev.backend_features =3D 0;
+
+ =    ret =3D vhost_dev_init(&vsc->dev, = &s->vhost_user, VHOST_BACKEND_TYPE_USER, 0,
+ =             &n= bsp;           errp= );
+    if (ret < 0) {
+ =        return ret;
+ =    }
+
+    /* restore vhost state = */

Should this use virtio_device_should_start like = vhost_user_blk?
I will change this.

+    if = (virtio_device_started(vdev, vdev->status)) {
+ =        ret =3D = vhost_scsi_common_start(vsc);
+ =        if (ret < 0) {
+ =            return = ret;
+        }
+ =    }
+
+    return = 0;
+}
+
+static void vhost_user_scsi_event(void *opaque, = QEMUChrEvent event);
+
+static void = vhost_user_scsi_disconnect(DeviceState *dev)
+{
+ =    VirtIODevice *vdev =3D VIRTIO_DEVICE(dev);
+ =    VHostUserSCSI *s =3D VHOST_USER_SCSI(vdev);
+ =    VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(s);
+ =    VirtIOSCSICommon *vs =3D = VIRTIO_SCSI_COMMON(dev);
+

I don=E2=80=99t think = we want to execute vhost_scsi_common_stop() if the device hasn=E2=80=99t = been started. I remember that caused a number of races with the = vhost_user_blk connecting/disconnecting on startup.

Let=E2=80=99s = add a similar started_vu check?
I will add = it.

+ =    if (!s->connected) {
+ =        return;
+ =    }
+    s->connected =3D = false;
+
+ =    vhost_scsi_common_stop(vsc);
+
+ =    vhost_dev_cleanup(&vsc->dev);
+
+ =    /* Re-instate the event handler for new connections = */
+ =    qemu_chr_fe_set_handlers(&vs->conf.chardev, = NULL, NULL,
+ =             &n= bsp;           &nbs= p;   vhost_user_scsi_event, NULL, dev, NULL, = true);
+}
+
+static void vhost_user_scsi_event(void *opaque, = QEMUChrEvent event)
+{
+    DeviceState *dev =3D = opaque;
+    VirtIODevice *vdev =3D = VIRTIO_DEVICE(dev);
+    VHostUserSCSI *s =3D = VHOST_USER_SCSI(vdev);
+    VHostSCSICommon *vsc =3D = VHOST_SCSI_COMMON(s);
+    VirtIOSCSICommon *vs =3D = VIRTIO_SCSI_COMMON(dev);
+    Error *local_err =3D = NULL;
+
+    switch (event) {
+ =    case CHR_EVENT_OPENED:
+ =        if = (vhost_user_scsi_connect(dev, &local_err) < 0) {
+ =            error_re= port_err(local_err);
+ =            qemu_chr= _fe_disconnect(&vs->conf.chardev);
+ =            return;<= br>+        }
+ =        break;
+ =    case CHR_EVENT_CLOSED:
+ =        /* defer close until later to = avoid circular close */
+ =        vhost_user_async_close(dev, = &vs->conf.chardev, &vsc->dev,
+ =             &n= bsp;           &nbs= p;     vhost_user_scsi_disconnect);
+ =        break;
+ =    case CHR_EVENT_BREAK:
+    case = CHR_EVENT_MUX_IN:
+    case CHR_EVENT_MUX_OUT:
+ =        /* Ignore */
+ =        break;
+ =    }
+}
+
+static int = vhost_user_scsi_realize_connect(VHostUserSCSI *s, Error = **errp)
+{
+    DeviceState *dev =3D = &s->parent_obj.parent_obj.parent_obj.parent_obj;
+ =    VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(dev);
+ =    int ret;
+
+    s->connected =3D= false;
+
+    ret =3D = qemu_chr_fe_wait_connected(&vs->conf.chardev, errp);
+ =    if (ret < 0) {
+ =        return ret;
+ =    }
+
+    ret =3D = vhost_user_scsi_connect(dev, errp);
+    if (ret < = 0) {
+ =        qemu_chr_fe_disconnect(&vs-&= gt;conf.chardev);
+        return = ret;
+    }
+ =    assert(s->connected);
+
+ =    return 0;
+}
+
static void = vhost_user_scsi_realize(DeviceState *dev, Error = **errp)
{
 VirtIOSCSICommon *vs =3D = VIRTIO_SCSI_COMMON(dev);
 VHostUserSCSI *s =3D = VHOST_USER_SCSI(dev);
 VHostSCSICommon *vsc =3D = VHOST_SCSI_COMMON(s);
-    struct vhost_virtqueue *vqs = =3D NULL;
 Error *err =3D NULL;
 int ret;
+ =    int retries =3D = REALIZE_CONNECTION_RETRIES;

 if (!vs->conf.chardev.chr) = {
     error_setg(errp, "vhost-user-scsi: = missing chardev");
@@ -112,21 +224,31 @@ static void = vhost_user_scsi_realize(DeviceState *dev, Error = **errp)
 }

 if = (!vhost_user_init(&s->vhost_user, &vs->conf.chardev, = errp)) {

Why execute vhost_user_cleanup() if = vhost_user_init() fails?
OK, move this line up in = v2.


- =        goto free_virtio;
+ =        goto = free_vhost;
 }

-    vsc->dev.nvqs =3D = VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues;
- =    vsc->dev.vqs =3D g_new0(struct vhost_virtqueue, = vsc->dev.nvqs);
-    vsc->dev.vq_index =3D = 0;
-    vsc->dev.backend_features =3D 0;
- =    vqs =3D vsc->dev.vqs;
+ =    vsc->inflight =3D g_new0(struct vhost_inflight, = 1);
+    s->vhost_vqs =3D g_new0(struct = vhost_virtqueue,
+ =             &n= bsp;           &nbs= p;VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues);
+
+ =    assert(!*errp);
+    do {
+ =        if (*errp) {
+ =            error_pr= epend(errp, "Reconnecting after error: ");
+ =            error_re= port_err(*errp);
+ =            *errp = =3D NULL;
+        }
+ =        ret =3D = vhost_user_scsi_realize_connect(s, errp);
+    } while = (ret < 0 && retries--);

-    ret =3D = vhost_dev_init(&vsc->dev, &s->vhost_user,
- =             &n= bsp;           VHOS= T_BACKEND_TYPE_USER, 0, errp);
 if (ret < 0) {
- =        goto free_vhost;
+ =        goto = free_vqs;
 }

+    /* we're fully = initialized, now we can operate, so add the handler */
+ =    qemu_chr_fe_set_handlers(&vs->conf.chardev, =  NULL, NULL,
+ =             &n= bsp;           &nbs= p;   vhost_user_scsi_event, NULL, (void *)dev,
+ =             &n= bsp;           &nbs= p;   NULL, true);
 /* Channel and lun both are 0 = for bootable vhost-user-scsi disk */
 vsc->channel =3D = 0;
 vsc->lun =3D 0;
@@ -134,10 +256,15 @@ static void = vhost_user_scsi_realize(DeviceState *dev, Error = **errp)

 return;

+free_vqs:
+ =    g_free(s->vhost_vqs);
+ =    s->vhost_vqs =3D NULL;
+ =    g_free(vsc->inflight);
+ =    vsc->inflight =3D = NULL;
+
free_vhost:
 vhost_user_cleanup(&s->vhost_use= r);
- =    g_free(vqs);
-free_virtio:
+
 virtio_scsi_= common_unrealize(dev);
}

@@ -146,16 +273,22 @@ static void = vhost_user_scsi_unrealize(DeviceState *dev)
 VirtIODevice *vdev = =3D VIRTIO_DEVICE(dev);
 VHostUserSCSI *s =3D = VHOST_USER_SCSI(dev);
 VHostSCSICommon *vsc =3D = VHOST_SCSI_COMMON(s);
-    struct vhost_virtqueue *vqs = =3D vsc->dev.vqs;
+    VirtIOSCSICommon *vs =3D = VIRTIO_SCSI_COMMON(dev);

 /* This will stop the vhost = backend. */
 vhost_user_scsi_set_status(vdev, 0);
+ =    qemu_chr_fe_set_handlers(&vs->conf.chardev, = NULL, NULL, NULL, NULL, NULL,
+ =             &n= bsp;           &nbs= p;   NULL, = false);

 vhost_dev_cleanup(&vsc->dev);
- =    g_free(vqs);

Nit: Why not put = vhost_dev_free_inflight next to the remaining inflight = cleanup?
OK.

+ =    vhost_dev_free_inflight(vsc->inflight);
+ =    g_free(s->vhost_vqs);
+ =    s->vhost_vqs =3D NULL;
+ =    g_free(vsc->inflight);
+ =    vsc->inflight =3D = NULL;


Curiosity - why reorder here? Is something = in vhost_user_cleanup() dependent on state freed in = virtio_scsi_common_unrealize()?

If so, should that go as a = standalone fix?

Because in vhost_user_scsi_realize, = we initialize in = order:
virtio_scsi_common_realize
vhost_user_init

And in = the error handler of vhost_user_scsi_realize, the uninitialize in = order:
vhost_user_cleanup
virtio_scsi_common_unrealize

I = think in vhost_user_scsi_unrealize we should keep it the same order, = right?

I=E2=80=99m not saying it=E2=80=99s wrong. If = there=E2=80=99s no dependency (i.e. this is not fixing a bug, just a = stylistic improvement) it can stay in the same = change.
OK.



- =    virtio_scsi_common_unrealize(dev);
 vhost_user_c= leanup(&s->vhost_user);
+ =    virtio_scsi_common_unrealize(dev);
}

static = Property vhost_user_scsi_properties[] =3D {
diff --git = a/include/hw/virtio/vhost-user-scsi.h = b/include/hw/virtio/vhost-user-scsi.h
index 521b08e559..c66acc68b7 = 100644
--- a/include/hw/virtio/vhost-user-scsi.h
+++ = b/include/hw/virtio/vhost-user-scsi.h
@@ -29,6 +29,9 @@ = OBJECT_DECLARE_SIMPLE_TYPE(VHostUserSCSI, VHOST_USER_SCSI)
struct = VHostUserSCSI {
 VHostSCSICommon = parent_obj;
 VhostUserState vhost_user;

See = above - we should probably have started_vu here/
I will = add it.

Maybe we should have some = shared struct with vhost_user_blk for connectivity = params?

In the future vhost-user-blk/scsi can be = refactored to share the same code.

Sure - this can = be done at some point in the future.


+ =    bool connected;
+
+    struct = vhost_virtqueue *vhost_vqs;
};

#endif /* VHOST_USER_SCSI_H = */
diff --git a/include/hw/virtio/vhost.h = b/include/hw/virtio/vhost.h
index 6a173cb9fa..b904346fe1 = 100644
--- a/include/hw/virtio/vhost.h
+++ = b/include/hw/virtio/vhost.h
@@ -8,6 +8,8 @@
#define = VHOST_F_DEVICE_IOTLB 63
#define VHOST_USER_F_PROTOCOL_FEATURES = 30


Should the macro name indicate that this is = for vhost-user?

VU_REALIZE_CONN_RETRIES? 
I will = rename it in v2.


+#define REALIZE_CONNECTION_RETRIES 3
+
/* Generic = structures common for any vhost based device. */

struct = vhost_inflight {
-- 
2.41.0

Any comments about other = patches?

I=E2=80=99= ll send shortly.

= --Apple-Mail=_C7363ABD-8574-4088-9DAA-702D6DA28F8F--