qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] VNC display support for QEMU
Date: Sun, 30 Apr 2006 15:14:02 -0500	[thread overview]
Message-ID: <44551A8A.9090802@codemonkey.ws> (raw)
In-Reply-To: <Pine.LNX.4.63.0604301240360.21624@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin wrote:
> Hi,
>
> On Sat, 29 Apr 2006, Anthony Liguori wrote:
>
>   
>> I would have been more inclined to use LibVNCServer if it wasn't based 
>> on threading.  I really wanted an asynchronous implementation of a VNC 
>> server that didn't depend on threads.
>>     
>
> AFAICT it does not. In vnc_refresh(), there is a call to rfbProcessEvents, 
> which says to select() the socket(s) for 0 microseconds. Same thread.
>   

There is a fundamental design in the LibVNCServer code (which I believe 
was inherited from the various RealVNC derivatives) that all IO is done 
through some derivation of rfbReadExact.  rfbReadExact is semantically 
synchronous (it uses select to enforce that).

You could, perhaps, not begin an iteration of the server message process 
loop until the socket becomes readable but that only gives you a 
semi-asynchronous interface.  As soon as you get 1 byte of message data, 
you are now handling things synchronously until that message is complete.

Since QEMU is single threaded, this means everything blocks (including 
progress of the guest).  This theoretical problem is why I implemented a 
true asynchronous VNC implementation.  You'll notice that I use a state 
machine to handle the message dispatch (which is practical for the 
server side of the VNC protocol at least).  My VNC will never (assuming 
it's working correctly :-)) block guest progress because of outstanding IO.

There is a practical problem too with a semi-asynchronous approach.  
It's entirely possible to get serious congestion in odd places during a 
message transmission (or even a loss that requires timeout).  This means 
you could end up blocking the guest for a prolonged period of time (and 
if the guest is doing serious work--like hosting some sort of network 
service--this is catastrophic).

So, in a multithreaded application or a single-threaded application that 
doesn't have to worry about these things, LibVNCServer is a great 
solution.  I just don't think it's the right solution for QEMU for the 
reasons outlined above.

Regards,

Anthony Liguori

> Now, there is a facility in LibVNCServer to take advantage of pthreads, 
> and in some applications it is actually better to run a background thread 
> to handle all the VNC stuff. But it is not used in QEmu.
>
> Ciao,
> Dscho
>
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>   

  reply	other threads:[~2006-04-30 20:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-29 21:34 [Qemu-devel] [PATCH] VNC display support for QEMU Anthony Liguori
2006-04-30  1:03 ` Johannes Schindelin
2006-04-30  4:24   ` Anthony Liguori
2006-04-30 10:43     ` Johannes Schindelin
2006-04-30 20:14       ` Anthony Liguori [this message]
2006-04-30 22:14         ` Christian MICHON
2006-04-30 23:11           ` Christian MICHON
2006-04-30 23:46             ` [Qemu-devel] " Anthony Liguori
2006-04-30 20:57       ` [Qemu-devel] [PATCH] Enhanced Documentation Stefan Weil
2006-05-01  5:02   ` [Qemu-devel] [PATCH] VNC display support for QEMU Troy Benjegerdes
2006-05-01  5:29 ` Troy Benjegerdes
2006-05-01  6:01 ` Brad Campbell
2006-05-01  6:03   ` Brad Campbell
2006-05-01  9:08   ` Johannes Schindelin

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=44551A8A.9090802@codemonkey.ws \
    --to=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).