linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Neukum <Oliver.Neukum@lrz.uni-muenchen.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: Unloading drivers, start-up, shut-down and a rewrite (a problem)
Date: Fri, 05 Oct 2001 08:16:32 +0000	[thread overview]
Message-ID: <marc-linux-hotplug-100227520911802@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-100216891319132@msgid-missing>

Am Freitag, 5. Oktober 2001 09:28 schrieb Keith Owens:
> On Fri, 05 Oct 2001 00:13:15 -0700,
>
> David Brownell <david-b@pacbell.net> wrote:

> >And FWIW, when I've thought of how to solve this "driver unload"
> >problem in a clean way that improves user-friendliness, that's just
> >what I end up wanting:  a devices-per-driver count that's distinct
> >from the existing uses-per-driver refcount.
>
> I am not convinced that we need a separate count, at least not at the
> bottom layer.  The module use count is a pure reference count on the
> module code, rmmod does not care what the types of reference are, rmmod
> just cares if it is safe to unload the code.

Yes. In last consequence only the kernel cares about reference counts.
Yet it is not a pure reference counter. It's possible for a module, though 
possibly not a good idea to bump the counter while eg running a timer.
In fact you need to bump it while handling probe() and disconnect().

> >Likely "rmmod" needs a flag that says whether the device count is
> >ignored, as (effectively) done today. Driver developers will want the
> >flexibility to say "remove this driver even though there's hardware
> >attached, I've got a bugfix".  USB developers work in that mode
> >today, it's quite handy.
>
> See above, I don't see any need to distinguish between references.  If
> the device is up then the module cannot be unloaded.  That does assume
> that all devices can be deactivated which is not currently true, to do
> this properly every device driver would need an up and a down routine.

The problem is not whether the driver can be unloaded without endangering
system integrity. It's about whether unloading a driver breaks the desired 
function. Else a perfectly usable device becomes driverless all of a sudden.
With the current design in unloading you need a seperate counter.

> I can add a use count up/down interface to kernel/module.c without
> waiting for every driver to be converted to an up/down interface.
> However we have to agree on a common design for drivers, I would hate
> to see some modules supporting up/down and others doing it a different
> way.

That would be helpful. And doing this in kernel makes handling errors in 
binding drivers to devices trivial.
For USB the core should handle it evaluating the return value of probe().
That needs a module* in the usb_device struct. On the other hand the 
conventional usage counters would be simplified by this.

	Regards
		Oliver

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2001-10-05  8:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-04  3:14 Unloading drivers, start-up, shut-down and a rewrite (a problem) Stamatis Mitrofanis
2001-10-04  4:29 ` Keith Owens
2001-10-05  0:03 ` Stamatis Mitrofanis
2001-10-05  5:58 ` Keith Owens
2001-10-05  6:25 ` David Hinds
2001-10-05  7:13 ` David Brownell
2001-10-05  7:21 ` David Brownell
2001-10-05  7:28 ` Keith Owens
2001-10-05  8:16 ` Oliver Neukum [this message]
2001-10-05  8:53 ` David Brownell
2001-10-05 15:26 ` David Hinds

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=marc-linux-hotplug-100227520911802@msgid-missing \
    --to=oliver.neukum@lrz.uni-muenchen.de \
    --cc=linux-hotplug@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).