From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsSFJ-0004L0-HQ for qemu-devel@nongnu.org; Wed, 13 May 2015 04:42:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YsSFF-0005Nk-7u for qemu-devel@nongnu.org; Wed, 13 May 2015 04:42:29 -0400 Received: from mail-wg0-x22f.google.com ([2a00:1450:400c:c00::22f]:34876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YsSFF-0005NN-1x for qemu-devel@nongnu.org; Wed, 13 May 2015 04:42:25 -0400 Received: by wgnd10 with SMTP id d10so33396012wgn.2 for ; Wed, 13 May 2015 01:42:24 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <55530E6A.6060202@redhat.com> Date: Wed, 13 May 2015 10:42:18 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <555243C8.30602@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] when does a target frontend need to use gen_io_start()/gen_io_end() ? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: mttcg@greensocs.com, QEMU Developers , Pavel Dovgaluk , Richard Henderson On 12/05/2015 21:41, Peter Maydell wrote: >> > It's any instruction that can cause an icount read, typically through >> > QEMU_CLOCK_VIRTUAL or cpu_get_ticks(). > Also anything that can cause a CPU interrupt, since tcg_handle_interrupt() > will call cpu_abort() if the CPU gets an interrupt while it's not > in a 'can do IO' state. > > Anything else? > > [How are -icount and multi-threaded TCG going to interact? Do we > just say "you get one or the other but not both" ?] For -icount and SMP, yes. I even posted a patch to that end once. You can get -icount and multi-threaded TCG (which for UP is simply TCG with execution out of the BQL) together I think. For example you could handle cpu->icount_decr.u16.low == 0 like cpu->halted, hanging the CPU thread until QEMU_CLOCK_VIRTUAL timers have been processed. The I/O thread would have to kick the CPU after processing QEMU_CLOCK_VIRTUAL timers---not hard to do. In fact, I suspect cpu->halted should become a kind of bitmap, and "wait for interrupt" should be just one bit in there. Any operation that requires synchronization with other VCPUs should use cpu->halted so that VCPUs can still run foreign code with run_on_vcpu. This was the plan I outlined to Frederic and Mark for flushing TLB remotely, at least. Paolo