提交 a311650a 编写于 作者: M Michael S. Tsirkin

virtio/ringtest: virtio_ring: fix up need_event math

last kicked event index must be updated unconditionally:
even if we don't need to kick, we do not want to re-check
the same entry for events.
Reported-by: NCornelia Huck <cohuck@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: NJens Freimann <jfreimann@redhat.com>
上级 f229a55c
...@@ -225,15 +225,17 @@ bool enable_call() ...@@ -225,15 +225,17 @@ bool enable_call()
void kick_available(void) void kick_available(void)
{ {
bool need;
/* Flush in previous flags write */ /* Flush in previous flags write */
/* Barrier C (for pairing) */ /* Barrier C (for pairing) */
smp_mb(); smp_mb();
if (!vring_need_event(vring_avail_event(&ring), need = vring_need_event(vring_avail_event(&ring),
guest.avail_idx, guest.avail_idx,
guest.kicked_avail_idx)) guest.kicked_avail_idx);
return;
guest.kicked_avail_idx = guest.avail_idx; guest.kicked_avail_idx = guest.avail_idx;
if (need)
kick(); kick();
} }
...@@ -316,14 +318,16 @@ bool use_buf(unsigned *lenp, void **bufp) ...@@ -316,14 +318,16 @@ bool use_buf(unsigned *lenp, void **bufp)
void call_used(void) void call_used(void)
{ {
bool need;
/* Flush in previous flags write */ /* Flush in previous flags write */
/* Barrier D (for pairing) */ /* Barrier D (for pairing) */
smp_mb(); smp_mb();
if (!vring_need_event(vring_used_event(&ring), need = vring_need_event(vring_used_event(&ring),
host.used_idx, host.used_idx,
host.called_used_idx)) host.called_used_idx);
return;
host.called_used_idx = host.used_idx; host.called_used_idx = host.used_idx;
if (need)
call(); call();
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册