From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQRFE-0002jt-Tv for qemu-devel@nongnu.org; Fri, 23 Jan 2009 13:59:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQRFC-0002ik-Dy for qemu-devel@nongnu.org; Fri, 23 Jan 2009 13:59:07 -0500 Received: from [199.232.76.173] (port=53418 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQRFC-0002ih-8x for qemu-devel@nongnu.org; Fri, 23 Jan 2009 13:59:06 -0500 Received: from mx20.gnu.org ([199.232.41.8]:29468) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LQRFB-0001KZ-Oc for qemu-devel@nongnu.org; Fri, 23 Jan 2009 13:59:06 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQRFA-0006lJ-Sz for qemu-devel@nongnu.org; Fri, 23 Jan 2009 13:59:05 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [6391] Fix nographic mode and VNC Date: Fri, 23 Jan 2009 18:59:01 +0000 References: <200901220423.23551.paul@codesourcery.com> <18808.26680.24696.223678@mariner.uk.xensource.com> In-Reply-To: <18808.26680.24696.223678@mariner.uk.xensource.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901231859.02629.paul@codesourcery.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ian Jackson > > > 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. > > What would the signal handler do ? siglongjmp out of the translated > loop ? Surely the timer implementation doesn't do that right now. The same as the current one does. Call cpu_interrupt to unlink the TB and cause execution to fall back to cpu_exec sometime in the near future. cpu_interrupt is not threadsafe[1] so has to be called from the main execution thread. [1] TB [un-]chaining involves direct patching of the translated code. Most SMP systems do not have a coherent icache. Paul