Unverified Commit f8dfc227 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10788 [OLK-5.10]sync some patch from upstream for Mini-OS

Merge Pull Request from: @chenyi211 
 
| commit id | commit msg                                    | conflict |
|-----------|-----------------------------------------------|----------|
| 22e1992c        | vhost: Add smp_rmb() in vhost_vq_avail_empty() |     NA     |
| df9ace76          | vhost: Add smp_rmb() in vhost_enable_notify() |  根据补丁适配        |
 
 
Link:https://gitee.com/openeuler/kernel/pulls/10788

 

Reviewed-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents e5c6b8c9 5ff81ed4
Loading
Loading
Loading
Loading
+23 −2
Original line number Diff line number Diff line
@@ -2533,9 +2533,19 @@ bool vhost_vq_avail_empty(struct vhost_dev *dev, struct vhost_virtqueue *vq)
	r = vhost_get_avail_idx(vq, &avail_idx);
	if (unlikely(r))
		return false;

	vq->avail_idx = vhost16_to_cpu(vq, avail_idx);
	if (vq->avail_idx != vq->last_avail_idx) {
		/* Since we have updated avail_idx, the following
		 * call to vhost_get_vq_desc() will read available
		 * ring entries. Make sure that read happens after
		 * the avail_idx read.
		 */
		smp_rmb();
		return false;
	}

	return vq->avail_idx == vq->last_avail_idx;
	return true;
}
EXPORT_SYMBOL_GPL(vhost_vq_avail_empty);

@@ -2573,7 +2583,18 @@ bool vhost_enable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
		return false;
	}

	return vhost16_to_cpu(vq, avail_idx) != vq->avail_idx;
	vq->avail_idx = vhost16_to_cpu(vq, avail_idx);
	if (vq->avail_idx != vq->last_avail_idx) {
		/* Since we have updated avail_idx, the following
		 * call to vhost_get_vq_desc() will read available
		 * ring entries. Make sure that read happens after
		 * the avail_idx read.
		 */
		smp_rmb();
		return true;
	}

	return false;
}
EXPORT_SYMBOL_GPL(vhost_enable_notify);