qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/4] hw/qxl-render: drop cursor locks, add TODO'


From: Hans de Goede
Subject: Re: [Qemu-devel] [PATCH 4/4] hw/qxl-render: drop cursor locks, add TODO's.
Date: Wed, 16 Mar 2011 10:22:05 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101103 Fedora/1.0-0.33.b2pre.fc14 Lightning/1.0b2 Thunderbird/3.1.6

Hi,

As discussed on irc I think we need to look into this and see
if we can fix it properly while at it.

IOW to be continued...

Regards,

Hans


On 03/15/2011 09:17 PM, Alon Levy wrote:
Dropping the locks prevents a deadlock when running with -sdl or -vnc
in addition to -spice.

When server calls get_cursor_command, and we have an active ds
cursor related callback in non vga mode, we need to lock to prevent
the iothread (via sdl/vnc gui_update timer) from touching the ds as well.

Currently (-sdl/-vnc) + -spice seems to work, due to dropping the locking in
qxl-render.c:qxl_render_cursor, but this is just waiting to break because of
touching the cursor from two threads without any locking.
---
  hw/qxl-render.c |   13 +++++++++----
  1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/hw/qxl-render.c b/hw/qxl-render.c
index 58965e0..1065388 100644
--- a/hw/qxl-render.c
+++ b/hw/qxl-render.c
@@ -209,18 +209,23 @@ void qxl_render_cursor(PCIQXLDevice *qxl, QXLCommandExt 
*ext)
          if (c == NULL) {
              c = cursor_builtin_left_ptr();
          }
-        qemu_mutex_lock_iothread();
+        /* TODO: move this operation to iothread via pipe
+         * we can't use the global lock here without dropping it
+         * in gui_update (vl.c), or we get a dead lock (gui_update
+         * calls dispatcher, waiting on pipe read, and spice server calls
+         * this function, waiting on the lock that iothread is holding).
+         * But when used with sdl this calls sdl.c:sdl_mouse_define, which
+         * afaict must be locked or called from iothread. Moving to iothread
+         * seems easiest from correctness pov. */
          qxl->ssd.ds->cursor_define(c);
          qxl->ssd.ds->mouse_set(x, y, 1);
-        qemu_mutex_unlock_iothread();
          cursor_put(c);
          break;
      case QXL_CURSOR_MOVE:
          x = cmd->u.position.x;
          y = cmd->u.position.y;
-        qemu_mutex_lock_iothread();
+        /* TODO: move this operation to iothread via pipe. See comment above */
          qxl->ssd.ds->mouse_set(x, y, 1);
-        qemu_mutex_unlock_iothread();
          break;
      }
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]