public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [OKS] Module removal
@ 2002-07-01 17:48 Bill Davidsen
  2002-07-01 18:35 ` Richard B. Johnson
                   ` (5 more replies)
  0 siblings, 6 replies; 83+ messages in thread
From: Bill Davidsen @ 2002-07-01 17:48 UTC (permalink / raw)
  To: Linux-Kernel Mailing List

Having read some notes on the Ottawa Kernel Summit, I'd like to offer some
comments on points raied.

The suggestion was made that kernel module removal be depreciated or
removed. I'd like to note that there are two common uses for this
capability, and the problems addressed by module removal should be kept in
mind. These are in addition to the PCMCIA issue raised.

1 - conversion between IDE-CD and IDE-SCSI. Some applications just work
better (or usefully at all) with one or the other driver used to read CDs.
I've noted that several programs for reading the image from an ISO CD
(readcd and sdd) have end of data problems with the SCSI interface.

2 - restarting NICs when total reinitialization is needed. In server
applications it's sometimes necessary to move or clear a NIC connection,
force renegotiation because the blade on the switch was set wrong, etc.
It's preferable to take down one NIC for a moment than suffer a full
outage via reboot.

-- 
bill davidsen <davidsen@tmr.com>
  CTO, TMR Associates, Inc
Doing interesting things with little computers since 1979.


^ permalink raw reply	[flat|nested] 83+ messages in thread
* Re: RE2: [OKS] Module removal
@ 2002-07-02  4:08 Brian Gerst
  2002-07-02  4:53 ` Keith Owens
  0 siblings, 1 reply; 83+ messages in thread
From: Brian Gerst @ 2002-07-02  4:08 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

Keith Owens wrote:
> On Mon, 1 Jul 2002 22:40:34 -0300, 
> Werner Almesberger <wa@almesberger.net> wrote:
> 
>>If I remember right, the main arguments why module removal can
>>race with references were:
>>....
>>- removal happening immediately after module usage count is
>>  decremented to zero may unload module before module has
>>  executed "return" instruction
>>For the removal-before-return problem, I thought a bit about it
>>on my return flight. It would seem to me that an "atomic"
>>"decrement_module_count_and_return" function would do the trick.
> 
> 
> This is just one symptom of the overall problem, which is module code
> that adjusts its use count by executing code that belongs to the
> module.  The same problem exists on entry to a module function, the
> module can be removed before MOD_INC_USE_COUNT is reached.
> 
> Apart from abandoning module removal, there are only two viable fixes:
> 
> 1) Do the reference counting outside the module, before it is entered.
> 
>    This is why Al Viro added the owner: __THIS_MODULE; line to various
>    structures.  The problem is that it spreads like a cancer.  Every
>    structure that contains function pointers needs an owner field.
>    Every bit of code that dereferences a function pointer must first
>    bump the owner's use count (using atomic ops) and must cope with the
>    owner no longer existing.
> 
>    Not only does this pollute all structures that contain function
>    pointers, it introduces overhead on every function dereference.  All
>    of this just to cope with the relatively low possibility that a
>    module will be removed.

Only "first use" (ie. ->open) functions need gaurding against unloads. 
Any subsequent functions are guaranteed to have a reference to the 
module, and don't need to bother with the refcount.  I have a few ideas 
to optimize the refcounting better than it is now.

> 2) Introduce a delay after unregistering a module's services and before
>    removing the code from memory.
> 
>    This puts all the penalty and complexity where it should be, in the
>    unload path.  However it requires a two stage rmmod process (check
>    use count, unregister, delay, recheck use count, remove if safe)
>    so all module cleanup routines need to be split into unregister and
>    final remove routines.
> 
>    This is relatively easy to do without preemption, it is
>    significantly harder with preempt.  There are also unsolved problems
>    with long running device commands with callbacks (e.g. CD-R fixate)
>    and with kernel threads started from a module (must wait until
>    zombies have been reaped).

The callbacks should hold references that would not allow the module to 
unload.  Other than that, this is the same problem the RCU folks are 
working on.

> Rusty and I agree that option (2) is the only sane way to do module
> unload, assuming that we retain module unloading.  First decide if the
> extra work is justified.

Freeing up the limited vmalloc address space should be justification enough.

--
				Brian Gerst



^ permalink raw reply	[flat|nested] 83+ messages in thread
* Re: [OKS] Module removal
@ 2002-07-02 12:20 Ariel Garcia
  0 siblings, 0 replies; 83+ messages in thread
From: Ariel Garcia @ 2002-07-02 12:20 UTC (permalink / raw)
  To: linux-kernel


On Mon, 1 Jul 2002, Bill Davidsen wrote:

> The suggestion was made that kernel module removal be depreciated or
> removed. I'd like to note that there are two common uses for this
> capability, and the problems addressed by module removal should be kept in
> mind. These are in addition to the PCMCIA issue raised.

I would add another one: switching hardware in a laptop.
  I have a laptop in which the cdrom and the floppy drives both share the
same bay, ie, I can put either the floppy or the cd in the bay but not
both simultaneously.
  To be able to use the cdrom after I have booted with the floppy drive
installed (and used it), I have to remove the floppy module first.
Otherwise the cdrom modules cannot be loaded...
Not having the rmmod possibility would be a big step backwards.


Cheers,

Ariel Garcia


^ permalink raw reply	[flat|nested] 83+ messages in thread

end of thread, other threads:[~2002-07-12 21:54 UTC | newest]

Thread overview: 83+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-01 17:48 [OKS] Module removal Bill Davidsen
2002-07-01 18:35 ` Richard B. Johnson
2002-07-01 18:42 ` Jose Luis Domingo Lopez
2002-07-01 18:45   ` Shawn
2002-07-01 19:57 ` Diego Calleja
2002-07-01 20:03   ` Diego Calleja
2002-07-01 22:20   ` Jose Luis Domingo Lopez
2002-07-01 22:56   ` Ryan Anderson
2002-07-02 11:37 ` Stephen C. Tweedie
2002-07-02 12:04   ` Richard B. Johnson
2002-07-02 13:13     ` jlnance
2002-07-03  3:48     ` simple handling of module removals " Pavel Machek
2002-07-03 17:25       ` Richard B. Johnson
2002-07-03 23:46       ` Daniel Phillips
2002-07-08 12:21         ` Richard B. Johnson
2002-07-08 12:41           ` Thunder from the hill
2002-07-08 12:57             ` Richard B. Johnson
2002-07-08 13:58               ` Thunder from the hill
2002-07-08 15:48                 ` Daniel Gryniewicz
2002-07-08 17:23                   ` Thunder from the hill
2002-07-08 13:06           ` Keith Owens
2002-07-08 13:15             ` Keith Owens
2002-07-03 23:48       ` Daniel Phillips
2002-07-05  9:40         ` Stephen Tweedie
2002-07-06 19:40           ` Daniel Phillips
2002-07-06 19:47             ` Pavel Machek
2002-07-04  1:18       ` Keith Owens
2002-07-04  1:53         ` Andrew Morton
2002-07-04  4:00           ` Keith Owens
2002-07-04  2:25         ` Brian Gerst
2002-07-04  3:54           ` David Gibson
2002-07-04  4:08           ` Keith Owens
2002-07-04 15:02             ` Brian Gerst
2002-07-04 19:18               ` Werner Almesberger
2002-07-05 13:48         ` Pavel Machek
2002-07-07 14:56           ` Keith Owens
2002-07-07 22:36             ` Roman Zippel
2002-07-08  1:09             ` Daniel Mose
2002-07-09 17:07               ` Daniel Mose
2002-07-08 18:13             ` Pavel Machek
2002-07-08 22:43               ` Keith Owens
2002-07-09 14:00                 ` Pavel Machek
2002-07-02 15:20   ` Bill Davidsen
2002-07-02 15:53     ` Jonathan Corbet
2002-07-02 16:07       ` Oliver Neukum
2002-07-02 17:48         ` Tom Rini
2002-07-02 18:10           ` Oliver Neukum
2002-07-02 21:50             ` Ryan Anderson
2002-07-03 22:26               ` Diego Calleja
2002-07-04  0:00                 ` Keith Owens
2002-07-04  8:04               ` Helge Hafting
2002-07-02 16:08     ` Werner Almesberger
     [not found]   ` <Pine.LNX.3.95.1020702075957.24872A-100000@chaos.analogic.c om>
2002-07-04  8:36     ` Mike Galbraith
2002-07-03  0:09 ` Vojtech Pavlik
2002-07-12 21:51 ` David Lang
  -- strict thread matches above, loose matches on Subject: below --
2002-07-02  4:08 RE2: " Brian Gerst
2002-07-02  4:53 ` Keith Owens
2002-07-02  5:43   ` Werner Almesberger
2002-07-02 16:36     ` Werner Almesberger
2002-07-02 16:50       ` Benjamin Herrenschmidt
2002-07-02 18:05         ` Werner Almesberger
2002-07-03  3:50         ` Pavel Machek
2002-07-04  4:11       ` Bill Davidsen
2002-07-04  6:29         ` Werner Almesberger
2002-07-04  6:50           ` Werner Almesberger
2002-07-07 21:09             ` Jamie Lokier
2002-07-07 21:41               ` Oliver Neukum
2002-07-08  0:31                 ` Jamie Lokier
2002-07-08  6:42                   ` Oliver Neukum
2002-07-08  0:18               ` Bill Davidsen
2002-07-08  0:46                 ` Jamie Lokier
2002-07-08  6:22                   ` Daniel Phillips
2002-07-08 10:16                     ` Bill Davidsen
2002-07-09  0:07                   ` Werner Almesberger
2002-07-09  0:27                     ` Keith Owens
2002-07-09  3:09                       ` Werner Almesberger
2002-07-09  6:25                       ` Roman Zippel
2002-07-09  8:59                         ` Kai Germaschewski
2002-07-09 11:06                           ` Roman Zippel
2002-07-04 12:29           ` Bill Davidsen
2002-07-09  1:50           ` Kevin O'Connor
2002-07-09  2:37             ` Werner Almesberger
2002-07-02 23:35   ` Alexander Viro
2002-07-02 12:20 Ariel Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox