mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Phillips <phillips@arcor.de>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Alexander Viro <viro@math.psu.edu>,
	"David S. Miller" <davem@redhat.com>, <adam@yggdrasil.com>,
	<R.E.Wolff@bitwizard.nl>, <linux-kernel@vger.kernel.org>
Subject: Re: Rusty's module talk at the Kernel Summit
Date: Thu, 11 Jul 2002 22:29:44 +0200	[thread overview]
Message-ID: <E17SkZM-0002Vp-00@starship> (raw)
In-Reply-To: <Pine.LNX.4.44.0207112059580.8911-100000@serv>

On Thursday 11 July 2002 21:48, Roman Zippel wrote:
> Hi,
> 
> On Thu, 11 Jul 2002, Daniel Phillips wrote:
> 
> > > Please check try_inc_mod_count(). It's already done.
> >
> > It's a good start, but it's not quite right.  Deregister_filesystem has to be
> > the authority on whether the module can be deleted or not, and there's no
> > interface for that at the moment.
> 
> That's right, but the filesystem code shows that this is not strictly
> necessary. In get_fs_type() you can't get access to a filesystem that will
> be removed, either it's first marked deleted or the use count is
> incremented, both are protected by the unload_lock. file_systems_lock now
> takes care that get_fs_type() doesn't see an invalid filesystem/owner
> pointer.

But that's crude and awkward.  Rmmod just needs deregister_filesystem in its
call chain and we're in great shape, without that fragile chain of
assumptions.

> > In short, it's close to the truth, but it's not quite there in its current
> > form.  Al said as much himself.
> 
> He was talking about a generic interface. I stared now long enough at
> that code, could anyone point me to where exactly is there a race in
> the filesystem code???

I believe the remaining race is rmmod-ret.  But it's not just a matter of
papering that over, the goal here is to get the thing into simplest form,
with an easily documentable interface that can be applied to the rest, or
almost all the rest of the module flavors.

I now have little doubt that even the complex module cases like (when it
happens) modular networking can be fit into the new module.  It comes
down to a pretty simple concept: you have a slow path *in the module*
that locks/unlocks the module in memory and knows the gory details of
active users, including spawned threads.  The fast paths don't have to
do any bookkeeping themselves.

Erm, by the way, there's the nasty detail of IO completion code in a
module.  This brings back the rmmod-ret race in a new incarnation;
even if the module's code keeps track of all submissions and
completions, there's no easy way to ensure the IO completion code
called from interrupt or soft irq context has returned to its caller.
I think the answer here is "just don't do it" - use the existing IO
completion handlers, and if they aren't good enough for some reason,
then we need a new, generic IO completion flavor that knows how to do
the required bookkeeping when it invokes the one in our module.
Bleh.

> IMO it's more complex than necessary (because it
> has to work around the problem that unregister can't fail), but it should
> work.

Let unregister be able to fail, why work around the borkness?  We
just need to be able to say -EBUSY to rmmod->remove so rmmod can duly
report that to the user.

> BTW this example shows also the limitation of the current module
> interface. It's impossible for a module to control itself, whether it can
> be unloaded or not. All code for this must be outside of this module,
> after __MOD_DEC_USE_COUNT() the module must not be touched anymore (so
> this call can't be inside of a module).

The module interface is under the knife, that's the whole point of
this.  Fortunately, what needs to be done is pretty minor.

-- 
Daniel

  reply	other threads:[~2002-07-11 20:27 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-04 17:24 Adam J. Richter
2002-07-11  2:48 ` Rusty Russell
2002-07-11  2:45   ` David S. Miller
2002-07-11  3:30     ` Alexander Viro
2002-07-11  5:13       ` Rusty Russell
2002-07-11  6:37         ` Alexander Viro
2002-07-11  7:14           ` Rusty Russell
2002-07-11 10:54             ` Daniel Phillips
2002-07-11 17:37               ` Roman Zippel
2002-07-11 18:01                 ` Thunder from the hill
2002-07-11 18:50                   ` Daniel Phillips
2002-07-17 18:16                   ` bill davidsen
2002-07-17 19:35                     ` Thunder from the hill
2002-07-11 18:28                 ` Daniel Phillips
2002-07-11 19:48                   ` Roman Zippel
2002-07-11 20:29                     ` Daniel Phillips [this message]
2002-07-11 23:37                     ` Alexander Viro
2002-07-12  1:54                       ` Daniel Phillips
2002-07-12  3:53                       ` Rusty Russell
2002-07-12  6:49                         ` Kai Henningsen
2002-07-12 11:30                       ` Roman Zippel
2002-07-12  0:00               ` Rusty Russell
2002-07-12  6:57                 ` Kai Henningsen
2002-07-19  0:19           ` Richard Gooch
2002-07-22 16:29             ` Alexander Viro
2002-07-23  4:37               ` Richard Gooch
2002-07-11  4:02     ` Cort Dougan
2002-07-11  4:19       ` Arnaldo Carvalho de Melo
2002-07-11  4:46       ` Cort Dougan
2002-07-11  2:55   ` Arnaldo Carvalho de Melo
2002-07-11  3:01     ` Arnaldo Carvalho de Melo
2002-07-11  5:16     ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2002-07-11  5:44 Adam J. Richter
2002-07-11  5:07 Adam J. Richter
2002-07-03 15:53 Adam J. Richter
2002-07-03 17:07 ` Hugh Dickins
2002-07-03 18:46   ` Oliver Neukum
2002-07-03 23:25     ` Keith Owens
2002-07-03 23:09 ` Keith Owens
2002-07-03  7:31 Adam J. Richter
2002-07-03  8:54 ` Rogier Wolff
2002-07-03 12:27 ` Keith Owens
2002-07-03 14:10   ` Keith Owens
2002-07-01 17:20 Adam J. Richter
2002-07-01 16:12 Adam J. Richter
2002-07-01 17:02 ` jlnance
2002-07-03  5:01 ` Keith Owens
2002-07-01  8:45 Keith Owens

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=E17SkZM-0002Vp-00@starship \
    --to=phillips@arcor.de \
    --cc=R.E.Wolff@bitwizard.nl \
    --cc=adam@yggdrasil.com \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=viro@math.psu.edu \
    --cc=zippel@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®