diff mbox

[2/3] kvm tools: Make virtio-console kvm__irq_line thread safe

Message ID 1304058985-13833-2-git-send-email-asias.hejun@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Asias He April 29, 2011, 6:36 a.m. UTC
Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/virtio-console.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Ingo Molnar April 29, 2011, 6:44 a.m. UTC | #1
* Asias He <asias.hejun@gmail.com> wrote:

> Signed-off-by: Asias He <asias.hejun@gmail.com>
> ---
>  tools/kvm/virtio-console.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/kvm/virtio-console.c b/tools/kvm/virtio-console.c
> index e66d198..492c859 100644
> --- a/tools/kvm/virtio-console.c
> +++ b/tools/kvm/virtio-console.c
> @@ -162,7 +162,9 @@ static void virtio_console_handle_callback(struct kvm *self, void *param)
>  		virt_queue__set_used_elem(vq, head, len);
>  	}
>  
> +	mutex_lock(&console_device.mutex);
>  	kvm__irq_line(self, VIRTIO_CONSOLE_IRQ, 1);
> +	mutex_unlock(&console_device.mutex);
>  }

This looks wrong for similar reasons as for virtio-blk.c.

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tools/kvm/virtio-console.c b/tools/kvm/virtio-console.c
index e66d198..492c859 100644
--- a/tools/kvm/virtio-console.c
+++ b/tools/kvm/virtio-console.c
@@ -162,7 +162,9 @@  static void virtio_console_handle_callback(struct kvm *self, void *param)
 		virt_queue__set_used_elem(vq, head, len);
 	}
 
+	mutex_lock(&console_device.mutex);
 	kvm__irq_line(self, VIRTIO_CONSOLE_IRQ, 1);
+	mutex_unlock(&console_device.mutex);
 }
 
 static bool virtio_console_pci_io_out(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)