From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGmAe-0004Te-6R for qemu-devel@nongnu.org; Thu, 29 Jan 2015 05:17:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGmAX-0000iF-St for qemu-devel@nongnu.org; Thu, 29 Jan 2015 05:17:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58720) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGmAX-0000i0-KX for qemu-devel@nongnu.org; Thu, 29 Jan 2015 05:17:49 -0500 Message-ID: <54CA00FE.3000605@redhat.com> Date: Thu, 29 Jan 2015 10:44:30 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20150122085127.5276.53895.stgit@PASHA-ISP.def.inno> <20150122085221.5276.24836.stgit@PASHA-ISP.def.inno> In-Reply-To: <20150122085221.5276.24836.stgit@PASHA-ISP.def.inno> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v8 09/21] replay: interrupts and exceptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgalyuk , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, alex.bennee@linaro.org, mark.burton@greensocs.com, real@ispras.ru, batuzovk@ispras.ru, maria.klimushenkova@ispras.ru, afaerber@suse.de, fred.konrad@greensocs.com On 22/01/2015 09:52, Pavel Dovgalyuk wrote: > + if (replay_mode == REPLAY_MODE_RECORD) { > + replay_save_instructions(); > + replay_put_event(EVENT_EXCEPTION); > + return true; Missing mutex lock/unlock. > + } else if (replay_mode == REPLAY_MODE_PLAY) { > + bool res = false; > + replay_exec_instructions(); > + replay_mutex_lock(); > + if (skip_async_events(EVENT_EXCEPTION)) { > + replay_has_unread_data = 0; > + res = true; > + } > + replay_mutex_unlock(); > + return res; > + } bool res; replay_exec_instructions(); res = replay_has_exception(); if (res) { replay_has_unread_data = 0; } return res; Same for replay_interrupt(). Perhaps worth factoring out two functions replay_cpu_event and replay_has_cpu_event? You choose. > > @@ -1294,6 +1295,9 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request) > if (interrupt_request & CPU_INTERRUPT_POLL) { > cs->interrupt_request &= ~CPU_INTERRUPT_POLL; > apic_poll_irq(cpu->apic_state); > + if (replay_mode != REPLAY_MODE_NONE) { > + return true; > + } > } > #endif Can you explain this? It probably needs a comment. Paolo