vhost: add smp_wmb() before logging used->ring
This doesn't really fix anything as rte_vhost logging functions are extremely poorly designed and do smp_wmb() by themselves - but only if logging is enabled... Let's move the barrier in our vhost.c. This doesn't change any behavior, but makes the code more readable. It surely looked weird to update the ring, log it, and then do smp_wmb(). Change-Id: I90827b14292b60bd5641a48d546e7249a0496a4b Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/398326 Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
da78c67091
commit
b2847368cc
@ -359,10 +359,11 @@ spdk_vhost_vq_used_ring_enqueue(struct spdk_vhost_dev *vdev, struct spdk_vhost_v
|
||||
vring->last_used_idx++;
|
||||
used->ring[last_idx].id = id;
|
||||
used->ring[last_idx].len = len;
|
||||
spdk_vhost_log_used_vring_elem(vdev, virtqueue, last_idx);
|
||||
|
||||
/* Ensure the used ring is updated before we increment used->idx. */
|
||||
/* Ensure the used ring is updated before we log it or increment used->idx. */
|
||||
spdk_smp_wmb();
|
||||
|
||||
spdk_vhost_log_used_vring_elem(vdev, virtqueue, last_idx);
|
||||
* (volatile uint16_t *) &used->idx = vring->last_used_idx;
|
||||
spdk_vhost_log_used_vring_idx(vdev, virtqueue);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user