qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Alon Levy <alevy@redhat.com>
Cc: qemu-devel@nongnu.org
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	[thread overview]
Message-ID: <4D80813D.2010504@redhat.com> (raw)
In-Reply-To: <1300220228-27423-5-git-send-email-alevy@redhat.com>

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	other threads:[~2011-03-16  9:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-15 20:17 [Qemu-devel] [PATCH 0/4] qxl: implement vga mode without locks Alon Levy
2011-03-15 20:17 ` [Qemu-devel] [PATCH 1/4] qxl/spice-display: move pipe to ssd Alon Levy
2011-03-16  9:17   ` Hans de Goede
2011-03-15 20:17 ` [Qemu-devel] [PATCH 2/4] qxl: implement get_command in vga mode without locks Alon Levy
2011-03-16  9:18   ` Hans de Goede
2011-03-15 20:17 ` [Qemu-devel] [PATCH 3/4] qxl/spice: remove qemu_mutex_{un, }lock_iothread around dispatcher Alon Levy
2011-03-16  9:20   ` Hans de Goede
2011-03-15 20:17 ` [Qemu-devel] [PATCH 4/4] hw/qxl-render: drop cursor locks, add TODO's Alon Levy
2011-03-16  9:22   ` Hans de Goede [this message]

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=4D80813D.2010504@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alevy@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).