lkml.org 
[lkml]   [2002]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Module Refcount & Stuff mini-FAQ
Date
In message <20021124230758.A1549@almesberger.net> you write:
> Rusty Russell wrote:
> > Q: But the modules' init routine calls my register() routine which
> > wants to call back into one of the function pointers immediately,
> > and so try_module_get() fails! (because the module is not finished
> > initializing yet)
> > A: You're being called from the module, so someone already has a
> > reference (unless there's a bug), so you don't need a
> > try_module_get().
>
> Hmm, I wouldn't call this the answer. How about:
> - Q: why does it fail ?
> - A: because you're initializing
> - solution: but since you're calling from a module, and the call
> goes back to the same module, you don't have to worry
>
> This raises the question: why is this a special case ? The
> registration function shouldn't have to know all these details.
> (That's the whole point of try_module_get, isn't it ?)

Yes, this is a fairly rare case: I'm debating it now. For example,
scsi calls back into the module which just registered, as does the
block layer (to probe for partitions).

> > Well, if we continue to start modules unisolated, I need to rewrite
> > the FAQ anyway...
>
> Does "unisolated" mean that try_module_get would work ? If yes,
> you've already solved the problem ;-)

At the cost of exposing the module to initialization races.

Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:31    [W:0.578 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site