* [PATCH] ringtest: Look at next descriptor before setting up event index
@ 2016-09-19 11:38 Paolo Bonzini
2016-10-03 22:48 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-09-19 11:38 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: mst
This avoids an expensive memory barrier if the next descriptor
is already there. The benefit is around 10%.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tools/virtio/ringtest/ring.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/virtio/ringtest/ring.c b/tools/virtio/ringtest/ring.c
index c25c8d248b6b..e617e20538bf 100644
--- a/tools/virtio/ringtest/ring.c
+++ b/tools/virtio/ringtest/ring.c
@@ -182,6 +182,9 @@ bool enable_call()
{
unsigned head = (ring_size - 1) & guest.last_used_idx;
+ if (!(ring[head].flags & DESC_HW))
+ return false;
+
event->call_index = guest.last_used_idx;
/* Flush call index write */
/* Barrier D (for pairing) */
@@ -215,6 +218,9 @@ bool enable_kick()
{
unsigned head = (ring_size - 1) & host.used_idx;
+ if (ring[head].flags & DESC_HW)
+ return false;
+
event->kick_index = host.used_idx;
/* Barrier C (for pairing) */
smp_mb();
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ringtest: Look at next descriptor before setting up event index
2016-09-19 11:38 [PATCH] ringtest: Look at next descriptor before setting up event index Paolo Bonzini
@ 2016-10-03 22:48 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-10-03 22:48 UTC (permalink / raw)
To: linux-kernel, kvm; +Cc: mst
On 19/09/2016 13:38, Paolo Bonzini wrote:
> This avoids an expensive memory barrier if the next descriptor
> is already there. The benefit is around 10%.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tools/virtio/ringtest/ring.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/tools/virtio/ringtest/ring.c b/tools/virtio/ringtest/ring.c
> index c25c8d248b6b..e617e20538bf 100644
> --- a/tools/virtio/ringtest/ring.c
> +++ b/tools/virtio/ringtest/ring.c
> @@ -182,6 +182,9 @@ bool enable_call()
> {
> unsigned head = (ring_size - 1) & guest.last_used_idx;
>
> + if (!(ring[head].flags & DESC_HW))
> + return false;
> +
> event->call_index = guest.last_used_idx;
> /* Flush call index write */
> /* Barrier D (for pairing) */
> @@ -215,6 +218,9 @@ bool enable_kick()
> {
> unsigned head = (ring_size - 1) & host.used_idx;
>
> + if (ring[head].flags & DESC_HW)
> + return false;
> +
> event->kick_index = host.used_idx;
> /* Barrier C (for pairing) */
> smp_mb();
>
Ping?
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-03 22:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-19 11:38 [PATCH] ringtest: Look at next descriptor before setting up event index Paolo Bonzini
2016-10-03 22:48 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).