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 <dig...@gmail.com> 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

Reply via email to