Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 3160499aacb81f6735941eb4c372d87a > files > 609

kvm-83-164.el5_5.30.src.rpm

From 18351f422531a8282c8efadee5f40202ee1d1d66 Mon Sep 17 00:00:00 2001
From: Yaniv Kamay <ykamay@redhat.com>
Date: Wed, 20 May 2009 14:51:09 +0300
Subject: [PATCH 1/4] qxl: fix message flood in qxl_display_update() #501190

Hi,

Attaching patch that fix BZ 501190.

Thanks,
Yaniv

>From a7677062b2897252bc961c8bf69ef656357a97b4 Mon Sep 17 00:00:00 2001
From: Yaniv Kamay <yaniv@redhat.com>
Date: Wed, 20 May 2009 14:39:51 +0300
Subject: [PATCH] qxl: fix message flood in qxl_display_update() #501190
Message-ID: <4A13EEAD.6070701@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
RH-Upstream-status: not-applicable
Acked-by: Izik Eidus <ieidus@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Acked-by: Arnon Gilboa <agilboa@redhat.com>
Bugzilla: 504237
---
 qemu/hw/qxl.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/qxl.c b/qemu/hw/qxl.c
index 0101cd0..cab0855 100644
--- a/qemu/hw/qxl.c
+++ b/qemu/hw/qxl.c
@@ -36,6 +36,10 @@
 #define TRUE 1
 #define FALSE 0
 
+#define WAIT_CMD_DELAY_MS 10 
+#define WAIT_CMD_MESSAGE_THRESHOLD 2
+#define WAIT_CMD_MESSAGE_INTERVAL_MS 5000
+
 #define QXL_DEV_NAME "qxl"
 #define VDI_PORT_DEV_NAME "vdi_port"
 
@@ -1143,6 +1147,7 @@ static void qxl_display_update(struct DisplayState *ds, int x, int y, int w, int
             QXLCommand *cmd;
             int wait;
             int notify;
+            int wait_count;
 
             drawable = (QXLDrawable *)malloc(sizeof(*drawable) + sizeof(*image));
             ASSERT(drawable);
@@ -1178,11 +1183,14 @@ static void qxl_display_update(struct DisplayState *ds, int x, int y, int w, int
             image->bitmap.palette = 0;
 
             ring = &client->state.vga_ring;
+            wait_count = -WAIT_CMD_MESSAGE_THRESHOLD;
             for (;;) {    
                 RING_PROD_WAIT(ring, wait);
                 if (wait) {
-                    printf("%s: wait\n", __FUNCTION__);
-                    usleep(10000);
+                    usleep(WAIT_CMD_DELAY_MS * 1000);
+                    if (!(wait_count++ % (WAIT_CMD_MESSAGE_INTERVAL_MS / WAIT_CMD_DELAY_MS))) {
+                        printf("%s: waiting for command\n", __FUNCTION__);
+                    }
                     continue;
                 }
                 break;
-- 
1.6.3.rc4.29.g8146