Re: [PATCH v2 3/7] vhost: refactor virtio_dev_merge_rx
From: Xie, Huawei <hidden>
Date: 2016-03-07 07:16:42
On 3/7/2016 3:04 PM, Xie, Huawei wrote:
On 3/7/2016 2:49 PM, Yuanhan Liu wrote:quoted
On Mon, Mar 07, 2016 at 06:38:42AM +0000, Xie, Huawei wrote:quoted
On 3/7/2016 2:35 PM, Yuanhan Liu wrote:quoted
On Mon, Mar 07, 2016 at 06:22:25AM +0000, Xie, Huawei wrote:quoted
On 2/18/2016 9:48 PM, Yuanhan Liu wrote:quoted
+ uint16_t idx = vq->avail->ring[avail_idx & (vq->size - 1)]; + uint32_t vec_id = *vec_idx; + uint32_t len = *allocated;There is bug not using volatile to retrieve the avail idx.avail_idx? This is actually from "vq->last_used_idx_res".uint16_t idx = vq->avail->ring[avail_idx & (vq->size - 1)] the idx retrieved from avail->ring.Hmm.. I saw quite many similar lines of code retrieving an index from avail->ring, but none of them acutally use "volatile". So, a bug?Others are not. This function is inline, and is in one translation unit with its caller.
Oh, my fault. For the avail idx, we should take care on whether using volatile.
quoted
--yliu