From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNgRM-000453-9V for qemu-devel@nongnu.org; Tue, 17 Feb 2015 06:35:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YNgRI-000754-PN for qemu-devel@nongnu.org; Tue, 17 Feb 2015 06:35:44 -0500 Received: from mail.ispras.ru ([83.149.199.45]:49644) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YNgRI-00073k-IN for qemu-devel@nongnu.org; Tue, 17 Feb 2015 06:35:40 -0500 From: "Pavel Dovgaluk" References: <20150122085127.5276.53895.stgit@PASHA-ISP.def.inno> <20150122085215.5276.8878.stgit@PASHA-ISP.def.inno> <54C9FE31.4090404@redhat.com> <001801d03ee3$c8cb7660$5a626320$@Dovgaluk@ispras.ru> <54CF6FA9.7090600@redhat.com> <28583.7738695138$1422880978@news.gmane.org> <54CF793D.6070404@redhat.com> <6071.25815372473$1424089600@news.gmane.org> <54E1E9B1.7090900@redhat.com> <8198.56250095672$1424093273@news.gmane.org> <54E1F14E.3000107@redhat.com> <39577.5216319182$1424093895@news.gmane.org> <54E1F650.5080508@redhat.com> <000001d04a8d$d65fc870$831f5950$@Dovgaluk@ispras.ru> <54E31EE1.2090809@redhat.com> In-Reply-To: <54E31EE1.2090809@redhat.com> Date: Tue, 17 Feb 2015 14:35:40 +0300 Message-ID: <000401d04aa5$dba0c470$92e24d50$@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 v8 08/21] cpu: replay instructions sequence 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 17/02/2015 09:43, Pavel Dovgaluk wrote: > >> > int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); > >> > if (deadline == 0) { > >> > qemu_clock_notify(QEMU_CLOCK_VIRTUAL); > >> > } > >> > > >> > instead of qemu_notify_event(), and remove these lines from > >> > qemu_tcg_cpu_thread_fn. > > I tried this one. But there is one problem. > > Expiring of the virtual timers is not the only reason of icount expiration in replay mode. > > It may be caused by host timers deadline or poll timeout in record mode. In this case > > qemu_clock_notify(QEMU_CLOCK_VIRTUAL) will not be called in replay mode and we'll waste time > for iothread sleeping. > > Sure, but unconditional qemu_notify_event() is also wrong. So, to sum up: > > - it's okay to move code from qemu_tcg_cpu_thread_fn to cpu-exec.c > > - it's okay to add more qemu_clock_notify calls than just > qemu_clock_notify(QEMU_CLOCK_VIRTUAL), each with its own condition > > - it's better if all these, after being moved to cpu-exec.c, are also > extracted in a separate function > > - it's not okay to do an unconditional qemu_notify_event() in > cpu-exec.c, even if it's under "if (replay_mode != NONE)". How can I wake up iothread if there are no pending timers? deadline will (almost) never become zero in my case, because there is another kind of event in the log (not the timer one). Should I fetch the event and call qemu_notify_event() from replay module? > > Thanks for your understanding! :) Pavel Dovgalyuk