From: Andrew Morton <andrewm@uow.edu.au>
To: Rusty Russell <rusty@linuxcare.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [ANNOUNCE] Kernel Janitor's TODO list
Date: Tue, 30 Jan 2001 03:08:56 +0000 [thread overview]
Message-ID: <3A763048.BB95E15A@uow.edu.au> (raw)
In-Reply-To: Your message of "Tue, 30 Jan 2001 12:05:41 +1100." <E14NPVU-0005nZ-00@halfway>
Rusty Russell wrote:
>
> > In message <3A74451F.DA29FD17@uow.edu.au> you write:
> > > http://www.uwsg.iu.edu/hypermail/linux/kernel/0005.3/0269.html
> > >
> > > A lot of the timer deletion races are hard to fix because of
> > > the deadlock problem.
>
> Double take: we *did* fix the problems with del_timer_sync().
A bit.
> We should probably have renamed del_timer to del_time_async and make
> everyone fix their code though.
That renaming is an absolute precondition. We just use
#define del_timer_async del_timer
and as the janitors go through fixing stuff, rename known-to-be-correct
usage of del_timer to del_timer_async. This is the only way
we can keep track of which code still needs looking at.
It's often trivial. But sometimes not, such as in SCSI.
We also need to clean up the initialisation of timers with some
nice macros, similar to list.h, semaphore.h, etc.
> The `text vanishing under timer in
> module' problem is solved by the pending module cleanup for 2.5.
mm.. A very common bug is this:
xxx_handler(void *something)
{
use(something);
or: assume(something->foo != 1);
}
xxx_close(something)
{
del_timer(&something->timer);
kfree(something);
or: something->foo = 1;
}
So xxx_handler can "use" freed memory. There really is a large amount
of breakage here. Just pick a random user of del_timer() and ask
yourself "what if the handler is running after del_timer returns".
Generally, it doesn't happen, because it's in fact quite rare for
a timer to actually expire, and because a lot of the buggy code
is on rarely-used paths such as close() methods. I've never seen
a bug report which could be attributed to a timer deletion race - partly
because SMP machines are rare, partly because they tend to be used
with a less exotic range of device drivers and partly because some
random subsytem went stupid and there was nothing concrete to report.
Now, there _is_ a correct solution, and that is to create a new timer
API. Probably one in which the timers are reference counted and their
storage is not managed by the users of the API.
It's a shame to create a second API (but we had two timer APIs up to
a few months back anyway...). But it's also an opportunity. The
proposed SMP-scalable timers could benefit from not having to be
back-compatible. Some of the remaining locking and cross-CPU
traffic could be tossed out if a clean slate were available.
But I don't see a way around the need for synchronous deletion and
the deadlock risk which that introduces.
The morbid amongst us can read the netdev thread from May 2000,
when timer outrage was at its peak:
http://www.wcug.wwu.edu/lists/netdev/200005/threads.html
-
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-30 3:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-30 1:22 Rusty Russell
2001-01-30 3:08 ` Andrew Morton [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-01-28 16:14 Manfred Spraul
2001-01-28 14:36 ` Arnaldo Carvalho de Melo
2001-01-28 16:45 ` Manfred Spraul
2001-01-28 17:07 ` David Woodhouse
2001-01-28 17:40 ` Manfred Spraul
2001-01-28 18:51 ` Roman Zippel
2001-01-29 17:01 ` Timur Tabi
2001-01-29 17:10 ` John Levon
2001-01-29 18:27 ` David D.W. Downey
2001-01-29 20:44 ` davej
2001-01-29 20:51 ` Timur Tabi
2001-01-29 20:56 ` Rasmus Andersen
2001-01-30 0:29 ` Peter Samuelson
2001-01-30 0:20 ` Ingo Oeser
2001-01-30 11:11 ` David Woodhouse
2001-01-30 16:52 ` Timur Tabi
2001-01-31 0:06 ` Daniel Phillips
2001-01-31 0:09 ` Timur Tabi
2001-01-31 9:14 ` David Woodhouse
2001-01-30 17:10 ` David Woodhouse
2001-01-29 17:26 ` Andi Kleen
2001-01-29 19:47 ` Roman Zippel
2001-01-29 20:35 ` Andi Kleen
2001-02-16 14:29 ` Andrea Arcangeli
2001-02-16 14:26 ` Andrea Arcangeli
2001-01-31 17:57 ` Alan Cox
2001-01-31 19:15 ` Manfred Spraul
2001-01-27 17:11 Arnaldo Carvalho de Melo
2001-01-28 15:20 ` David Woodhouse
2001-01-28 14:03 ` Arnaldo Carvalho de Melo
2001-01-28 15:49 ` Michael H. Warfield
2001-01-28 16:13 ` Andrew Morton
2001-01-28 14:28 ` Arnaldo Carvalho de Melo
2001-01-28 14:33 ` Arnaldo Carvalho de Melo
2001-01-30 1:05 ` Rusty Russell
2001-01-30 11:19 ` Daniel Phillips
2001-01-30 17:49 ` Daniel Phillips
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3A763048.BB95E15A@uow.edu.au \
--to=andrewm@uow.edu.au \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@linuxcare.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®