qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: [Qemu-devel] [PATCH] hw/qxl: warn on sync io usage
Date: Wed, 10 Oct 2012 18:18:45 +0200	[thread overview]
Message-ID: <1349885925-24216-1-git-send-email-alevy@redhat.com> (raw)

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

             reply	other threads:[~2012-10-10 16:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 16:18 Alon Levy [this message]
2012-10-11  6:53 ` [Qemu-devel] [PATCH] hw/qxl: warn on sync io usage Gerd Hoffmann
2012-10-11  7:40   ` Alon Levy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349885925-24216-1-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).