lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 26 Oct 2017 20:28:21 +0800
From:   Jason Wang <jasowang@...hat.com>
To:     "Michael S. Tsirkin" <mst@...hat.com>, linux-kernel@...r.kernel.org
Cc:     virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH] virtio/ringtest: fix up need_event math



On 2017年10月26日 09:48, Michael S. Tsirkin wrote:
> 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: Michael S. Tsirkin <mst@...hat.com>
> ---
>   tools/virtio/ringtest/ring.c | 24 +++++++++++++++---------
>   1 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/tools/virtio/ringtest/ring.c b/tools/virtio/ringtest/ring.c
> index 6b70c4e..d044a88 100644
> --- a/tools/virtio/ringtest/ring.c
> +++ b/tools/virtio/ringtest/ring.c
> @@ -196,16 +196,18 @@ bool enable_call()
>   
>   void kick_available(void)
>   {
> +	bool need;
> +
>   	/* Flush in previous flags write */
>   	/* Barrier C (for pairing) */
>   	smp_mb();
> -	if (!need_event(event->kick_index,
> -			guest.avail_idx,
> -			guest.kicked_avail_idx))
> -		return;
> +	need = need_event(event->kick_index,
> +			   guest.avail_idx,
> +			   guest.kicked_avail_idx);
>   
>   	guest.kicked_avail_idx = guest.avail_idx;
> -	kick();
> +	if (need)
> +		kick();
>   }
>   
>   /* host side */
> @@ -265,14 +267,18 @@ bool use_buf(unsigned *lenp, void **bufp)
>   
>   void call_used(void)
>   {
> +	bool need;
> +
>   	/* Flush in previous flags write */
>   	/* Barrier D (for pairing) */
>   	smp_mb();
> -	if (!need_event(event->call_index,
> +
> +	need = !need_event(event->call_index,
>   			host.used_idx,
> -			host.called_used_idx))
> -		return;
> +			host.called_used_idx);
>   
>   	host.called_used_idx = host.used_idx;
> -	call();
> +
> +	if (need)
> +		call();
>   }

Acked-by: Jason Wang <jasowang@...hat.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ