From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBKqj-0007Df-AF for qemu-devel@nongnu.org; Wed, 14 Jan 2015 05:06:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBKqd-0001C9-Vo for qemu-devel@nongnu.org; Wed, 14 Jan 2015 05:06:53 -0500 Received: from mail.ispras.ru ([83.149.199.45]:54496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBKqd-0001BR-N6 for qemu-devel@nongnu.org; Wed, 14 Jan 2015 05:06:47 -0500 From: "Pavel Dovgaluk" References: <20150112115944.3504.66763.stgit@PASHA-ISP> <20150112120032.3504.11086.stgit@PASHA-ISP> <54B3BF3B.7020403@redhat.com> <001301d02e64$f192c740$d4b855c0$@Dovgaluk@ispras.ru> <54B3C404.4050603@redhat.com> <3141.42739302969$1421226482@news.gmane.org> <54B63B8E.5010708@redhat.com> In-Reply-To: <54B63B8E.5010708@redhat.com> Date: Wed, 14 Jan 2015 13:06:47 +0300 Message-ID: <000101d02fe1$ce954320$6bbfc960$@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 v7 08/21] replay: interrupts and exceptions 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:paolo.bonzini@gmail.com] On Behalf Of Paolo Bonzini > On 14/01/2015 10:07, Pavel Dovgaluk wrote: > >> From: Paolo Bonzini [mailto:pbonzini@redhat.com] > >> On 12/01/2015 13:40, Pavel Dovgaluk wrote: > >>>>> > >>>>> Perhaps check the replay_interrupt() outside, in an && with "if > >>>>> (unlikely(interrupt_request))"? > >>> You mean that I should wrap whole condition into "unlikely"? > >>> > >> > >> No, I wanted to have a single check of "replay_interrupt()" and/or > >> "replay_has_interrupt()". > >> > >> BTW, I think this is incorrect: > >> > >>> + if ((replay_mode != REPLAY_MODE_PLAY > >>> + || replay_has_interrupt()) > >>> + && cc->cpu_exec_interrupt(cpu, interrupt_request)) { > >>> + replay_interrupt(); > >> > >> because cc->cpu_exec_interrupt() can exit with cpu_loop_exit(cpu). > > > > Haven't found any. Do you have an example? > > Yes: > > cpu_svm_check_intercept_param -> > helper_svm_check_intercept_param -> > helper_vmexit -> cpu_loop_exit Thanks. > >> if (replay_mode == REPLAY_MODE_PLAY && !replay_has_interrupt()) { > >> /* do nothing */ > >> } else if (interrupt_request & CPU_INTERRUPT_HALT) { > >> replay_interrupt(); > >> ... > >> cpu_loop_exit(cpu); > >> } else if (interrupt_request & CPU_INTERRUPT_INIT) { > >> replay_interrupt(); > >> ... > >> cpu_loop_exit(cpu); > >> } else { > >> replay_interrupt(); > >> if (cc->cpu_exec_interrupt(cpu, interrupt_request)) { > >> next_tb = 0; > >> } > >> } > > > > Is it normal that processing of the reset request does not execute cpu_loop_exit(cpu)? > > I think it is okay. INIT executes cpu_loop_exit() on x86 because > processors other than the boot processor are halted after they receive INIT. Then I cannot put everything in one if-else chain because it will change the behavior of the code. After processing RESET branch we can also process hardware interrupts (in unmodified code). Pavel Dovgalyuk