On 15 Aug 2013, at 09:22, liu ping fan wrote:

> How about new_list for vcpu to add timer, an before walking, splice
> the new_list to timer_list?

If I understand you right, you would have to be careful
any timer routine modified itself or (less likely) any
other timer, as that timer would no longer be on the
timer list, but rather be on the 'walk list'.
There's no problem per se with them being on a new timer
list, but some of them may modify the existing timer
leaving it on the list you are walking, and some might
put it on the timerlist associated with the clock. I'm
not sure things expect timers to move between lists.
Whatever, that means you can't call the callback with
the mutex held in either the walk list or the timer list.

I believe it's reasonably common for timers to call
timer_mod on themselves to get them to fire again.

The best I can do is simply take the lock, examine the
timer at the head of the list (always), remove the
timer from the active list, unlock, and call the callback.
That's exactly what the patch does.


(side note: you can't just splice the lists because they
have to be ordered)

-- 
Alex Bligh





Reply via email to