qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [6391] Fix nographic mode and VNC


From: Paul Brook
Subject: Re: [Qemu-devel] [6391] Fix nographic mode and VNC
Date: Thu, 22 Jan 2009 04:23:22 +0000
User-agent: KMail/1.9.9

> cpu_exec() spins in a loop checking for 'event_pending'.  This is set
> whenever the host_alarm_timer callback signals.  Alternatively, a halted
> guest will cause cpu_exec() to exit.  Only then do you do a select() on
> pending IO.

Ah, I see.

> If you are using dynticks as your clock, the guest has a slow clock, and
> the guest is not using halt instructions, then you will not poll IO
> until the next guest timer tick b/c your guest is just going to spin.
>
> There are three possible solutions.  Set SIGIO on every file descriptor
> so that TCG breaks whenever IO is pending.  Besides ugliness, this fails
> because not every type of file descriptor supports SIGIO.
>
> A second solution is to use a polling select() in cpu_exec.  Since
> you're adding a system call (and a rather heavy one) in the fast path,
> this is going to likely hurt TCG performance.

This won't work. If the guest really is in a tight loop then TB chaining means 
it will never exit translated code.

> The third possibility is to have the select() run in a separate thread
> from the TCG cpu_exec() loop.  cpu_exec() would do an atomic read of
> 'event_pending' and the IO thread would do an atomic write of
> 'event_pending' whenever select() returned a writable file descriptor.

This suffers from the same problem described above. You need to force the main 
execution thread to break out of the translated loop. In practice this 
probably means sending a signal to the main thread.  You could check 
event_pending at the start of every TB, but that's likely to incur a fairly 
big performance hit.

Paul




reply via email to

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