[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.58.0703122309370.635@shell2.speakeasy.net>
Date: Mon, 12 Mar 2007 23:33:39 -0700 (PDT)
From: Trent Piepho <xyzzy@...akeasy.org>
To: Rusty Russell <rusty@...tcorp.com.au>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Mauro Carvalho Chehab <mchehab@...radead.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/3] Add ability to keep track of callers of
symbol_(get|put)
On Tue, 13 Mar 2007, Rusty Russell wrote:
> Hi Trent,
>
> Patch looks good, just one comment:
>
> On Mon, 2007-03-12 at 07:07 -0700, Trent Piepho wrote:
> > + use = already_uses(a, b);
> > + if (!use) {
> > + printk(KERN_ERR "module %s trying to un-use a module, %s, which "
> > + "it is not using", a->name, b->name);
> > + return 0;
> > + }
>
> s/return 0/BUG()/. This is potentially quite a nasty bug.
Ok, I did that before, I'll change it back.
Note that the reference counting isn't perfect when it comes to catching
mistakes.
The fundamental problem is that when a module is loaded and linked, all the
modules that it used symbols from gain a "use". To be symmetric, when a
module is unloaded all the modules it used symbols from should lose a
"use". Except, there is no record of what modules gained a "use" at link
time. Suppose module 1 uses a symbol from module 2. At link time, a
module_use that "1 uses 2" is created. Now say 1 does a symbol_put() on
something in 2, with no matching get. The "1 uses 2" goes away. When 1 is
unloaded, there is no way to tell that "1 uses 2", deleted by the extra
put, is missing.
If it's wanted, I think I could fix this. I'd have a separate count of
static uses vs dynamic uses.
View attachment "dynamic_dep_kernel.patch" of type "TEXT/PLAIN" (10301 bytes)
Powered by blists - more mailing lists