From: Daniel Phillips <phillips@arcor.de>
To: Rusty Russell <rusty@rustcorp.com.au>,
Alexander Viro <viro@math.psu.edu>
Cc: "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 12:54:42 +0200 [thread overview]
Message-ID: <E17Sbat-0002TF-00@starship> (raw)
In-Reply-To: <20020711071203.888A84275@lists.samba.org>
On Thursday 11 July 2002 09:14, Rusty Russell wrote:
> In message you write:
> > Not needed. Really not needed (just wait for a couple of days until
> > I get the infrastructure for race-free register/unregister on generic
> > stuff into submittable shape).
>
> Yes, I look forward to your code.
>
> There's no point discussing this until we see your solution, is there?
Except to say that this exactly mirrors my conclusion - after looking at all
the finicky, nasty ways there are of trying to count users of modules at the
call level I went back and looked at the filesystem interface, which is
already very nearly race free. It works by dumping the job of counting
subsystem users on the subsystem interface, instead of trying to make the
module interface do it.
In this case, counting users ends up being mount/unmount's job, which only
needs a simple interaction with register/unregister_filesystem to be
completely raceless. Then register/unregister are directly coupled to
insmod/rmmod so that, for instance, unregister can fail because rmmod called
it when it still had users.
Closing the rmmod race with this interface is easy. We can for example just
keep a state variable in the module struct (protected by a lock) to say the
module is in the process of being deregistered. The same state variable
prevents races during the registration process, that is, mount will not
succeed if the module is in the process of being registered. The rest of the
potential module races are in the symbol handling: the first thing insmod
does is create the symbol in the 'registering' state; the last thing it does
is remove it, while in the 'deregistering' state.
Note how the rmmod-during-ret race just disappeared, because rmmod directly
calls deregister, which either succeeds or doesn't. If it succeeds there are
no mounts on the module and everything is quiet, remove away. Easy huh?
Note also how we don't really have to divide up the 'deactivate' and
'destroy' parts of the deregistration process, though I can see why it still
might be useful to do that. Such refinements become a concern of the
filesystem machinery, not the module interface.
This is all by way of saying that Al is apparently well advanced in
implementing exactly the strategy I'd intended to demonstrate (Rusty and
Keith seem to be heading to the same place as well, by a twistier path). I'm
more than happy to bow out now, because I won't be waking up any more in the
middle of the night in a cold sweat brought on by fear of rmmod disappearing
from my favorite OS.
--
Daniel
next prev parent reply other threads:[~2002-07-11 17:03 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-04 17:24 Rusty's module talk at the Kernel Summit 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 [this message]
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
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=E17Sbat-0002TF-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 \
/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