Re: [PATCH] fix __mod_timer vs __run_timers deadlock.

Andrew Morton
2005-05-01T09:32:32Z

Oleg Nesterov <oleg@tv-sign.ru> wrote:
>
> When __mod_timer() changes timer's base it waits for the completion
> of timer->function. It is just stupid: the caller of __mod_timer()
> can held locks which would prevent completion of the timer's handler.
>
> Solution: do not change the base of the currently running timer.

OK, fingers crossed. Juergen, it would be great if you could test Oleg's
patch sometime.

Oleg, could you please review the changelog in
timers-fixes-improvements.patch sometime, make sure that it's all accurate
and complete?

Also, please review the comments in timer.c - some of the info which you
placed in that changelog really should be brought into the code itself so
people can understand the data structures and their interactions without
having to trawl the changelogs and mailing list archives.

For example, in __mod_timer:

if (timer_pending(timer)) {
detach_timer(timer, 0);
ret = 1;
}

new_base = &__get_cpu_var(tvec_bases);

if (base != &new_base->t_base) {
/*
* We really need a comment here explaining what
* (base != &new_base->t_base) *means*
*/
if (unlikely(base->running_timer == timer)) {
/*