qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yongji Xie <elohimes@gmail.com>
To: Jason Wang <jasowang@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Coquelin, Maxime" <maxime.coquelin@redhat.com>,
	"Yury Kotov" <yury-kotov@yandex-team.ru>,
	"Евгений Яковлев" <wrfsh@yandex-team.ru>,
	nixun@baidu.com, qemu-devel <qemu-devel@nongnu.org>,
	lilin24@baidu.com, zhangyu31@baidu.com, chaiwen@baidu.com,
	"Xie Yongji" <xieyongji@baidu.com>
Subject: Re: [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory
Date: Wed, 30 Jan 2019 13:48:49 +0800	[thread overview]
Message-ID: <CAONzpcZ2fm11JdCA1aqaWTBjkHSagu5E_tquezJFGpWV4UT9fA@mail.gmail.com> (raw)
In-Reply-To: <09287313-0f6e-38a3-be36-9bf65bba7b9d@redhat.com>

On Wed, 30 Jan 2019 at 10:32, Jason Wang <jasowang@redhat.com> wrote:
>
>
> On 2019/1/22 下午4:31, elohimes@gmail.com wrote:
> > +static int
> > +vu_queue_inflight_get(VuDev *dev, VuVirtq *vq, int desc_idx)
> > +{
> > +    if (!has_feature(dev->protocol_features,
> > +        VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) {
> > +        return 0;
> > +    }
> > +
> > +    if (unlikely(!vq->inflight)) {
> > +        return -1;
> > +    }
> > +
> > +    vq->inflight->desc[desc_idx].inuse = 1;
> > +
> > +    vq->inflight->desc[desc_idx].avail_idx = vq->last_avail_idx;
> > +
> > +    return 0;
> > +}
> > +
> > +static int
> > +vu_queue_inflight_pre_put(VuDev *dev, VuVirtq *vq, int desc_idx)
> > +{
> > +    if (!has_feature(dev->protocol_features,
> > +        VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD)) {
> > +        return 0;
> > +    }
> > +
> > +    if (unlikely(!vq->inflight)) {
> > +        return -1;
> > +    }
> > +
> > +    vq->inflight->desc[desc_idx].used_idx = vq->used_idx;
> > +
> > +    barrier();
> > +
> > +    vq->inflight->desc[desc_idx].version++;
> > +
> > +    return 0;
> > +}
>
>
> You probably need WRITE_ONCE() semantic (e.g volatile) to make sure the
> value reach memory.
>

The cache line should have been flushed during crash. So we can see
the correct value when backend reconnecting. If so, compile barrier
should be enough here, right?

Thanks,
Yongji

  parent reply	other threads:[~2019-01-30  5:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22  8:31 [Qemu-devel] [PATCH v5 0/6] vhost-user-blk: Add support for backend reconnecting elohimes
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend elohimes
2019-01-29  4:11   ` Stefan Hajnoczi
2019-01-29  4:26     ` Michael S. Tsirkin
2019-01-29  6:15       ` Yongji Xie
2019-01-29 14:15         ` Michael S. Tsirkin
2019-01-30  2:07           ` Yongji Xie
2019-01-30  2:30             ` Michael S. Tsirkin
2019-01-30  3:49               ` Yongji Xie
2019-01-30  4:07                 ` Michael S. Tsirkin
2019-01-30  4:11                   ` Yongji Xie
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 2/6] libvhost-user: Introduce vu_queue_map_desc() elohimes
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory elohimes
2019-01-30  2:31   ` Jason Wang
2019-01-30  3:14     ` Michael S. Tsirkin
2019-01-30  9:52       ` Jason Wang
2019-01-30  3:58     ` Yongji Xie
2019-02-01  2:26       ` Jason Wang
2019-01-30  5:48     ` Yongji Xie [this message]
2019-02-01  2:27       ` Jason Wang
2019-02-05  1:37         ` Yongji Xie
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 4/6] vhost-user-blk: Add support to get/set inflight buffer elohimes
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 5/6] vhost-user-blk: Add support to reconnect backend elohimes
2019-01-22  8:31 ` [Qemu-devel] [PATCH v5 6/6] contrib/vhost-user-blk: enable inflight I/O tracking elohimes
2019-01-30  2:29 ` [Qemu-devel] [PATCH v5 0/6] vhost-user-blk: Add support for backend reconnecting Jason Wang
2019-01-30  3:40   ` Michael S. Tsirkin

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=CAONzpcZ2fm11JdCA1aqaWTBjkHSagu5E_tquezJFGpWV4UT9fA@mail.gmail.com \
    --to=elohimes@gmail.com \
    --cc=berrange@redhat.com \
    --cc=chaiwen@baidu.com \
    --cc=jasowang@redhat.com \
    --cc=lilin24@baidu.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=nixun@baidu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=wrfsh@yandex-team.ru \
    --cc=xieyongji@baidu.com \
    --cc=yury-kotov@yandex-team.ru \
    --cc=zhangyu31@baidu.com \
    /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).