David S. Miller wrote:
From: Ben Greear <[EMAIL PROTECTED]>
Date: Wed, 24 Aug 2005 10:14:22 -0700
I was thinking about somehow instrumenting dev_get and dev_put
(and __dev_get and __dev_put, I suppose) to keep a list of all
that have got and put, but that will be very invasive and time
consuming I fear...
That's how I ususally attack this problem when no other big clues
exist. To be honest, it's not so bad. All of the ipv6 leaks
I ever tracked down were pretty clear once I had such a trace.
I would actually like to formalize this by putting the tracing
code into the upstream tree, enabled by some debug option.
A bonus prize goes to anyone who can implement this in an incredibly
clean and clever manner :-)
What do you think about adding a third argument that is an enum
(or perhaps just uint32).
Every piece of code that calls dev_put/dev_get and similar will pass
in a (hopefully) unique identifier. We can match the put with the
get based on the identifier and warn on double-puts, etc.
In debugging mode, we can keep either a hash of all
owners of a device. In the situation where we are trying to free a
device and it has references, we can print out the identifiers and
then go grepping...
I like the idea of an enum, even though it will be a ripe place for
merge conflicts, especially with external modules. Could also use
#defined constants if you prefer that....
Not really clean or clever, but might work.
Ben
--
Ben Greear <[EMAIL PROTECTED]>
Candela Technologies Inc http://www.candelatech.com
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html