[SCSI] virtio-scsi: unlock during kick
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Jun 2012 14:56:31 +0000 (16:56 +0200)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 20 Jul 2012 07:58:57 +0000 (08:58 +0100)
Separate virtqueue_kick_prepare from virtqueue_notify, so that the
expensive vmexit is done without holding the lock.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/virtio_scsi.c

index 1b38431..b0ad5aa 100644 (file)
@@ -264,9 +264,11 @@ static int virtscsi_kick_cmd(struct virtio_scsi *vscsi, struct virtqueue *vq,
 
        ret = virtqueue_add_buf(vq, vscsi->sg, out_num, in_num, cmd, gfp);
        if (ret >= 0)
-               virtqueue_kick(vq);
+               ret = virtqueue_kick_prepare(vq);
 
        spin_unlock_irqrestore(&vscsi->vq_lock, flags);
+       if (ret > 0)
+               virtqueue_notify(vq);
        return ret;
 }