From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLwBN-0002Ee-LL for qemu-devel@nongnu.org; Wed, 20 Jan 2016 12:04:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLwBM-0007OB-Qs for qemu-devel@nongnu.org; Wed, 20 Jan 2016 12:04:33 -0500 References: <9bdf3e1d349c7cfc6d75cc37430fe4f177c20734.1452359845.git.digetx@gmail.com> From: Dmitry Osipenko Message-ID: <569FBDF3.2070405@gmail.com> Date: Wed, 20 Jan 2016 20:03:47 +0300 MIME-Version: 1.0 In-Reply-To: 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 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; } -- Dmitry