netdev
[Top] [All Lists]

Re: tx_timeout and timer serialisation

To: kuznet@xxxxxxxxxxxxx
Subject: Re: tx_timeout and timer serialisation
From: Rusty Russell <rusty@xxxxxxxxxxxxxxxx>
Date: Tue, 30 May 2000 14:08:10 +0930
Cc: netdev@xxxxxxxxxxx
In-reply-to: Your message of "Thu, 11 May 2000 17:09:29 +0400." <200005111309.RAA32574@xxxxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
In message <200005111309.RAA32574@xxxxxxxxxxxxx> you write:
> Actually, existing *_timer primitives are very inconvenient.
> And I did not find any good way to improve them. Essentially,
> del_timer_sync(), timer->running and mod_timer() returning
> value are all that I was able to do.

There's still a tiny race with unloading modules between timer_exit()
and return in the timer handler.

A better interface would be to make the timerfn return a pointer to
the timer:

        struct timer_list *function(unsigned long data);

Get rid of the braindead timer_exit() macro, and inside
run_timer_list, do:

#ifdef CONFIG_SMP
        if (timer->function(timer->data)) {
                timer->running = 0;
                mb();
        }
#else
        timer->function(timer->data);
#endif

Then del_timer_sync() becomes the default, and del_timer_async() is
used for self-deleting timers and special effects.

(BTW, returning a pointer not an int so bugs like `kfree(timer);
return timer;' are more obvious).

So can we live with the current braindeath in 2.4?
Rusty.
--
Hacking time.

<Prev in Thread] Current Thread [Next in Thread>