|
From: | Jason Wang |
Subject: | Re: [Qemu-devel] [PATCH 3/8] virtio: add empty check for packed ring |
Date: | Mon, 4 Jun 2018 16:32:49 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 2018年06月04日 01:44, Wei Xu wrote:
+static int virtio_queue_empty_packed_rcu(VirtQueue *vq) +{ + struct VRingDescPacked desc; + VRingMemoryRegionCaches *cache; + + if (unlikely(!vq->packed.desc)) { + return 1; + } + + cache = vring_get_region_caches(vq); + vring_desc_read_packed(vq->vdev, &desc, &cache->desc_packed, vq->last_avail_idx); + + /* Make sure we see the updated flag */ + smp_mb();What we need here is to make sure flag is read before all other fields, looks like this barrier can't.Isn't flag updated yet if it has been read?
Consider the case of event index, you need make sure flag is read before off_wrap.
Thanks
[Prev in Thread] | Current Thread | [Next in Thread] |