From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWKji-0000Dp-IR for qemu-devel@nongnu.org; Thu, 18 Feb 2016 04:18:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWKjd-00072d-JV for qemu-devel@nongnu.org; Thu, 18 Feb 2016 04:18:58 -0500 Received: from mail.ispras.ru ([83.149.199.45]:37998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWKjd-00072P-C0 for qemu-devel@nongnu.org; Thu, 18 Feb 2016 04:18:53 -0500 From: "Pavel Dovgalyuk" References: <003301d167cc$4d7d9480$e878bd80$@ru> <003a01d167d1$42df95f0$c89ec1d0$@ru> <20160215093810.GC5244@noname.str.redhat.com> <004701d167f8$5cbe70f0$163b52d0$@ru> <20160215140635.GF5244@noname.str.redhat.com> <005501d167fc$8ed75030$ac85f090$@ru> <20160215150110.GG5244@noname.str.redhat.com> <000601d16882$c9637270$5c2a5750$@ru> <20160216100208.GA4920@noname.str.redhat.com> <000a01d168ac$09929500$1cb7bf00$@ru> <20160216125453.GC4920@noname.str.redhat.com> In-Reply-To: <20160216125453.GC4920@noname.str.redhat.com> Date: Thu, 18 Feb 2016 12:18:54 +0300 Message-ID: <001701d16a2d$63623c70$2a26b550$@ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Language: ru Subject: Re: [Qemu-devel] [PATCH 3/3] replay: introduce block devices record/replay List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: 'Kevin Wolf' Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, igor.rubinov@gmail.com, mark.burton@greensocs.com, real@ispras.ru, hines@cert.org, qemu-devel@nongnu.org, maria.klimushenkova@ispras.ru, stefanha@redhat.com, pbonzini@redhat.com, batuzovk@ispras.ru, alex.bennee@linaro.org, fred.konrad@greensocs.com > From: Kevin Wolf [mailto:kwolf@redhat.com] > Am 16.02.2016 um 12:20 hat Pavel Dovgalyuk geschrieben: > > Coroutine Replay > > bool *done = req_replayed_list_get(reqid) // NULL > > co = > req_completed_list_get(e.reqid); // NULL > > There was no yield, this context switch is impossible to happen. Same > for the switch back. > > > req_completed_list_insert(reqid, qemu_coroutine_self()); > > qemu_coroutine_yield(); > > This is the point at which a context switch happens. The only other > point in my code is the qemu_coroutine_enter() in the other function. I've fixed aio_poll problem by disabling mutex lock for the replay_run_block_event() execution. Now virtual machine deterministically runs 4e8 instructions of Windows XP booting. But then one non-deterministic event happens. Callback after finishing coroutine may be called from different contexts. apic_update_irq() function behaves differently being called from vcpu and io threads. In one case it sets CPU_INTERRUPT_POLL and in other - nothing happens. Therefore execution becomes non-deterministic. In previous version of the patch I solved this problem by linking block events to the execution checkpoints. IO thread have its own checkpoints and vcpu - its own. Therefore apic callbacks are always called from the same thread in replay as in recording phase. Pavel Dovgalyuk