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] [day] [month] [year] [list]
Date:	Thu, 3 Nov 2011 15:45:32 +0900
From:	Minchan Kim <minchan.kim@...il.com>
To:	Christoph Hellwig <hch@...radead.org>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	Chris Wright <chrisw@...s-sol.org>,
	Jens Axboe <axboe@...nel.dk>,
	Stefan Hajnoczi <stefanha@...ux.vnet.ibm.com>,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] virtio: support unlocked queue kick

Hi Christoph,

On Wed, Oct 05, 2011 at 03:54:05PM -0400, Christoph Hellwig wrote:
> Split virtqueue_kick to be able to do the actual notification outside the
> lock protecting the virtqueue.  This patch was originally done by

Nitpick:

Until now, virtqueue_kick is called under lock, still so description
confuses me. It would be better to be [5/5].

> Stefan Hajnoczi, but I can't find the original one anymore and had to
> recreated it from memory.  Pointers to the original or corrections for
> the commit message are welcome.
> 
> Index: linux-2.6/drivers/virtio/virtio_ring.c
> ===================================================================
> --- linux-2.6.orig/drivers/virtio/virtio_ring.c	2011-09-15 15:28:55.891347016 +0200
> +++ linux-2.6/drivers/virtio/virtio_ring.c	2011-10-03 18:45:32.492738431 +0200
> @@ -237,9 +237,11 @@ add_head:
>  }
>  EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp);
>  
> -void virtqueue_kick(struct virtqueue *_vq)
> +bool virtqueue_kick_prepare(struct virtqueue *_vq)
>  {
>  	struct vring_virtqueue *vq = to_vvq(_vq);
> +	bool need_kick = false;
> +
>  	u16 new, old;
>  	START_USE(vq);
>  	/* Descriptors and available array need to be set before we expose the
> @@ -253,15 +255,32 @@ void virtqueue_kick(struct virtqueue *_v
>  	/* Need to update avail index before checking if we should notify */
>  	virtio_mb();
>  
> -	if (vq->event ?
> -	    vring_need_event(vring_avail_event(&vq->vring), new, old) :
> -	    !(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY))
> -		/* Prod other side to tell it about changes. */
> -		vq->notify(&vq->vq);
> -
> +	if (vq->event) {
> +		if (vring_need_event(vring_avail_event(&vq->vring), new, old))
> +			need_kick = true;
> +	} else {
> +		if (!(vq->vring.used->flags & VRING_USED_F_NO_NOTIFY))
> +			need_kick = true;
> +	}
>  	END_USE(vq);
> +	return need_kick;
> +}
> +EXPORT_SYMBOL_GPL(virtqueue_kick_prepare);
> +
> +void virtqueue_notify(struct virtqueue *_vq)
> +{
> +	struct vring_virtqueue *vq = to_vvq(_vq);
> +
> +	/* Prod other side to tell it about changes. */
> +	vq->notify(_vq);
> +}
> +EXPORT_SYMBOL_GPL(virtqueue_notify);
> +
> +void virtqueue_kick(struct virtqueue *vq)
> +{
> +	if (virtqueue_kick_prepare(vq))
> +		virtqueue_notify(vq);
>  }
> -EXPORT_SYMBOL_GPL(virtqueue_kick);

It should be exported for using other modules.

-- 
Kind regards,
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ