From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5NR-0005JJ-Hz for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:13:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YO5NN-0006KJ-5f for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:13:21 -0500 Received: from mail-we0-f176.google.com ([74.125.82.176]:33427) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YO5NM-0006Jx-VY for qemu-devel@nongnu.org; Wed, 18 Feb 2015 09:13:17 -0500 Received: by wevk48 with SMTP id k48so1439601wev.0 for ; Wed, 18 Feb 2015 06:13:16 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54E49DF6.2050503@redhat.com> Date: Wed, 18 Feb 2015 15:13:10 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20150218115534.4176.12578.stgit@PASHA-ISP> <20150218115645.4176.71451.stgit@PASHA-ISP> In-Reply-To: <20150218115645.4176.71451.stgit@PASHA-ISP> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH v9 11/23] replay: recording and replaying clock ticks 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, 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 On 18/02/2015 12:56, Pavel Dovgalyuk wrote: > +void replay_read_next_clock(ReplayClockKind kind) This function is called like this: > + if (replay_file) { > + int64_t ret; > + replay_mutex_lock(); > + if (skip_async_events(EVENT_CLOCK + kind)) { > + replay_read_next_clock(kind); > + } So it seems to me that this section is unnecessary: > + replay_fetch_data_kind(); > + if (replay_file) { > + unsigned int read_kind = replay_data_kind - EVENT_CLOCK; > + > + if (read_kind != kind) { > + return; > + } 1) replay_file must be non-NULL 2) skip_async_events has fetched replay_data_kind 3) replay_data_kind - EVENT_CLOCK must match read_kind It can be replaced simply with assert(replay_has_unread_data); assert(replay_data_kind - EVENT_CLOCK == kind); I suspect there are other cases like this where you have unnecessary calls to replay_fetch_data_kind(). Paolo