This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] [PATCH] Paravirt framebuffer backend tools [2/5]

To: Jeremy Katz <katzj@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Paravirt framebuffer backend tools [2/5]
From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Date: Tue, 12 Sep 2006 19:55:36 +0100
Cc: aliguori <aliguori@xxxxxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Markus Armbruster <armbru@xxxxxxxxxx>
Delivery-date: Tue, 12 Sep 2006 11:56:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1157227102.11059.40.camel@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1157227102.11059.40.camel@xxxxxxxxxxxxxx>
Reply-to: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.1i
On Sat, Sep 02, 2006 at 03:58:22PM -0400, Jeremy Katz wrote:
> Initially from Anthony Liguori and then modified for
> * Integration with xenstore (armrbu)
> * Adding option parsing (katzj)
> * Integration with Xen makefiles 
> * Error handling (armbru)
> * Future-proof layout of shared page (armbru)
> * Memory barriers (armbru)
> * Support for vncunused and vnclisten as support in qemu-dm vnc (katzj)
> Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>
> Cc: Markus Armbruster <armbru@xxxxxxxxxx>
> Cc: Anthony Liguori <aliguori@xxxxxxxxxx>

I've been stress testing the xen-vncfb daemon and found some very nasty
problems. First of all the code in  LibVNCServer which deals with pthreads
condition variables is utterly broken. It passes unlocked mutexes into
pthread_cond_wait, and in some places also tries to lock the mutex just
after existing the wait call. The former leads to a race condition & missed
conditions, the latter completely deadlocks the daemon. To make matters
worse the library fails to check return values form pthread_* calls pretty
much everywhere. Carrying on, the code uses mutexes to synchronize changes
to the struct members in the client state structure, but then fails to do
any locking for reads, leading to yet more race conditions & death by 
SIGBUS in a number of places.

Basically LibVNCServer should be considered extremely harmful :-(

the QEMU VNC code for HVM guests doesn't use LibVNCServer, instead following
a more sane select() reactor model multiplexing all I/O in a single process.
I think it would be highly desirable to replace the LibVNCServer code with
Anthony's code from QEMU, because I don't have any confidence in running 
something based on LibVNCServer as an unprivileged daemon, let alone root.

FWIW, I'm attaching a patch to LibVNCServer which fixes as many of the
issues I've found so far as possible. If you want a stable xen-vncfb 
daemon then I recommend applying these before trying to test the VNC
bits of paravirt framebuffer.

   Signed-off by: Daniel berrange <berrange@xxxxxxxxxx>

|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

Attachment: xen-libvncserver-threads.patch
Description: Text document

Xen-devel mailing list