Commit 2770c5ea authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell

virtio: console: Wake up outvq on host notifications

The outvq needs to be woken up on host notifications so that buffers
consumed by the host can be reclaimed, outvq freed, and application
writes may proceed again.

The need for this is now finally noticed when I have qemu patches ready
to use nonblocking IO and flow control.

CC: Hans de Goede <hdegoede@redhat.com>
CC: stable@kernel.org
Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
parent afe8a887
...@@ -1462,6 +1462,17 @@ static void control_work_handler(struct work_struct *work) ...@@ -1462,6 +1462,17 @@ static void control_work_handler(struct work_struct *work)
spin_unlock(&portdev->cvq_lock); spin_unlock(&portdev->cvq_lock);
} }
static void out_intr(struct virtqueue *vq)
{
struct port *port;
port = find_port_by_vq(vq->vdev->priv, vq);
if (!port)
return;
wake_up_interruptible(&port->waitqueue);
}
static void in_intr(struct virtqueue *vq) static void in_intr(struct virtqueue *vq)
{ {
struct port *port; struct port *port;
...@@ -1566,7 +1577,7 @@ static int init_vqs(struct ports_device *portdev) ...@@ -1566,7 +1577,7 @@ static int init_vqs(struct ports_device *portdev)
*/ */
j = 0; j = 0;
io_callbacks[j] = in_intr; io_callbacks[j] = in_intr;
io_callbacks[j + 1] = NULL; io_callbacks[j + 1] = out_intr;
io_names[j] = "input"; io_names[j] = "input";
io_names[j + 1] = "output"; io_names[j + 1] = "output";
j += 2; j += 2;
...@@ -1580,7 +1591,7 @@ static int init_vqs(struct ports_device *portdev) ...@@ -1580,7 +1591,7 @@ static int init_vqs(struct ports_device *portdev)
for (i = 1; i < nr_ports; i++) { for (i = 1; i < nr_ports; i++) {
j += 2; j += 2;
io_callbacks[j] = in_intr; io_callbacks[j] = in_intr;
io_callbacks[j + 1] = NULL; io_callbacks[j + 1] = out_intr;
io_names[j] = "input"; io_names[j] = "input";
io_names[j + 1] = "output"; io_names[j + 1] = "output";
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment