mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Cc: Alexander Viro <viro@math.psu.edu>,
	Linus Torvalds <torvalds@transmeta.com>,
	Patrick Mochel <mochel@osdl.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [bk/patch] driver model update: device_unregister()
Date: Fri, 11 Oct 2002 15:48:17 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0210102140390.338-100000@serv> (raw)
In-Reply-To: <Pine.LNX.4.44.0210101315240.10911-100000@chaos.physics.uiowa.edu>

Hi,

On Thu, 10 Oct 2002, Kai Germaschewski wrote:

> Well, a rmmod could potentially leave the module in "deleted" but not
> "freed" state for a long time. Basically the same thing which happens for
> your solution, where you call the state "cleanup". But I agree, this is
> not desirable at all (nor do I think your cleanup state is).

If exit() can fail, it avoids at least an unkillable rmmod, what makes a
module in the cleanup state IMO acceptable. It might look strange, but
it's still possible to remove the remaining users. The race is small
enough to be not really relevant and even if it does happen, it's not
exploitable, the cleanup will simply continue at a later point.
start()/stop() would give you better control over this. If a module still
has users after stopping it, you can still decide to start it again.

> However, the try_inc_mod_count() is only ever used in the slow
> registration paths (in the example e.g. for mounting, but not for accesses
> to a mounted file system), so performance is not an issue. And getting
> APIs exported to drivers right needs thinking, yes, but the module
> locking isn't even the hard part there, I would claim.

The problem is that we have conflicting methods for object management.
Driver objects have to use the module count, device object cannot use it
and have to use something else. Some objects (like proc entries) even have
to provide both.
Concentrating on a single mechanism will give us more flexibility and
simplicity.

> What you are doing is basically removing the infrastructure to get the use
> count right in a race-free way, and cope with the race by leaving modules
> in 'cleanup' but not 'freed' state until the users you raced with have
> gone away.

That "race" is nothing negativ here. You can also remove a file, while
it's still open and this will delay the release of the resources, until
then the file stays usable. A filesystem would behave the same, you
couldn't mount it anymore, but you can still see it used in /proc/mounts.
I don't think this is necessarly bad, it's just new and unfamiliar.

> BTW, the patch below also needs changes to each filesystem driver to
> return &fs->refcnt as ->use_count(), I think.

That's the other part of my proposal. A new style module would be defined
like this:

DEFINE_MODULE
	.init = ...
	...
DEFINE_MODULE_END

The new module layout allows to stack initialiations:

DEFINE_FS_MODULE
	.name = ...
	.init = ...
	...
DEFINE_FS_MODULE_END

This would already take care of most of the generic management of an fs
module.

bye, Roman


  reply	other threads:[~2002-10-11 13:43 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-09  0:57 Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  0:57 ` Patrick Mochel
2002-10-09  1:04   ` Alexander Viro
2002-10-09 16:38     ` Patrick Mochel
2002-10-09 17:14       ` Linus Torvalds
2002-10-09 17:24         ` Patrick Mochel
2002-10-09 17:26         ` Patrick Mochel
2002-10-09 17:41           ` Linus Torvalds
2002-10-09 17:46             ` Patrick Mochel
2002-10-09 17:50               ` Linus Torvalds
2002-10-10 21:19                 ` Rob Landley
2002-10-09 18:01             ` Jeff Muizlelaar
2002-10-09 17:33         ` Alexander Viro
2002-10-09 17:45           ` Linus Torvalds
2002-10-09 17:47             ` Alexander Viro
2002-10-09 17:55               ` Linus Torvalds
2002-10-09 18:00                 ` Alexander Viro
2002-10-09 18:47                   ` Linus Torvalds
2002-10-09 19:02                     ` Alexander Viro
2002-10-09 19:16                       ` Linus Torvalds
2002-10-09 19:26                         ` Alexander Viro
2002-10-09 19:47                           ` Linus Torvalds
2002-10-09 20:11                             ` Alexander Viro
2002-10-09 21:45                               ` Roman Zippel
2002-10-09 22:31                                 ` Kai Germaschewski
2002-10-10 18:04                                   ` Roman Zippel
2002-10-10 18:49                                     ` Kai Germaschewski
2002-10-11 13:48                                       ` Roman Zippel [this message]
2002-10-09 23:49                               ` Patrick Mochel
2002-10-10  7:11                                 ` Mike Anderson
2002-10-09 20:42                   ` Andries Brouwer
2002-10-15 22:18                     ` Daniel Phillips
2002-10-09 18:02                 ` Patrick Mochel
2002-10-09 18:04                   ` Alexander Viro
2002-10-09  0:57 ` Patrick Mochel
     [not found] <Pine.LNX.4.44.0210111725240.14124-100000@chaos.physics.uiowa.edu>
2002-10-12  0:47 ` Roman Zippel

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=Pine.LNX.4.44.0210102140390.338-100000@serv \
    --to=zippel@linux-m68k.org \
    --cc=kai@tp1.ruhr-uni-bochum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=torvalds@transmeta.com \
    --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

all inboxes | Powered by JetHome®