Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f229a55c authored by Michael S. Tsirkin's avatar Michael S. Tsirkin
Browse files

virtio/ringtest: 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.

Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarCornelia Huck <cohuck@redhat.com>
Acked-by: default avatarJason Wang <jasowang@redhat.com>
parent 31919140
Loading
Loading
Loading
Loading
+15 −9
Original line number Original line Diff line number Diff line
@@ -188,15 +188,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 (!need_event(event->kick_index,
	need = need_event(event->kick_index,
			   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();
}
}


@@ -253,14 +255,18 @@ 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 (!need_event(event->call_index,

	need = need_event(event->call_index,
			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();
}
}