All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Youngs <sryoungs@bigpond.net.au>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@osdl.org>
Subject: Re: PATCH: (as177)  Add class_device_unregister_wait() and platform_device_unregister_wait() to the driver model core
Date: Mon, 26 Jan 2004 09:12:58 +1000	[thread overview]
Message-ID: <microsoft-free.877jzfoc5h.fsf@eicq.dnsalias.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0401251054340.18932@home.osdl.org> (Linus Torvalds's message of "Sun, 25 Jan 2004 11:02:58 -0800")

[-- Attachment #1: Type: text/plain, Size: 2963 bytes --]

* Linus Torvalds <torvalds@osdl.org> writes:

  >  - doing proper refcounting of modules is _really_ really
  >    hard. The reason is that proper refcounting is a "local"
  >    issue: you reference count a single data structure. It's
  >    basically impossible to make a "global" reference count
  >    without jumping through hoops.

Please understand that I coming from an _extremely_ naive perspective,
but why do refcounting at all?  Couldn't the refcount be a simple
boolean?  For example:

  - The cdrom module is "in use" when a cdrom filesystem is mounted
    and it isn't "in use" when there are _no_ cdrom filesystems
    mounted. 

  - An ethernet module is "in use" while the device is attached to an
    IP. 

  - A packet filter module is "in use" while there are iptables rules
    (or similar) existing that require it.

I see the process working along these lines: When a module is loaded
into the kernel it (the module) exports a symbol (a function) that the
kernel can use for determining whether or not the module is still in
use.  If no such symbol is exported the kernel would mark the module
as being "non-unloadable" (its refcount would always be non-nil), and
send an appropriate message to root via syslog saying "xyz module
cannot be automatically unloaded".

It should also be possible for modules to tell the kernel, through the
same mechanism, that they should _never_ be unloaded.

I don't, yet, have the knowledge to turn my ideas into code so I won't
be offended in the slightest if you ignore them.  Just tell me
why. :-) 

  >  - lack of testing. 

A moot point once the kernel can safely and efficiently do module
unloading. 

  >    Unloading a module happens once in a blue moon, if even then.

We get an awful lot of blue moons here.

  > The proper thing to do (and what we _have_ done) is to say
  > "unloading of modules is not supported".

Wouldn't it be better to say "unloading of modules is currently
discouraged because we haven't _yet_ solved the problems related to
unloading modules".

  > But it basically boils down to: don't think of module unload as a "normal
  > event". It isn't. Getting it truly right is (a) too painful and (b) would
  > be too slow, so we're not even going to try.

Now there's a cop out if ever I saw one.  Surely, Linus, you've
overcome _much_ bigger problems than this at different times.  Just
because the only solutions that have been thought of so far are hard
to implement, are too inefficient, and aren't very safe doesn't mean
you should give up.  It just means that you need a different
solution. 

  > (As an example of "too painful, too slow", think of something like a 
  > packet filter module.

See my examples above.



-- 
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
|              Ashes to ashes, dust to dust.               |
|      The proof of the pudding, is under the crust.       |
|------------------------------<sryoungs@bigpond.net.au>---|

[-- Attachment #2: Type: application/pgp-signature, Size: 256 bytes --]

  parent reply	other threads:[~2004-01-25 23:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-23 16:58 PATCH: (as177) Add class_device_unregister_wait() and platform_device_unregister_wait() to the driver model core Alan Stern
2004-01-23 17:42 ` Linus Torvalds
2004-01-23 18:03   ` Alan Stern
2004-01-23 18:10     ` viro
2004-01-23 18:18       ` Greg KH
2004-01-23 18:15     ` Linus Torvalds
2004-01-23 18:31       ` Greg KH
2004-01-23 18:11   ` Greg KH
2004-01-23 18:19     ` Linus Torvalds
2004-01-23 18:27       ` Greg KH
2004-01-25 17:32       ` Alan Stern
2004-01-25 19:02         ` Linus Torvalds
2004-01-25 20:21           ` viro
2004-01-27  6:51             ` Rusty Russell
2004-01-27 13:56               ` Roman Zippel
2004-01-27 23:29                 ` Rusty Russell
2004-01-28  2:36                   ` Roman Zippel
2004-01-28  3:54                     ` Rusty Russell
2004-01-25 23:12           ` Steve Youngs [this message]
2004-01-26  3:22             ` Adam Kropelin
2004-01-26  5:06               ` Steve Youngs
2004-01-26  5:21                 ` Valdis.Kletnieks
2004-01-26  5:55                   ` Steve Youngs
2004-01-26  6:25                     ` Valdis.Kletnieks
2004-01-26  8:48                     ` Helge Hafting
2004-01-26 15:50                 ` Adam Kropelin
2004-01-26 16:22           ` Roman Zippel
2004-01-27 19:32             ` Russell King
2004-01-27 20:28               ` Greg KH
2004-01-27 20:29             ` Greg KH
2004-01-28  2:03               ` Roman Zippel
2004-01-28  2:17                 ` viro
2004-01-28  2:53                   ` Roman Zippel
2004-01-27  6:41           ` Rusty Russell
2004-01-23 19:45     ` viro
2004-01-26  5:50     ` Rusty Russell
2004-01-26 15:51       ` Alan Stern
2004-01-27 22:55         ` Rusty Russell

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=microsoft-free.877jzfoc5h.fsf@eicq.dnsalias.org \
    --to=sryoungs@bigpond.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.