Re: [PATCH] fix __mod_timer vs __run_timers deadlock.

From: Andrew Morton
Date: Sun May 01 2005 - 04:33:13 EST


Oleg Nesterov <oleg@xxxxxxxxxx> 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)) {
/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/