From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCt6I-0003B2-Lw for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:21:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCt6C-0001p8-Ci for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:21:06 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:51220 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCt6C-0001p4-6F for qemu-devel@nongnu.org; Thu, 31 Jul 2014 12:21:00 -0400 References: <20140731125321.1600.46604.stgit@PASHA-ISP.novsu.ac.ru> <20140731125531.1600.81487.stgit@PASHA-ISP.novsu.ac.ru> From: Alex =?utf-8?Q?Benn=C3=A9e?= Date: Thu, 31 Jul 2014 17:17:29 +0100 In-reply-to: <20140731125531.1600.81487.stgit@PASHA-ISP.novsu.ac.ru> Message-ID: <87iomdijo7.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC PATCH v3 22/49] cpu: invent instruction count for accurate replay List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, real@ispras.ru, pbonzini@redhat.com, afaerber@suse.de, fred.konrad@greensocs.com Pavel Dovgalyuk writes: > This patch adds instructions count fields to cpu structure and > invents several functions for increasing this counter while executing > translation blocks. > > @@ -1186,6 +1188,7 @@ void qemu_init_vcpu(CPUState *cpu) > cpu->nr_cores = smp_cores; > cpu->nr_threads = smp_threads; > cpu->stopped = true; > + cpu->instructions_count = 0; > + if (replay_file) { > + if (replay_mode == REPLAY_MODE_RECORD) { > + if (process_events && replay_has_events()) { > + replay_save_instructions(); > + /* events will be after the last instruction */ > + replay_save_events(-1); > + } else { > + /* instruction - increase the step counter */ > + ++first_cpu->instructions_count; > + } > + } else if (replay_mode == REPLAY_MODE_PLAY) { > + skip_async_events_until(EVENT_INSTRUCTION); > + if (first_cpu->instructions_count >= 1) { > + ++replay_state.current_step; > + --first_cpu->instructions_count; > + if (first_cpu->instructions_count == 0) { > + replay_has_unread_data = 0; > + } > + } else { > + replay_read_events(-1); > + } > + } > + } > +} > + > +void replay_undo_last_instruction(void) > +{ > + if (replay_mode == REPLAY_MODE_RECORD) { > + first_cpu->instructions_count--; > + } else { > + replay_state.skipping_instruction = 1; > + } I'm not quite following what instructions_count means here. Is it an actual count of instructions executed? Can you add a comment to the header where it's defined? -- Alex Bennée