[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory |
Date: |
Tue, 29 Jan 2019 22:14:56 -0500 |
On Wed, Jan 30, 2019 at 10:31:49AM +0800, Jason Wang wrote:
>
> On 2019/1/22 下午4:31, address@hidden 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.
>
> Thanks
>
WRITE_ONCE is literally volatile + dependency memory barrier.
So unless compiler is a very agressive one, it does not
buy you much.
--
MST
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, (continued)
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Michael S. Tsirkin, 2019/01/28
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Yongji Xie, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Michael S. Tsirkin, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Yongji Xie, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Michael S. Tsirkin, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Yongji Xie, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Michael S. Tsirkin, 2019/01/29
- Re: [Qemu-devel] [PATCH v5 1/6] vhost-user: Support transferring inflight buffer between qemu and backend, Yongji Xie, 2019/01/29
[Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory, elohimes, 2019/01/22
Re: [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory, Yongji Xie, 2019/01/30
Re: [Qemu-devel] [PATCH v5 3/6] libvhost-user: Support tracking inflight I/O in shared memory, Jason Wang, 2019/01/31
[Qemu-devel] [PATCH v5 5/6] vhost-user-blk: Add support to reconnect backend, elohimes, 2019/01/22
[Qemu-devel] [PATCH v5 6/6] contrib/vhost-user-blk: enable inflight I/O tracking, elohimes, 2019/01/22
Re: [Qemu-devel] [PATCH v5 0/6] vhost-user-blk: Add support for backend reconnecting, Jason Wang, 2019/01/29