qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 8/9] spice: simple display
Date: Thu, 19 Aug 2010 18:05:21 +0200	[thread overview]
Message-ID: <4C6D5641.8080004@redhat.com> (raw)
In-Reply-To: <4C6D4221.8080504@codemonkey.ws>

   Hi,

>> + pthread_mutex_lock(&ssd->lock);
>
> The locking worries me here.
>
> It only makes sense if the spice interface_* callbacks can be invoked
> from threads independently of any of the QEMU threads.
>
> If that's the case, that means that the interface_* code is potentially
> running in parallel to another QEMU thread that's holding the qemu_mutex.

Yes, interface_* code can be called back from spice server thread context.

> So just acquiring a private lock in the interface_* code and then
> calling into common QEMU code could result in re-entrance in interfaces
> that aren't re-entrant.

I think there are no such calls.

> While not really unsafe, the qemu_malloc functions are not guaranteed to
> be re-entrant by the interfaces today. It's also terribly subtle to have
> to rely on implicit re-entrance safety.

The underlying malloc() is re-entrant, isn't it?
pflib (which is called too) is re-entrant too.
Otherwise only private data is accessed (under lock when needed).

> So in the very least, any function that gets touched by something not
> carrying the qemu_mutex needs to have a comment in the definition and
> declaration that the functions are required to be re-entrant. Also, the
> spice-display code would benefit from clearly stating where you were
> holding the qemu_mutex and where you weren't.

Yep.

>> +#ifdef CONFIG_SPICE
>> + if (using_spice) {
>> + qemu_spice_display_init(ds);
>> + }
>> +#endif
>
> Having spice as an independent interface to the current display_type
> switching seems awkward to me.

Having remote desktop protocols as DT_something seems awkward to me.  It 
makes sense for the local display (being none, curses, sdl, fbdev, 
whatever).  For remote display protocols I see no reason why we 
shouldn't have multiple of them enabled at the same time, so the user 
can connect with whatever he wants.  And that even in parallel to a 
local display if needed.

The state the patch introduces is a bit inconsistent though.  But I'd 
rather drop DT_VNC instead of adding DT_SPICE.

cheers,
   Gerd

  parent reply	other threads:[~2010-08-19 16:05 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-19 12:40 [Qemu-devel] [PATCH 0/9] initial spice support Gerd Hoffmann
2010-08-19 12:40 ` [Qemu-devel] [PATCH 1/9] add pflib: PixelFormat conversion library Gerd Hoffmann
2010-08-19 14:04   ` Anthony Liguori
2010-08-19 15:34     ` Gerd Hoffmann
2010-08-19 19:09       ` Anthony Liguori
2010-08-20 10:38         ` Gerd Hoffmann
2010-08-19 12:40 ` [Qemu-devel] [PATCH 2/9] configure: add logging Gerd Hoffmann
2010-08-19 14:05   ` Anthony Liguori
2010-08-19 15:44     ` Gerd Hoffmann
2010-08-19 12:40 ` [Qemu-devel] [PATCH 3/9] add spice into the configure file Gerd Hoffmann
2010-08-19 14:06   ` Anthony Liguori
2010-08-19 12:40 ` [Qemu-devel] [PATCH 4/9] configure: require spice 0.5.3 Gerd Hoffmann
2010-08-19 12:40 ` [Qemu-devel] [PATCH 5/9] spice: core bits Gerd Hoffmann
2010-08-19 14:19   ` Anthony Liguori
2010-08-20 11:54     ` Gerd Hoffmann
2010-08-25 12:37     ` Gerd Hoffmann
2010-08-19 12:40 ` [Qemu-devel] [PATCH 6/9] spice: add keyboard Gerd Hoffmann
2010-08-19 14:24   ` Anthony Liguori
2010-08-20 12:34     ` Gerd Hoffmann
2010-08-20 13:18       ` Anthony Liguori
2010-08-20 13:56         ` Gerd Hoffmann
2010-08-20 14:15           ` Daniel P. Berrange
2010-08-20 14:49             ` Gerd Hoffmann
2010-08-20 15:01               ` Daniel P. Berrange
2010-08-19 12:40 ` [Qemu-devel] [PATCH 7/9] spice: add mouse Gerd Hoffmann
2010-08-19 14:25   ` Anthony Liguori
2010-08-20 12:42     ` Gerd Hoffmann
2010-08-20 13:19       ` Anthony Liguori
2010-08-20 14:03         ` Gerd Hoffmann
2010-08-20 14:37           ` Anthony Liguori
2010-08-19 12:40 ` [Qemu-devel] [PATCH 8/9] spice: simple display Gerd Hoffmann
2010-08-19 14:39   ` Anthony Liguori
2010-08-19 15:23     ` malc
2010-08-19 15:34       ` Anthony Liguori
2010-08-19 15:36         ` malc
2010-08-19 19:03           ` Anthony Liguori
2010-08-19 19:10             ` malc
2010-08-19 15:40         ` Alexander Graf
2010-08-25 11:09           ` Gerd Hoffmann
2010-08-19 16:05     ` Gerd Hoffmann [this message]
2010-08-19 19:00       ` Anthony Liguori
2010-08-19 12:40 ` [Qemu-devel] [PATCH 9/9] spice: add tablet support Gerd Hoffmann
2010-08-19 14:40   ` Anthony Liguori

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=4C6D5641.8080004@redhat.com \
    --to=kraxel@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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).