From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwqY9-0004s6-V0 for qemu-devel@nongnu.org; Fri, 05 Dec 2014 05:55:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwqXz-0006fF-LN for qemu-devel@nongnu.org; Fri, 05 Dec 2014 05:55:49 -0500 Received: from mail.ispras.ru ([83.149.199.45]:32997) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwqXz-0006ec-3g for qemu-devel@nongnu.org; Fri, 05 Dec 2014 05:55:39 -0500 From: "Pavel Dovgaluk" References: <20141126103841.7772.11864.stgit@PASHA-ISP> <20141126103925.7772.13043.stgit@PASHA-ISP> <547EE34D.4000500@redhat.com> <000c01d00fb1$c2010860$46031920$@Dovgaluk@ispras.ru> <548082E2.2060602@redhat.com> <000301d0104d$29dc3d10$7d94b730$@Dovgaluk@ispras.ru> <54818AC0.50400@redhat.com> In-Reply-To: <54818AC0.50400@redhat.com> Date: Fri, 5 Dec 2014 13:55:42 +0300 Message-ID: <001301d0107a$0388b5d0$0a9a2170$@Dovgaluk@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Qemu-devel] [RFC PATCH v5 07/31] icount: implement icount requesting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Paolo Bonzini' , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, alex.bennee@linaro.org, afaerber@suse.de, fred.konrad@greensocs.com > From: Paolo Bonzini [mailto:pbonzini@redhat.com] > On 05/12/2014 06:34, Pavel Dovgaluk wrote: > >> From: Paolo Bonzini [mailto:pbonzini@redhat.com] > >> On 04/12/2014 12:02, Pavel Dovgaluk wrote: > >>>>> Why do you need to do this if !cpu_can_do_io(cpu)? > >>> We save number of executed instruction when saving interrupt or exception event. > >>> It leads to the call of cpu_get_instructions_counter() from cpu_exec function > >>> (through several replay functions). It is correct (because no block is executing > >>> at that moment) but is different to prior usage of icount requests. > >> > >> Why is !cpu_can_do_io(cpu) if no block is executing? > > > > Because it returns cpu->can_do_io which is equal to zero at that moment. > > And why is can_do_io zero? :) Is the fix to move the place where > can_do_io becomes nonzero? can_do_io is set by gen_io_start function. As I understand, it is used to protect determinism in icount mode, because it allows non-deterministic (port io, raising interrupt) operations only at the end of the translation blocks. When someone tries to use MMIO in the middle of TB, that TB is recompiled to place this instruction at the end of the block. Do you mean that we can set can_do_io before execution of the block and reset it at the beginning of the execution? Pavel Dovgalyuk