Received: from eggs.gnu.org ([2001:4830:134:3::10]:43566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLwTC-0005ZH-GN for qemu-devel@nongnu.org; Wed, 20 Jan 2016 12:22:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLwTB-0003MK-LO for qemu-devel@nongnu.org; Wed, 20 Jan 2016 12:22:58 -0500 References: <9bdf3e1d349c7cfc6d75cc37430fe4f177c20734.1452359845.git.digetx@gmail.com> <569FBDF3.2070405@gmail.com> From: Dmitry Osipenko Message-ID: <569FC243.6090507@gmail.com> Date: Wed, 20 Jan 2016 20:22:11 +0300 MIME-Version: 1.0 In-Reply-To: <569FBDF3.2070405@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v10 2/7] hw/ptimer: Perform tick and counter wrap around if timer already expired List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , qemu-arm , QEMU Developers 20.01.2016 20:03, Dmitry Osipenko пишет: > Hi Peter, > > 10.01.2016 03:44, Peter Crosthwaite пишет: >> On Sat, Jan 9, 2016 at 9:39 AM, Dmitry Osipenko wrote: > [cut] >>> In addition, there is no reason to keep expired timer tick deferred, so >>> just perform the tick from ptimer_get_count(). >>> > [cut] > > I noticed an issue here... The problem is that device reset invokes > ptimer_stop() that invokes ptimer_get_count() that might cause the tick after > reset, i.e. bogus bh would be invoked after QEMU reset. I have reproduced that > issue. > > The solution might be to introduce ptimer_reset() that would stop QEMU timer and > reset delta/load/period without invoking ptimer_get_count. And of course all > devices should be updated to use new ptimer_reset() prior to "Perform tick and > counter wrap around if timer already expired" patch, but that's not an issue I > suppose. Please let me know if you have any objections, I'm leaning to do it in > V11. > > void ptimer_reset(ptimer_state *s) > { > timer_del(s->timer); > s->enabled = 0; > s->period_frac = 0; > s->period = 0; > s->delta = 0; > s->limit = 0; > } > However, ptimer_stop() still would be broken. So maybe it's better to keep tick deferred. -- Dmitry