qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Li Feng <fengli@smartx.com>
To: Raphael Norwitz <raphael.norwitz@nutanix.com>
Cc: "Markus Armbruster" <armbru@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>,
	"Hanna Reitz" <hreitz@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Fam Zheng" <fam@euphon.net>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Viresh Kumar" <viresh.kumar@linaro.org>,
	"open list:Block layer core" <qemu-block@nongnu.org>,
	"open list:All patches CC here" <qemu-devel@nongnu.org>
Subject: Re: [PATCH v6 1/5] vhost-user-common: send get_inflight_fd once
Date: Sun, 8 Oct 2023 16:49:05 +0800	[thread overview]
Message-ID: <CAHckoCxb3kgF_2cc6kb05v24Jes107MixquB2fYxcKePiSvUzg@mail.gmail.com> (raw)
In-Reply-To: <D5AD3E2E-8C4B-4ADA-B054-B42E2B030808@nutanix.com>

On Fri, Sep 29, 2023 at 8:55 AM Raphael Norwitz
<raphael.norwitz@nutanix.com> wrote:
>
>
>
> > On Sep 22, 2023, at 7:46 AM, Li Feng <fengli@smartx.com> wrote:
> >
> > Currently the get_inflight_fd will be sent every time the device is started, and
> > the backend will allocate shared memory to save the inflight state. If the
> > backend finds that it receives the second get_inflight_fd, it will release the
> > previous shared memory, which breaks inflight working logic.
> >
> > This patch is a preparation for the following patches.
>
> This looks identical to the v3 patch I reviewed? If I’ve missed something can you please point it out?
Yes, nothing changed in this patch.

>
>
> > Signed-off-by: Li Feng <fengli@smartx.com>
> > ---
> > hw/scsi/vhost-scsi-common.c | 37 ++++++++++++++++++-------------------
> > 1 file changed, 18 insertions(+), 19 deletions(-)
> >
> > diff --git a/hw/scsi/vhost-scsi-common.c b/hw/scsi/vhost-scsi-common.c
> > index a06f01af26..a61cd0e907 100644
> > --- a/hw/scsi/vhost-scsi-common.c
> > +++ b/hw/scsi/vhost-scsi-common.c
> > @@ -52,20 +52,28 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
> >
> >     vsc->dev.acked_features = vdev->guest_features;
> >
> > -    assert(vsc->inflight == NULL);
> > -    vsc->inflight = g_new0(struct vhost_inflight, 1);
> > -    ret = vhost_dev_get_inflight(&vsc->dev,
> > -                                 vs->conf.virtqueue_size,
> > -                                 vsc->inflight);
> > +    ret = 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;
> >     }
> >
> > -    ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight);
> > -    if (ret < 0) {
> > -        error_report("Error set inflight: %d", -ret);
> > -        goto err_guest_notifiers;
> > +    if (vsc->inflight) {
> > +        if (!vsc->inflight->addr) {
> > +            ret = vhost_dev_get_inflight(&vsc->dev,
> > +                                        vs->conf.virtqueue_size,
> > +                                        vsc->inflight);
> > +            if (ret < 0) {
> > +                error_report("Error getting inflight: %d", -ret);
> > +                goto err_guest_notifiers;
> > +            }
> > +        }
> > +
> > +        ret = vhost_dev_set_inflight(&vsc->dev, vsc->inflight);
> > +        if (ret < 0) {
> > +            error_report("Error setting inflight: %d", -ret);
> > +            goto err_guest_notifiers;
> > +        }
> >     }
> >
> >     ret = vhost_dev_start(&vsc->dev, vdev, true);
> > @@ -85,9 +93,6 @@ int vhost_scsi_common_start(VHostSCSICommon *vsc)
> >     return ret;
> >
> > err_guest_notifiers:
> > -    g_free(vsc->inflight);
> > -    vsc->inflight = NULL;
> > -
> >     k->set_guest_notifiers(qbus->parent, vsc->dev.nvqs, false);
> > err_host_notifiers:
> >     vhost_dev_disable_notifiers(&vsc->dev, vdev);
> > @@ -111,12 +116,6 @@ void vhost_scsi_common_stop(VHostSCSICommon *vsc)
> >     }
> >     assert(ret >= 0);
> >
> > -    if (vsc->inflight) {
> > -        vhost_dev_free_inflight(vsc->inflight);
> > -        g_free(vsc->inflight);
> > -        vsc->inflight = NULL;
> > -    }
> > -
> >     vhost_dev_disable_notifiers(&vsc->dev, vdev);
> > }
> >
> > --
> > 2.41.0
> >
>


  reply	other threads:[~2023-10-08  8:51 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 10:51 [PATCH] vhost-user-scsi: support reconnect to backend Li Feng
2023-07-24 17:21 ` Raphael Norwitz
2023-07-24 20:30   ` Michael S. Tsirkin
2023-07-25 10:19   ` Li Feng
2023-07-27 21:21     ` Raphael Norwitz
2023-07-28  7:48       ` Li Feng
2023-07-30 22:09         ` Raphael Norwitz
2023-07-31 11:32           ` Li Feng
2023-07-25 10:42 ` [PATCH v2 0/4] Implement reconnect for vhost-user-scsi Li Feng
2023-07-25 10:42   ` [PATCH v2 1/4] vhost: fix the fd leak Li Feng
2023-07-30 22:09     ` Raphael Norwitz
2023-07-25 10:42   ` [PATCH v2 2/4] vhost-user-common: send get_inflight_fd once Li Feng
2023-07-28  6:04     ` Michael S. Tsirkin
2023-07-28  7:49       ` Li Feng
2023-07-30 22:13         ` Raphael Norwitz
2023-07-31 11:38           ` Li Feng
2023-07-31 23:11             ` Raphael Norwitz
2023-07-25 10:42   ` [PATCH v2 3/4] vhost: move and rename the conn retry times Li Feng
2023-07-30 22:13     ` Raphael Norwitz
2023-07-25 10:42   ` [PATCH v2 4/4] vhost-user-scsi: support reconnect to backend Li Feng
2023-07-25 10:58     ` Li Feng
2023-07-30 22:14     ` Raphael Norwitz
2023-07-31 10:24       ` Li Feng
2023-07-31 12:10 ` [PATCH v3 0/5] Implement reconnect for vhost-user-scsi Li Feng
2023-07-31 12:10   ` [PATCH v3 1/5] vhost: fix the fd leak Li Feng
2023-08-03 13:41     ` Fiona Ebner
2023-07-31 12:10   ` [PATCH v3 2/5] vhost-user-common: send get_inflight_fd once Li Feng
2023-07-31 23:34     ` Raphael Norwitz
2023-07-31 12:10   ` [PATCH v3 3/5] vhost: move and rename the conn retry times Li Feng
2023-07-31 12:10   ` [PATCH v3 4/5] vhost-user-scsi: support reconnect to backend Li Feng
2023-07-31 23:35     ` Raphael Norwitz
2023-09-01 12:00     ` Markus Armbruster
2023-09-12  8:29       ` Li Feng
2023-07-31 12:10   ` [PATCH v3 5/5] vhost-user-scsi: start vhost when guest kicks Li Feng
2023-07-31 23:35     ` Raphael Norwitz
2023-09-01 11:44     ` Markus Armbruster
2023-09-12  7:53       ` Li Feng
2023-09-12  8:52 ` [PATCH v4 0/5] Implement reconnect for vhost-user-scsi Li Feng
2023-09-12  8:52   ` [PATCH v4 1/5] vhost-user-common: send get_inflight_fd once Li Feng
2023-09-12  8:52   ` [PATCH v4 2/5] vhost: move and rename the conn retry times Li Feng
2023-09-12  8:52   ` [PATCH v4 3/5] vhost-user-scsi: support reconnect to backend Li Feng
2023-09-12  8:52   ` [PATCH v4 4/5] vhost-user-scsi: start vhost when guest kicks Li Feng
2023-09-12  8:52   ` [PATCH v4 5/5] vhost-user: fix lost reconnect Li Feng
2023-09-19 11:40 ` [PATCH v5 0/5] Implement reconnect for vhost-user-scsi Li Feng
2023-09-19 11:40   ` [PATCH v5 1/5] vhost-user-common: send get_inflight_fd once Li Feng
2023-09-19 11:40   ` [PATCH v5 2/5] vhost: move and rename the conn retry times Li Feng
2023-09-19 11:40   ` [PATCH v5 3/5] vhost-user-scsi: support reconnect to backend Li Feng
2023-09-19 11:40   ` [PATCH v5 4/5] vhost-user-scsi: start vhost when guest kicks Li Feng
2023-09-19 11:40   ` [PATCH v5 5/5] vhost-user: fix lost reconnect Li Feng
2023-09-22 11:46 ` [PATCH v6 0/5] Implement reconnect for vhost-user-scsi Li Feng
2023-09-22 11:46   ` [PATCH v6 1/5] vhost-user-common: send get_inflight_fd once Li Feng
2023-09-29  0:54     ` Raphael Norwitz
2023-10-08  8:49       ` Li Feng [this message]
2023-10-08  8:50         ` Michael S. Tsirkin
2023-10-08  8:53           ` Li Feng
2023-09-22 11:46   ` [PATCH v6 2/5] vhost: move and rename the conn retry times Li Feng
2023-09-22 11:46   ` [PATCH v6 3/5] vhost-user-scsi: support reconnect to backend Li Feng
2023-09-29  0:55     ` Raphael Norwitz
2023-10-08  8:45       ` Li Feng
2023-09-22 11:46   ` [PATCH v6 4/5] vhost-user-scsi: start vhost when guest kicks Li Feng
2023-09-29  0:55     ` Raphael Norwitz
2023-09-22 11:46   ` [PATCH v6 5/5] vhost-user: fix lost reconnect Li Feng
2023-09-29  0:55     ` Raphael Norwitz
2023-09-29  0:55     ` Raphael Norwitz
2023-10-08  8:49   ` [PATCH v6 0/5] Implement reconnect for vhost-user-scsi Michael S. Tsirkin
2023-10-08  8:53     ` Li Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHckoCxb3kgF_2cc6kb05v24Jes107MixquB2fYxcKePiSvUzg@mail.gmail.com \
    --to=fengli@smartx.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=raphael.norwitz@nutanix.com \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).