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 kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html