[Spice-commits] 2 commits - server/red_worker.c

Gerd Hoffmann kraxel at kemper.freedesktop.org
Thu Apr 29 09:21:26 PDT 2010


 server/red_worker.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 7425253cec090e80cefd9390b3d34780b4bca899
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Mon Apr 19 21:38:53 2010 +0200

    iovec: add sanity check
    
    Adds sanity check to iovec setup.  In theory this should never ever
    trigger.  In practice guest driver bugs can make it trigger.  This
    patch avoids qemu burning cpu in a endless loop, instead we'll print a
    message and abort.  Not sure whenever there is a more graceful way to
    handle the situation ...

diff --git a/server/red_worker.c b/server/red_worker.c
index 5974f19..3cd9374 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -6698,7 +6698,7 @@ static inline uint32_t __fill_iovec(RedWorker *worker, BufDescriptor *buf, int s
 
 static inline void fill_iovec(RedChannel *channel, struct iovec *vec, int *vec_size)
 {
-    int vec_index = 0;
+    int rc, vec_index = 0;
     uint32_t pos = channel->send_data.pos;
 
     ASSERT(channel->send_data.size != pos && channel->send_data.size > pos);
@@ -6709,7 +6709,13 @@ static inline void fill_iovec(RedChannel *channel, struct iovec *vec, int *vec_s
 
         buf = find_buf(channel, pos, &buf_offset);
         ASSERT(buf);
-        pos += __fill_iovec(channel->worker, buf, buf_offset, vec, &vec_index);
+        rc = __fill_iovec(channel->worker, buf, buf_offset, vec, &vec_index);
+        if (rc == 0) {
+            fprintf(stderr, "%s: got only %d of %d bytes\n", __FUNCTION__, 
+                    pos, channel->send_data.size);
+            abort();
+        }
+        pos += rc;
     } while (vec_index < MAX_SEND_VEC && pos != channel->send_data.size);
     *vec_size = vec_index;
 }
commit ae8429d0c517f594c54660e58a8b3dc9e7d4f11c
Author: Gerd Hoffmann <kraxel at redhat.com>
Date:   Fri Apr 23 22:38:44 2010 +0200

    fix worker->stop surface cleanup

diff --git a/server/red_worker.c b/server/red_worker.c
index 68cf230..5974f19 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9282,7 +9282,7 @@ static void handle_dev_input(EventListener *listener, uint32_t events)
         worker->running = FALSE;
         red_display_clear_glz_drawables(worker->display_channel);
         for (x = 0; x < NUM_SURFACES; ++x) {
-            if (worker->surfaces->context.canvas) {
+            if (worker->surfaces[x].context.canvas) {
                 red_current_flush(worker, x);
             }
         }


More information about the Spice-commits mailing list