[3.16.y-ckt stable] Patch "virtio_console: avoid config access from irq" has been added to staging queue

Luis Henriques luis.henriques at canonical.com
Mon Mar 30 13:00:06 UTC 2015

This is a note to let you know that I have just added a patch titled

    virtio_console: avoid config access from irq

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:


This patch is scheduled to be released in version 3.16.7-ckt10.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see



>From a6d7f66d9863998cdc240c5b89f524e6436b6238 Mon Sep 17 00:00:00 2001
From: "Michael S. Tsirkin" <mst at redhat.com>
Date: Thu, 5 Mar 2015 10:45:49 +1030
Subject: virtio_console: avoid config access from irq

commit eeb8a7e8bb123e84daeef84f5a2eab99ad2839a2 upstream.

when multiport is off, virtio console invokes config access from irq
context, config access is blocking on s390.
Fix this up by scheduling work from config irq - similar to what we do
for multiport configs.

Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
Reviewed-by: Amit Shah <amit.shah at redhat.com>
Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 drivers/char/virtio_console.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 5f6dce6c20fb..73294b270b93 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -142,6 +142,7 @@ struct ports_device {
 	 * notification
 	struct work_struct control_work;
+	struct work_struct config_work;

 	struct list_head ports;

@@ -1832,10 +1833,21 @@ static void config_intr(struct virtio_device *vdev)

 	portdev = vdev->priv;

+	if (!use_multiport(portdev))
+		schedule_work(&portdev->config_work);
+static void config_work_handler(struct work_struct *work)
+	struct ports_device *portdev;
+	portdev = container_of(work, struct ports_device, control_work);
 	if (!use_multiport(portdev)) {
+		struct virtio_device *vdev;
 		struct port *port;
 		u16 rows, cols;

+		vdev = portdev->vdev;
 		virtio_cread(vdev, struct virtio_console_config, cols, &cols);
 		virtio_cread(vdev, struct virtio_console_config, rows, &rows);

@@ -2024,6 +2036,7 @@ static int virtcons_probe(struct virtio_device *vdev)

+	INIT_WORK(&portdev->config_work, &config_work_handler);
 	INIT_WORK(&portdev->control_work, &control_work_handler);

 	if (multiport) {
@@ -2098,6 +2111,8 @@ static void virtcons_remove(struct virtio_device *vdev)
 	/* Finish up work that's lined up */
 	if (use_multiport(portdev))
+	else
+		cancel_work_sync(&portdev->config_work);

 	list_for_each_entry_safe(port, port2, &portdev->ports, list)
@@ -2149,6 +2164,7 @@ static int virtcons_freeze(struct virtio_device *vdev)

+	cancel_work_sync(&portdev->config_work);
 	 * Once more: if control_work_handler() was running, it would
 	 * enable the cb as the last step.

More information about the kernel-team mailing list