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


Reply via email to