Re: [PATCH 3/3] kvm tools: Make virtio-blk kvm__irq_line thread safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Asias He <asias.hejun@xxxxxxxxx> wrote:

> Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
> ---
>  tools/kvm/virtio-blk.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/kvm/virtio-blk.c b/tools/kvm/virtio-blk.c
> index 3feabd0..ade6335 100644
> --- a/tools/kvm/virtio-blk.c
> +++ b/tools/kvm/virtio-blk.c
> @@ -159,7 +159,9 @@ static void virtio_blk_do_io(struct kvm *kvm, void *param)
>  	while (virt_queue__available(vq))
>  		virtio_blk_do_io_request(kvm, vq);
>  
> +	mutex_lock(&blk_device.mutex);
>  	kvm__irq_line(kvm, VIRTIO_BLK_IRQ, 1);
> +	mutex_unlock(&blk_device.mutex);

Hm, this looks a bit strange (the mutex here protects only a kernel call - that 
cannot be right) and there's no explanation why it's needed. Why do 
VIRTIO_BLK_IRQ (== KVM_IRQ_LINE ioctl()) calls have to be covered by the mutex?

A short blurb about expected behavior on SMP and locking rules at the top of 
virtio-blk.c would be nice.

Thanks,

	Ingo
--
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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux