linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Helge Hafting <helgehaf@aitel.hist.no>
Cc: "Måns Rullgård" <mru@kth.se>, linux-kernel@vger.kernel.org
Subject: Re: udev sysfs docs Re: State of devfs in 2.6?
Date: Fri, 12 Dec 2003 11:26:36 +0000	[thread overview]
Message-ID: <20031212112636.GA12727@mail.shareable.org> (raw)
In-Reply-To: <3FD5AB6C.3040008@aitel.hist.no>

Helge Hafting wrote:
> And if you want to run this way with udev, set it up so device nodes
> don't get deleted when the device unloads.  That way you keep
> device nodes for your driverless devices, and when you try to open
> them the kernel runs modprobe for you.  Devfs isn't needed for that
> afaik, it is only needed for modprobing devices that doesn't have
> a /dev entry yet.
> 
> Your /dev will contain nodes both for driven and non-driven
> devices, but not for devices you don't have at all.


If anyone wants to do this _properly_, this is what to do:

    1. Let hotplug+udev load modules and create devices as they do now.

    2. Keep track of when devices are used, and when they are not busy.
       We already have this, it's the module reference count.

    3. When a device has not been used in a while, convert it to an
       "inactive" state.  In this state, the hardware device is made
       quiescent and interrupt handlers are unregistered (perhaps
       temporarily; the interrupt might still be claimed, but the
       handler must not be called).

       The power management hooks should be involved, as this is an
       ideal opportunity to power down a device to a low-power or off
       state, just like during APM/ACPI suspend.

    4. Make module code pages _demand-pagable_ from the original place
       where the module was loaded when all devices using the module
       are in the inactive state.

       This forces the module file to be kept open, so demand paging
       may be optionally disabled allowing the underlying fs to be
       unmounted.


This will create all the correct device entries for hardware which is
permanent or plugged in whether used or not; it will remove device
entries for hardware which is unplugged; it will retain state
across device opens, and it will save memory.

The traditional problems with making module code swappable are that
swapping is not safe in critical sections like interrupt handlers, and
you never know which modules are needed for swapping.  The former is
solved by locking the code in RAM while the devices are active and
have registered interrupt handlers (or other callbacks).  The latter
is obviously likely with the IDE or filesystem modules, but what if
I'm swapping over a multi-route network where the backup link is
on-demand PPP over a software modem over my ALSA driven radio card?

That last problem is not solved in general by the current
/etc/modprobe.conf method of loading whole modules on demand.  However
any system which works with whole module demand loading, and several
more, will work automatically with demand-paged modules.

A demand-paged module retains a reference to the filesystem it is
mounted on, and it may be generally assumed that the filesystem will
stay accessible e.g. as a local disk, boot-time accessible NFS,
initramfs, or even an embedded ROM.

If the filesystem's underlying device or network is dependent on a
module, the mount reference will ensure that device cannot enter the
inactive state, so the situation of a module being paged out which is
needed to page it back in won't arise, except in the most contrived
situations such as modules being loaded over NFS over an on-demand
network link.  Even then, the failure case is well confined: the
kernel's attempt to make a device "active" will fail in userspace at
the point where it tried to open the device, configure the network
interface or whatever else would cause a module to be demand loaded.

Now that the kernel parses ELF module files itself, this idea is much
more feasible than it once was.

-- Jamie

  reply	other threads:[~2003-12-12 11:26 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-08 15:36 State of devfs in 2.6? Andrew Walrond
2003-12-08 15:42 ` William Lee Irwin III
2003-12-08 15:59   ` Andrew Walrond
2003-12-08 23:38     ` Greg KH
2003-12-09 10:37       ` Andrew Walrond
2003-12-09 10:57         ` Måns Rullgård
2003-12-09 12:54         ` Paul P Komkoff Jr
2003-12-09  5:04     ` Rob Landley
2003-12-08 19:09   ` udev sysfs docs " Bob
2003-12-08 23:37     ` Greg KH
2003-12-09  5:17       ` Witukind
2003-12-09  7:21         ` Bob
2003-12-09  7:39           ` Matthew Reppert
2003-12-09  8:52             ` Måns Rullgård
2003-12-09  9:16             ` Greg KH
2003-12-09  9:45               ` Måns Rullgård
2003-12-09  9:18           ` Greg KH
2003-12-09  9:46           ` Andreas Jellinghaus
2003-12-09 10:25             ` Måns Rullgård
2003-12-09 15:28               ` Andreas Jellinghaus
2003-12-09 20:16               ` Oliver Hunt
2003-12-09 20:53                 ` Måns Rullgård
2003-12-09 22:14                   ` Olaf Hering
2003-12-09 22:46                   ` Oliver Hunt
2003-12-09 23:03                     ` Måns Rullgård
2003-12-09  7:56         ` Greg KH
2003-12-09  9:00           ` Xavier Bestel
2003-12-09  9:08             ` Greg KH
2003-12-09  9:19               ` Miles Bader
2003-12-09  9:39                 ` Måns Rullgård
2003-12-09 11:01                   ` Helge Hafting
2003-12-12 11:26                     ` Jamie Lokier [this message]
2003-12-12 13:33                       ` Duncan Sands
2003-12-12 14:51                         ` Jamie Lokier
2003-12-12 16:34                       ` Chuck Campbell
2003-12-12 17:13                         ` Chris Friesen
2003-12-12 17:17                         ` Måns Rullgård
2003-12-15  2:12                           ` Miles Bader
2003-12-15  3:51                             ` Mark Mielke
2003-12-15  6:09                             ` Tim Connors
2003-12-10 19:23                   ` Witukind
2003-12-10 19:33                     ` Måns Rullgård
2003-12-10 20:22                       ` Witukind
2003-12-10 20:47                         ` Ed Sweetman
2003-12-10 20:53                           ` Ed Sweetman
2003-12-10 21:31                             ` Witukind
2003-12-10 21:28                           ` Witukind
2003-12-10 21:48                             ` Måns Rullgård
2003-12-11  6:31                               ` Witukind
2003-12-10 21:49                           ` Måns Rullgård
2003-12-10 23:48                           ` Maciej Zenczykowski
2003-12-11  1:53                             ` Mark Mielke
2003-12-11  8:42                               ` Måns Rullgård
2003-12-11 16:33                                 ` Mark Mielke
2003-12-10 20:48                         ` Måns Rullgård
2003-12-10 23:40                       ` Maciej Zenczykowski
2003-12-09  9:55               ` Xavier Bestel
2003-12-09 13:03                 ` Maciej Zenczykowski
2003-12-09 15:01                   ` Helge Hafting
2003-12-09 18:30                   ` Greg KH
2003-12-09 18:53                     ` Måns Rullgård
2003-12-10  7:02                       ` Xavier Bestel
2003-12-10 20:06                         ` Witukind
2003-12-11  9:27                           ` Xavier Bestel
2003-12-11 10:15                             ` Måns Rullgård
2003-12-11 11:05                               ` Xavier Bestel
2003-12-10  0:38                 ` Greg KH
2003-12-09  9:26             ` Måns Rullgård
2003-12-09  9:41               ` Miles Bader
2003-12-10  8:13           ` Jakob Oestergaard
2003-12-10  8:24           ` Rob Landley
2003-12-08 23:04   ` Andreas Jellinghaus
2003-12-08 23:34     ` Greg KH
2003-12-09  0:31       ` Sven-Haegar Koch
2003-12-09  0:42         ` Greg KH
2003-12-09  0:51       ` [PATCH] sysfs support for vcs devices (was Re: State of devfs in 2.6?) Greg KH
2003-12-09  5:26       ` State of devfs in 2.6? Rob Landley
2003-12-09 18:19         ` Greg KH
2003-12-09 18:20         ` Greg KH
2003-12-09  7:02       ` Andreas Jellinghaus
2003-12-09  7:13         ` Murray J. Root
2003-12-09  8:21           ` Holger Schurig
2003-12-09  8:52             ` Miles Bader
2003-12-09 10:08               ` Holger Schurig
2003-12-09 17:10             ` Mark Mielke
2003-12-10  5:42               ` Greg KH
2003-12-10 23:29                 ` jw schultz
2003-12-11 20:32                 ` [2.4.23] cursor dissapears in framebuffer console after switching back from X Witukind
2003-12-11 23:59                   ` Gene Heskett
2003-12-12  6:24                     ` Witukind
2003-12-09  8:32         ` State of devfs in 2.6? Greg KH
2003-12-09  9:59           ` Jan Dittmer
2003-12-09 13:54             ` Matthew Reppert
2003-12-09 16:27             ` Greg KH
2003-12-09 16:47               ` Eduard Bloch
2003-12-09 19:33                 ` Greg KH
2003-12-10  2:15           ` Clemens Schwaighofer
2003-12-10  4:10             ` Bob
2003-12-09  7:33       ` Vojtech Pavlik
2003-12-09  9:48       ` Andreas Jellinghaus
2003-12-08 23:35 ` Greg KH

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=20031212112636.GA12727@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=helgehaf@aitel.hist.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mru@kth.se \
    /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).