On 13 Feb 2014, at 15:36, Peter Maydell wrote: > On 10 February 2014 17:15, Rob Herring <robherri...@gmail.com> wrote: >> This doesn't appear to be too useful. The AvgLength is large because >> INT64_MAX / GTIMER_SCALE is used as the next timer value when no timer >> is needed. > > The code already uses timer_del() when no next timer is needed > (that's the "timer disabled" case in gt_recalc_timer()). We only > set the timer to INT64_MAX / GTIMER_SCALE for the case where the > architecture demands an interrupt occurs in the really distant > future. Admittedly the chances of QEMU still running in 200 years > time are quite low, but it seemed at the time to be better to just > write the code to behave correctly, since I assumed that calling > timer_mod with a large timeout wasn't going to be really more > expensive than calling timer_del. (Looking at the code, we end > up walking the list of timers twice rather than once.)
I suspect the issue is not walking the lists, but calling qemu_notify, breaking out of mainloop select etc. etc.; that happens on a timer_modify but not on a timer_del. We could fix this so that it only happened if the timer's expiry time was reduced in timer_mod (I think). -- Alex Bligh