From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0WRU-0000pa-9N for qemu-devel@nongnu.org; Fri, 27 Jun 2014 09:43:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X0WRN-0004XY-Hs for qemu-devel@nongnu.org; Fri, 27 Jun 2014 09:43:52 -0400 Received: from greensocs.com ([178.33.234.66]:33358) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X0WRN-0004XT-8N for qemu-devel@nongnu.org; Fri, 27 Jun 2014 09:43:45 -0400 Message-ID: <53AD750E.6070305@greensocs.com> Date: Fri, 27 Jun 2014 15:43:42 +0200 From: Frederic Konrad MIME-Version: 1.0 References: <53acfed7.e3538c0a.39e2.ffffb619SMTPIN_ADDED_BROKEN@mx.google.com> <53AD21AB.1040609@greensocs.com> <53ad4904.8360e50a.0f7f.ffffce7dSMTPIN_ADDED_BROKEN@mx.google.com> <008501cf91f9$51818280$f4848780$@Dovgaluk@ispras.ru> In-Reply-To: <008501cf91f9$51818280$f4848780$@Dovgaluk@ispras.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Reverse execution and deterministic replay List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Dovgaluk , 'Peter Maydell' Cc: 'Paolo Bonzini' , 'Peter Crosthwaite' , 'Mark Burton' , 'QEMU Developers' We also started with a separate counter, but using icount, which is intended to provide just this functionality, is much more logical. On 27/06/2014 13:17, Pavel Dovgaluk wrote: >> On 27 June 2014 11:35, Pavel Dovgaluk wrote: >>> The major disadvantage of icount is that it's updated only on TB boundaries. >>> When one instruction in the middle of the block uses virtual clock, it could >>> have different values for different divisions of the code to TB. >> This is only true if the instruction is incorrectly not >> marked as being "I/O". The idea behind icount is that in >> general we update it on TB boundaries (it's much faster >> than doing it once per insn) but for those places which >> do turn out to need an exact icount we then retranslate >> the block to get the instruction-to-icount-adjustment >> mapping. > I see. But if we want virtual clock in "real" mode then we still > should create new timer (based on icount code). That's exactly what QEMU_ICOUNT_CLOCK does in our series: It depends only on the instruction counter and we use it to exit at the right moment (by computing icount extra from this new clock as well). We don't have this with QEMU_VIRTUAL_CLOCK as some host time is added to it. "Real" mode support is somewhat a strange notion when we talk about reversing, we believe that insisting on using icount for reverse execution is perfectly acceptable, as introducing any sort of non-determinism based on the host clock will not be helpful. >> It wouldn't surprise me if this turned out to have some >> bugs in corner cases, but fixing these issues seems to >> me like a much better design than ignoring icount completely >> and reimplementing a second instruction counter. > When we started an implementation, we didn't have enough resources > to fix all such bugs. That is why we selected such conservative > approach. But I believe that in future we will adopt the icount > for replay purposes. > > Pavel Dovgaluk > As you say, there are some little bugs with icount which must be fixed anyway. I'm sure you did other advances that we have not managed, and as I say, I would be happy to review your patches as I am sure they will imporve reverse execution support. Fred