Patchwork [53/60] hw/qxl: qxl_send_events: nop if stopped

login
register
mail settings
Submitter Michael Tokarev
Date Feb. 4, 2013, 10:41 a.m.
Message ID <1359974470-17044-54-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/217904/
State New
Headers show

Comments

Michael Tokarev - Feb. 4, 2013, 10:41 a.m.
From: Alon Levy <alevy@redhat.com>

Added a trace point for easy logging.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=870972

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 511aefb0c60e3063ead76d4ba6aabf619eed18ef)

Conflicts:
	hw/qxl.c
	trace-events

Cc: Doug Goldstein <cardoe@gentoo.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/qxl.c     |    8 +++++++-
 trace-events |    1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/qxl.c b/hw/qxl.c
index b971ac7..ed70e6b 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1514,7 +1514,13 @@  static void qxl_send_events(PCIQXLDevice *d, uint32_t events)
     uint32_t old_pending;
     uint32_t le_events = cpu_to_le32(events);
 
-    assert(d->ssd.running);
+    if (!d->ssd.running) {
+        /* spice-server tracks guest running state and should not do this */
+        fprintf(stderr, "%s: spice-server bug: guest stopped, ignoring\n",
+                __func__);
+        trace_qxl_send_events_vm_stopped(d->id, events);
+        return;
+    }
     old_pending = __sync_fetch_and_or(&d->ram->int_pending, le_events);
     if ((old_pending & le_events) == le_events) {
         return;
diff --git a/trace-events b/trace-events
index 45c6bc1..c22665f 100644
--- a/trace-events
+++ b/trace-events
@@ -799,6 +799,7 @@  qxl_spice_reset_memslots(int qid) "%d"
 qxl_spice_update_area(int qid, uint32_t surface_id, uint32_t left, uint32_t right, uint32_t top, uint32_t bottom) "%d sid=%d [%d,%d,%d,%d]"
 qxl_spice_update_area_rest(int qid, uint32_t num_dirty_rects, uint32_t clear_dirty_region) "%d #d=%d clear=%d"
 qxl_surfaces_dirty(int qid, int surface, int offset, int size) "%d surface=%d offset=%d size=%d"
+qxl_send_events_vm_stopped(int qid, uint32_t events) "%d %d"
 
 # hw/qxl-render.c
 qxl_render_blit_guest_primary_initialized(void) ""