mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: mst@redhat.com
Subject: Re: [PATCH] ringtest: Look at next descriptor before setting up event index
Date: Tue, 4 Oct 2016 00:48:15 +0200	[thread overview]
Message-ID: <4cf8d7ac-c34e-2cd3-c552-37daa41467c8@redhat.com> (raw)
In-Reply-To: <1474285139-11612-1-git-send-email-pbonzini@redhat.com>



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

      reply	other threads:[~2016-10-03 22:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 11:38 Paolo Bonzini
2016-10-03 22:48 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cf8d7ac-c34e-2cd3-c552-37daa41467c8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®