From 62e970ebd0b099e666fb1e1abcc265a5e070d490 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Fri, 29 Mar 2013 16:30:08 +0530 Subject: [PATCH] --- yaml --- r: 362089 b: refs/heads/master c: 9ba5c80b1aea8648a3efe5f22dc1f7cacdfbeeb8 h: refs/heads/master i: 362087: 6b4a404d9858b37588a32b79212d4a0097da0550 v: v3 --- [refs] | 2 +- trunk/drivers/char/virtio_console.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 58f861c6df29..d4385bd16f7d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 165b1b8bbc17c9469b053bab78b11b7cbce6d161 +refs/heads/master: 9ba5c80b1aea8648a3efe5f22dc1f7cacdfbeeb8 diff --git a/trunk/drivers/char/virtio_console.c b/trunk/drivers/char/virtio_console.c index 2dd9134faa27..ce5f3fc25d6d 100644 --- a/trunk/drivers/char/virtio_console.c +++ b/trunk/drivers/char/virtio_console.c @@ -150,6 +150,7 @@ struct ports_device { /* To protect the vq operations for the control channel */ spinlock_t c_ivq_lock; + spinlock_t c_ovq_lock; /* The current config space is stored here */ struct virtio_console_config config; @@ -569,11 +570,14 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, vq = portdev->c_ovq; sg_init_one(sg, &cpkt, sizeof(cpkt)); + + spin_lock(&portdev->c_ovq_lock); if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt, GFP_ATOMIC) == 0) { virtqueue_kick(vq); while (!virtqueue_get_buf(vq, &len)) cpu_relax(); } + spin_unlock(&portdev->c_ovq_lock); return 0; } @@ -1997,6 +2001,7 @@ static int virtcons_probe(struct virtio_device *vdev) unsigned int nr_added_bufs; spin_lock_init(&portdev->c_ivq_lock); + spin_lock_init(&portdev->c_ovq_lock); INIT_WORK(&portdev->control_work, &control_work_handler); nr_added_bufs = fill_queue(portdev->c_ivq,