qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/qxl: warn on sync io usage
@ 2012-10-10 16:18 Alon Levy
  2012-10-11  6:53 ` Gerd Hoffmann
  0 siblings, 1 reply; 3+ messages in thread
From: Alon Levy @ 2012-10-10 16:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: kraxel

Signed-off-by: Alon Levy <alevy@redhat.com>
---
Try to warn people who keep getting bitten by this. In addition maybe
we should bug out if revision >= 3 and sync io is used, and warn if revision <
3 is used in the first place?

 hw/qxl.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/hw/qxl.c b/hw/qxl.c
index 97ae22a..bd37a83 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1453,6 +1453,18 @@ static void qxl_set_mode(PCIQXLDevice *d, int modenr, int loadvm)
     qxl_rom_set_dirty(d);
 }
 
+static void sync_io_warning(PCIQXLDevice *qxl, uint32_t io_port)
+{
+    fprintf(stderr, "qxl-%d: WARNING: sync io used, see (RHBZ 747011)",
+            qxl->id);
+    fprintf(stderr, "qxl-%d: WARNING: virt-viewer/remote-viewer can hang\n",
+            qxl->id);
+    if (qxl->revision < 3) {
+        fprintf(stderr, "qxl-%d: WARNING: revision >= 3 should be used\n",
+                qxl->id);
+    }
+}
+
 static void ioport_write(void *opaque, target_phys_addr_t addr,
                          uint64_t val, unsigned size)
 {
@@ -1460,6 +1472,7 @@ static void ioport_write(void *opaque, target_phys_addr_t addr,
     uint32_t io_port = addr;
     qxl_async_io async = QXL_SYNC;
     uint32_t orig_io_port = io_port;
+    static int warned_sync_io;
 
     if (d->guest_bug && io_port != QXL_IO_RESET) {
         return;
@@ -1497,6 +1510,20 @@ static void ioport_write(void *opaque, target_phys_addr_t addr,
         return;
     }
 
+    if (!warned_sync_io) {
+        switch (io_port) {
+        case QXL_IO_UPDATE_AREA:
+        case QXL_IO_MEMSLOT_ADD:
+        case QXL_IO_CREATE_PRIMARY:
+        case QXL_IO_DESTROY_PRIMARY:
+        case QXL_IO_DESTROY_SURFACE_WAIT:
+        case QXL_IO_DESTROY_ALL_SURFACES:
+            sync_io_warning(d, io_port);
+            warned_sync_io = 1;
+            break;
+        }
+    }
+
     /* we change the io_port to avoid ifdeffery in the main switch */
     orig_io_port = io_port;
     switch (io_port) {
-- 
1.7.12.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-11  7:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 16:18 [Qemu-devel] [PATCH] hw/qxl: warn on sync io usage Alon Levy
2012-10-11  6:53 ` Gerd Hoffmann
2012-10-11  7:40   ` Alon Levy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).