linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
       [not found] <3A06A053.56F09ACB@mandrakesoft.com>
@ 2000-11-06 12:29 ` Keith Owens
  2000-11-06 17:07   ` Alan Cox
  2000-11-06 17:05 ` Alan Cox
  1 sibling, 1 reply; 113+ messages in thread
From: Keith Owens @ 2000-11-06 12:29 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: linux-kernel

On Mon, 06 Nov 2000 07:13:07 -0500, 
Jeff Garzik <jgarzik@mandrakesoft.com> wrote:
>...or, give up this silly nonsense about loading and unload modules on
>every open() and close().   A module load modifies the running kernel
>code... why do people do this on such a whim?
>
>Just load the driver at bootup and forget about it.  Problem solved.

I daily curse the name of whoever added autoload and autounload.
Autoload maybe useful, autounload is just asking for problems.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
       [not found] <3A06A053.56F09ACB@mandrakesoft.com>
  2000-11-06 12:29 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
@ 2000-11-06 17:05 ` Alan Cox
  2000-11-06 18:30   ` Paul Jakma
  2000-11-06 21:12   ` Martin Mares
  1 sibling, 2 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:05 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Alan Cox, David Woodhouse, Dan Hollis, Oliver Xymoron,
	Keith Owens, linux-kernel

> ...or, give up this silly nonsense about loading and unload modules on
> every open() and close().   A module load modifies the running kernel
> code... why do people do this on such a whim?
> 
> Just load the driver at bootup and forget about it.  Problem solved.

If the sound card is only used some of the time or setup and then used
for TV its nice to get the 60K + 128K DMA buffer back when you dont need it
especially on a low end box

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 12:29 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
@ 2000-11-06 17:07   ` Alan Cox
  2000-11-06 18:09     ` Martin Dalecki
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:07 UTC (permalink / raw)
  To: Keith Owens; +Cc: Jeff Garzik, linux-kernel

> >Just load the driver at bootup and forget about it.  Problem solved.
> 
> I daily curse the name of whoever added autoload and autounload.
> Autoload maybe useful, autounload is just asking for problems.

Deal with it. Hardware is also now auto load and auto unloading too. For 2.5
hopefully a lot of this can be tidied up and done better - persistent storage
in the modules that is written to disk and put back by insmod/rmmod (in 
userspace) will help a lot.

The locking issues are not going to go away. Home PC's are going more and
more USB oriented. Servers are going towards more and more hotswap cards.

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:09     ` Martin Dalecki
@ 2000-11-06 17:30       ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:30 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Alan Cox, Keith Owens, Jeff Garzik, linux-kernel

> Not quite: plugging physically hardware in and out is compleatly
> different
> then just loading a driver and unconditionally unloading it even when
> the hardware is still there!

Actually its no different.

Suppose I unplug my USB speakers and plug them back in again (perhaps Im just
adding a hub). Do you unload and reload the driver ? If so how do you preserve
the mixer levels ?

Same problem...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:07   ` Alan Cox
@ 2000-11-06 18:09     ` Martin Dalecki
  2000-11-06 17:30       ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: Martin Dalecki @ 2000-11-06 18:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: Keith Owens, Jeff Garzik, linux-kernel

Alan Cox wrote:
> 
> > >Just load the driver at bootup and forget about it.  Problem solved.
> >
> > I daily curse the name of whoever added autoload and autounload.
> > Autoload maybe useful, autounload is just asking for problems.
> 
> Deal with it. Hardware is also now auto load and auto unloading too. For 2.5
> hopefully a lot of this can be tidied up and done better - persistent storage
> in the modules that is written to disk and put back by insmod/rmmod (in
> userspace) will help a lot.

Not quite: plugging physically hardware in and out is compleatly
different
then just loading a driver and unconditionally unloading it even when
the hardware is still there!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:05 ` Alan Cox
@ 2000-11-06 18:30   ` Paul Jakma
  2000-11-06 21:12   ` Martin Mares
  1 sibling, 0 replies; 113+ messages in thread
From: Paul Jakma @ 2000-11-06 18:30 UTC (permalink / raw)
  To: Alan Cox
  Cc: Jeff Garzik, David Woodhouse, Dan Hollis, Oliver Xymoron,
	Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Alan Cox wrote:

> If the sound card is only used some of the time or setup and then used
> for TV its nice to get the 60K + 128K DMA buffer back when you dont need it
> especially on a low end box
> 

so unload it then - aiui most soundcards will continue passing through
the TV line? right?

or another argument: how common is this case that a box with such
tight memory is used in such a multi-purpose way (sometimes it
uses sounds, mostly not? and even then, for such a case, is it
reasonable to assume the user should deal with the memory
problems? (ie it's not unreasonable to expect them to have to do extra
fiddling with mixer levels).

but surely the vast majority of machines with soundcards have no good
reason for unloading them?

--paulj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:05 ` Alan Cox
  2000-11-06 18:30   ` Paul Jakma
@ 2000-11-06 21:12   ` Martin Mares
  2000-11-07  1:17     ` Horst von Brand
  2000-11-07 10:59     ` Martin Dalecki
  1 sibling, 2 replies; 113+ messages in thread
From: Martin Mares @ 2000-11-06 21:12 UTC (permalink / raw)
  To: Alan Cox, Vojtech Pavlik
  Cc: Jeff Garzik, David Woodhouse, Dan Hollis, Oliver Xymoron,
	Keith Owens, linux-kernel

Hi Alan!

> If the sound card is only used some of the time or setup and then used
> for TV its nice to get the 60K + 128K DMA buffer back when you dont need it
> especially on a low end box

So why don't we allocate / free the DMA buffer on device open / close instead
of module insert / remove?  If the reason lies in problems with allocation
of large chunks of contiguous memory, we're going to have exactly the same
problems when autoloading the module.

I think that automatic loading / unloading of modules has been a terrible hack
since its first days (although back in these times a useful one) and that the
era of its usefulness is over. There are zillions of problems with this
mechanism, the most important ones being:

   o  It would have to preserve _complete_ device state over module reload.
      For the sound card mixer settings discussed it's close to trivial, but
      for example consider a tape drive and the problem of preserving tape
      position after reload (probably including device reset causing tape rewind).
      And what about textures loaded to memory of a 3D video card?

   o  For many drivers, the "device currently open" concept makes no sense.
      Consider a mouse driver whose only activity is to feed mouse events
      to an event device. The mouse driver can be unloaded in any time (either
      manually or perhaps automatically after the mouse gets unplugged), hence
      it should have a use count == zero, but even if it seems to be unused,
      it must not be unloaded just because of some timeout since the mouse
      will cease to work.

   o  It interferes with hotplug in nasty ways. Let's have a USB host controller
      driver with currently no devices on its bus. It's also an example of a zero
      use count driver, but it also must not be unloaded as it's needed for
      recognizing newly plugged in devices.

I don't argue whether we need or need not some kind of persistent storage for
the modules (it might be a good idea when it comes to hotplug, but it should
be probably taken care of by the userspace hotplug helpers), but I think that
it has no chance to solve the problems with automatic unloading.

We could of course attempt to circumvent the problems listed above by adding
some hints to module state which will say whether it's possible to auto-unload
the module or not even if it has zero use count, but it means another thing
to handle in all the drivers (well, at least another thing to think of whether
it's needed or not for each driver) and I think that the total effect of
the autounloading mechanism (a minimum amount of memory saved) in no way
outweighs the cost of implementing it right.

				Have a nice fortnight
-- 
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"A mathematician is a machine for converting coffee into theorems."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 21:12   ` Martin Mares
@ 2000-11-07  1:17     ` Horst von Brand
  2000-11-07  9:59       ` Martin Mares
  2000-11-07 10:59     ` Martin Dalecki
  1 sibling, 1 reply; 113+ messages in thread
From: Horst von Brand @ 2000-11-07  1:17 UTC (permalink / raw)
  To: Martin Mares; +Cc: linux-kernel

Martin Mares <mj@suse.cz> said:

[...]

> I think that automatic loading / unloading of modules has been a terrible hack
> since its first days (although back in these times a useful one) and that the
> era of its usefulness is over. There are zillions of problems with this
> mechanism, the most important ones being:

Strange somebody from a distribution forgets _the_ most important use of
modules: Remember old-time Slackware, with dozens of different boot
diskettes, and the imperative to compile a kernel to your machine once you
got it running?

>    o  It would have to preserve _complete_ device state over module
>       reload.

If too hard, just leave it alone: Don't allow unloading.

>    o  For many drivers, the "device currently open" concept makes no
>       sense.

Ditto.

>    o It interferes with hotplug in nasty ways. Let's have a USB host
>      controller driver with currently no devices on its bus. It's also an
>      example of a zero use count driver, but it also must not be unloaded
>      as it's needed for recognizing newly plugged in devices.

Ditto.

> I don't argue whether we need or need not some kind of persistent storage
> for the modules (it might be a good idea when it comes to hotplug, but it
> should be probably taken care of by the userspace hotplug helpers), but I
> think that it has no chance to solve the problems with automatic
> unloading.

The cases mentioned are cases where unloading (automatic or manual, doesn't
matter) would break things. Just don't allow it, ever (IPv6 does this, for
one example). Or fix the loading/unloading somehow. Strategies to be able
to do so is what is being discussed here, BTW...

> We could of course attempt to circumvent the problems listed above by
> adding some hints to module state which will say whether it's possible to
> auto-unload the module or not even if it has zero use count,

Just force a non-zero count as long as the module is in use. Wait a
minute... that is exactly what a non-zero count is supposed to mean!

>                                                              but it means
> another thing to handle in all the drivers (well, at least another thing
> to think of whether it's needed or not for each driver) and I think that
> the total effect of the autounloading mechanism (a minimum amount of
> memory saved) in no way outweighs the cost of implementing it right.

What is a "minimal ammount of memory" on the 1+Gb RAM machines I've seen
discussed here isn't at all "minimal" for somebody who has to run Linux in
4Mb, preferably less...

Linux came to be what it is today in large part because the PC nobody
wanted anymore ("too slow", "can't run XYZ") became the router/firewall/web
server/mail server/... over in some closet, and soon nobody even remembered
where the machine was physically. Don't kill this.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  1:17     ` Horst von Brand
@ 2000-11-07  9:59       ` Martin Mares
  0 siblings, 0 replies; 113+ messages in thread
From: Martin Mares @ 2000-11-07  9:59 UTC (permalink / raw)
  To: Horst von Brand; +Cc: linux-kernel

Hello Horst!

> Strange somebody from a distribution forgets _the_ most important use of
> modules: Remember old-time Slackware, with dozens of different boot
> diskettes, and the imperative to compile a kernel to your machine once you
> got it running?

But how is this related to automatic unloading of modules???

Even automatic loading is not needed for this purpose -- just make the startup
scripts load all the modules needed and you don't have to maintain complex
mappings from userspace device names to kernel drivers.

> The cases mentioned are cases where unloading (automatic or manual, doesn't
> matter) would break things. Just don't allow it, ever (IPv6 does this, for
> one example). Or fix the loading/unloading somehow. Strategies to be able
> to do so is what is being discussed here, BTW...

No, the cases mentioned are cases where automatic unloading breaks things,
but manual unloading is perfectly okay. Nobody expects you to preserve exact
hardware state and keep things working if you unload the driver manually,
but automatic unload should be perfectly transparent.

> Just force a non-zero count as long as the module is in use. Wait a
> minute... that is exactly what a non-zero count is supposed to mean!

Yes, but define "in use".  Does your "in use" mean "referenced by user space
or by other drivers" (== cannot be unloaded without crashing the system)
or "unloading this module makes something cease to work"?  Currently, the
use counts maintained by the drivers correspond to the first definition
which is the right definition when it comes to manual unloading, but it
gives you no clue when it comes to transparent automatic unloading.

> What is a "minimal ammount of memory" on the 1+Gb RAM machines I've seen
> discussed here isn't at all "minimal" for somebody who has to run Linux in
> 4Mb, preferably less...
 
> Linux came to be what it is today in large part because the PC nobody
> wanted anymore ("too slow", "can't run XYZ") became the router/firewall/web
> server/mail server/... over in some closet, and soon nobody even remembered
> where the machine was physically. Don't kill this.

In routers dreaming the ancient dreams from the elder days of their creation,
you need all the modules loaded all the time anyway, hence automatic unloading
doesn't apply. Even better use a monolithic kernel since it saves in average
half a page per driver. (Yes, I know that current distributions don't ship with
precompiled kernels suiting your machine, but current distributions don't run
on a 4MB 386 anyway.)

Also, I'm not advocating killing compatibility with such old hardware (which
I frequently use), but I'd very much like to avoid hacking all the drivers
just to support correctly some (although sometimes useful) ill defined feature.

				Have a nice fortnight
-- 
Martin `MJ' Mares <mj@ucw.cz> <mj@suse.cz> http://atrey.karlin.mff.cuni.cz/~mj/
"ADA -- A Dumb Acronym"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 21:12   ` Martin Mares
  2000-11-07  1:17     ` Horst von Brand
@ 2000-11-07 10:59     ` Martin Dalecki
  2000-11-07 12:27       ` Alan Cox
  1 sibling, 1 reply; 113+ messages in thread
From: Martin Dalecki @ 2000-11-07 10:59 UTC (permalink / raw)
  To: Martin Mares
  Cc: Alan Cox, Vojtech Pavlik, Jeff Garzik, David Woodhouse,
	Dan Hollis, Oliver Xymoron, Keith Owens, linux-kernel

Martin Mares wrote:
> 
> Hi Alan!
> 
> > If the sound card is only used some of the time or setup and then used
> > for TV its nice to get the 60K + 128K DMA buffer back when you dont need it
> > especially on a low end box
> 
> So why don't we allocate / free the DMA buffer on device open / close instead
> of module insert / remove?  If the reason lies in problems with allocation
> of large chunks of contiguous memory, we're going to have exactly the same
> problems when autoloading the module.
> 
> I think that automatic loading / unloading of modules has been a terrible hack
> since its first days (although back in these times a useful one) and that the
> era of its usefulness is over. There are zillions of problems with this
> mechanism, the most important ones being:

Amen.

>    o  It would have to preserve _complete_ device state over module reload.
>       For the sound card mixer settings discussed it's close to trivial, but
>       for example consider a tape drive and the problem of preserving tape
>       position after reload (probably including device reset causing tape rewind).
>       And what about textures loaded to memory of a 3D video card?
> 
>    o  For many drivers, the "device currently open" concept makes no sense.
>       Consider a mouse driver whose only activity is to feed mouse events
>       to an event device. The mouse driver can be unloaded in any time (either
>       manually or perhaps automatically after the mouse gets unplugged), hence
>       it should have a use count == zero, but even if it seems to be unused,
>       it must not be unloaded just because of some timeout since the mouse
>       will cease to work.
> 
>    o  It interferes with hotplug in nasty ways. Let's have a USB host controller
>       driver with currently no devices on its bus. It's also an example of a zero
>       use count driver, but it also must not be unloaded as it's needed for
>       recognizing newly plugged in devices.

Plese add power-saving devices like in notebooks to the list as well.
For example in my notebook the PC speaker loops through the maestro-3e.
The BIOS is initializing the maestro with some sane mixer values but
after
a suspend cycle the pc speaker is compleatly off due to suspension of
the
maestro-3e chip and the leak of a *permanent* driver sitting around to
handle
the wakeup event.

> I don't argue whether we need or need not some kind of persistent storage for
> the modules (it might be a good idea when it comes to hotplug, but it should
> be probably taken care of by the userspace hotplug helpers), but I think that
> it has no chance to solve the problems with automatic unloading.
> 
> We could of course attempt to circumvent the problems listed above by adding
> some hints to module state which will say whether it's possible to auto-unload
> the module or not even if it has zero use count, but it means another thing
> to handle in all the drivers (well, at least another thing to think of whether
> it's needed or not for each driver) and I think that the total effect of
> the autounloading mechanism (a minimum amount of memory saved) in no way
> outweighs the cost of implementing it right.

And the pain for the user of the whole: Take the example of ALSA
over-modularisation...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 10:59     ` Martin Dalecki
@ 2000-11-07 12:27       ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-07 12:27 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: Martin Mares, Alan Cox, Vojtech Pavlik, Jeff Garzik,
	David Woodhouse, Dan Hollis, Oliver Xymoron, Keith Owens,
	linux-kernel

> Plese add power-saving devices like in notebooks to the list as well.
> For example in my notebook the PC speaker loops through the maestro-3e.
> The BIOS is initializing the maestro with some sane mixer values but
> after
> a suspend cycle the pc speaker is compleatly off due to suspension of
> the

Then you APM bios is not to specification. Don't inflict your bios bugs on
everyone but forcing policy.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:23                         ` Alan Cox
@ 2000-11-08 14:56                           ` Jamie Lokier
  0 siblings, 0 replies; 113+ messages in thread
From: Jamie Lokier @ 2000-11-08 14:56 UTC (permalink / raw)
  To: Alan Cox; +Cc: Horst von Brand, David Woodhouse, linux-kernel

Alan Cox wrote:
> Add a 'preserved' tag for one section of module memory. On load look up the
> data, if its from this boot memcpy it into the module. On unload write it
> back to disk. No kernel code needed.

I like!  No kernel code, yet no races or delay.

As written that removes the possibilities of variable length persistant
data, and the data is opaque to user space.

MODULE_PARM provides type information and structure to the data.  Why
not mark certain PARMS as persistent?  Not all would be named -- a block
of opaque data is useful.  But certain things like all the mixer levels
could be named parameters, giving you both persistant storage _and_
explicit configuration when you want that.  "s" PARMS (or similar)
can hold variable length data.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 12:49                                   ` James A. Sutherland
@ 2000-11-07 12:52                                     ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-07 12:52 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Alan Cox, James A. Sutherland, Dan Hollis, David Woodhouse,
	Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

> > eth0	pegasus
> > nopersist eth0
> > post-install eth0 /usr/local/sbin/my-dhcp-stuff
> 
> So, in short, this is already done perfectly well in userspace without some
> sort of Registry-style kernelside hack?

Thats the idea. Once the rmmod code can read back values the cycle is complete
and the kernel doesnt care

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 12:35                                 ` Alan Cox
  2000-11-07 12:49                                   ` James A. Sutherland
@ 2000-11-07 12:51                                   ` Petko Manolov
  1 sibling, 0 replies; 113+ messages in thread
From: Petko Manolov @ 2000-11-07 12:51 UTC (permalink / raw)
  To: Alan Cox
  Cc: James A. Sutherland, Dan Hollis, David Woodhouse, Jeff Garzik,
	Oliver Xymoron, Keith Owens, linux-kernel

Alan Cox wrote:
> 
> > In the NIC example, I might well want the DHCP client to run whenever I
> > activate the card. Bringing the NIC up with the old configuration - which, with
> > dynamic IP addresses, could now include someone else's IP address! - is worse
> > than useless.
> 
> You'll notice the pcmcia subsystem already handles this, and keeps data in user
> space although it doesnt support saving it back. And it all works
> 
> In your case it would be something like
> 
> eth0    pegasus
> nopersist eth0
> post-install eth0 /usr/local/sbin/my-dhcp-stuff


Oops! Don't try to do this with pegasus.c older than 0.4.13.
I have set the ethernet address at open time, which breaks
dhcpd. I fixed that in test-10, but it's release took a long
time.

Sorry if the note doesn't make sense, i didn't follow the
thread from the beginning.


	Petkan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 12:35                                 ` Alan Cox
@ 2000-11-07 12:49                                   ` James A. Sutherland
  2000-11-07 12:52                                     ` Alan Cox
  2000-11-07 12:51                                   ` Petko Manolov
  1 sibling, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07 12:49 UTC (permalink / raw)
  To: Alan Cox, James A. Sutherland
  Cc: Alan Cox, James A. Sutherland, Dan Hollis, David Woodhouse,
	Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

On Tue, 07 Nov 2000, Alan Cox wrote:
> > In the NIC example, I might well want the DHCP client to run whenever I
> > activate the card. Bringing the NIC up with the old configuration - which, with
> > dynamic IP addresses, could now include someone else's IP address! - is worse
> > than useless.
> 
> You'll notice the pcmcia subsystem already handles this, and keeps data in user
> space although it doesnt support saving it back. And it all works
> 
> In your case it would be something like
> 
> eth0	pegasus
> nopersist eth0
> post-install eth0 /usr/local/sbin/my-dhcp-stuff

So, in short, this is already done perfectly well in userspace without some
sort of Registry-style kernelside hack?


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 12:13                               ` James A. Sutherland
@ 2000-11-07 12:35                                 ` Alan Cox
  2000-11-07 12:49                                   ` James A. Sutherland
  2000-11-07 12:51                                   ` Petko Manolov
  0 siblings, 2 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-07 12:35 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Alan Cox, James A. Sutherland, Dan Hollis, David Woodhouse,
	Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

> In the NIC example, I might well want the DHCP client to run whenever I
> activate the card. Bringing the NIC up with the old configuration - which, with
> dynamic IP addresses, could now include someone else's IP address! - is worse
> than useless.

You'll notice the pcmcia subsystem already handles this, and keeps data in user
space although it doesnt support saving it back. And it all works

In your case it would be something like

eth0	pegasus
nopersist eth0
post-install eth0 /usr/local/sbin/my-dhcp-stuff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07 12:07                             ` Alan Cox
@ 2000-11-07 12:13                               ` James A. Sutherland
  2000-11-07 12:35                                 ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07 12:13 UTC (permalink / raw)
  To: Alan Cox, James A. Sutherland
  Cc: Alan Cox, James A. Sutherland, Dan Hollis, David Woodhouse,
	Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

On Tue, 07 Nov 2000, Alan Cox wrote:
> > When I plug it in and modprobe is triggered to load the driver, a script then
> > runs to feed the device appropriate configuration info. Since the driver only
> > resets the hardware when it is given the correct configuration, there's no
> > problem.
> 
> Thats another 100 lines of race prone network kernel code you dont need

Getting rid of 100 lines of code would certainly be worth doing...

Assuming I want the same configuration for the hardware as I did the last time
I used it is OK - provided that assumption is NOT in the kernel. As a default
behaviour in userspace, it's fine.

In the NIC example, I might well want the DHCP client to run whenever I
activate the card. Bringing the NIC up with the old configuration - which, with
dynamic IP addresses, could now include someone else's IP address! - is worse
than useless.

> > Hmm... define "identical". I take a laptop home, use a USB NIC to talk to my
> 
> Same Mac address or same serial number.

So if I take the NIC with me, Linux automagically misconfigures it for me. No
thanks.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:38                           ` James A. Sutherland
@ 2000-11-07 12:07                             ` Alan Cox
  2000-11-07 12:13                               ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-07 12:07 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Alan Cox, James A. Sutherland, Dan Hollis, David Woodhouse,
	Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

> When I plug it in and modprobe is triggered to load the driver, a script then
> runs to feed the device appropriate configuration info. Since the driver only
> resets the hardware when it is given the correct configuration, there's no
> problem.

Thats another 100 lines of race prone network kernel code you dont need

> Hmm... define "identical". I take a laptop home, use a USB NIC to talk to my

Same Mac address or same serial number.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 21:17                 ` Alan Cox
@ 2000-11-07  9:55                   ` Helge Hafting
  0 siblings, 0 replies; 113+ messages in thread
From: Helge Hafting @ 2000-11-07  9:55 UTC (permalink / raw)
  To: Alan Cox
  Cc: Eric W. Biederman, David Woodhouse, Oliver Xymoron, Keith Owens,
	linux-kernel

Alan Cox wrote:
> 
> > It would probably be better (in this case) to increment the module count
> > when the mixer settings go above 0, and decrement it when the settings
> > go totally to 0.  This prevents an unwanted unload.
> 
> Thats about 200 lines of code and also about 50,000 emails complaining people
> cannot unload sound stuff.

Still, it is so logical.  Modules cannot be unloaded when in use.
"use" is usually "someone having the device open".  But
"someone listening to pass-through sound" is effectively using
the mixer - the module is in use in another way.  Network drivers
don't have a /dev/xxx to open/close either.

Having to turn off the master volume before unloading makes sense
to me.  (The driver may still free up DMA buffers when
nobody need them, i.e. when /dev/dsp haven't been used for some time.)


Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 23:54                             ` Horst von Brand
@ 2000-11-07  8:44                               ` James A. Sutherland
  0 siblings, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  8:44 UTC (permalink / raw)
  To: Horst von Brand; +Cc: linux-kernel

On Mon, 06 Nov 2000, Horst von Brand wrote:
> "James A. Sutherland" <jas88@cam.ac.uk> said:
> > On Mon, 06 Nov 2000, Horst von Brand wrote:
> 
> [...]
> 
> > > The problem (AFAIU) is that if the levels aren't set on startup, they are
> > > random in some cases.
> 
> > So set them on startup. NOT when the driver is first loaded. Put it in
> > the rc.d scripts.
> 
> There is a noticeable delay between to moment the module is insmod(8)ed,
> and the moment when its settings are set by the startup script. Not funny
> if it is going full blast ATM.

Yes, I know. That's why the driver MUST NOT change the volume settings when
insmod(8)ed, waiting instead until it gets specific settings from the script,
at which point it can initialise the card to the correct settings without a
delay.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  1:20                                   ` Gerhard Mack
@ 2000-11-07  8:41                                     ` James A. Sutherland
  0 siblings, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  8:41 UTC (permalink / raw)
  To: Gerhard Mack; +Cc: linux-kernel

On Tue, 07 Nov 2000, Gerhard Mack wrote:
> > Then none of this is relevant to you, since you can't unload any modules! And
> > now you're the one doing the trolling... WTF do you think module code is
> > supposed to do when you don't use modules?!
> > 
> 
> Simple ... I'd rather the hardware was set to 0 on startup but I know what
> problems that presents to modules..
> 
> And no it wasn't the driver doing it afik. Sound card starts on max volume
> as soon as it's initialised.

Which is why I want the driver to initialise the card to "known-good" settings.
Defaulting to 0 is not good enough.

With my approach, the driver is loaded as part of the kernel, but does NOT
initialise the card, it just confirms it is there. Then, during boot, a script
will initialise the sound card with the correct settings explicitly. That way,
the delay between card init and the card getting the correct settings is
minimal, even on broken hardware like this.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
@ 2000-11-07  7:55 David Feuer
  0 siblings, 0 replies; 113+ messages in thread
From: David Feuer @ 2000-11-07  7:55 UTC (permalink / raw)
  To: linux-kernel

I've seen the same arguments over and over again here.  It seems that there 
are two feasible ways to accomplish persistence:  totally kernel and 
totally user-space

The totally kernel-space people want to make a way for modules to store 
persistent data, either in memory, or across boots on disk.  These people 
seem to debate whether modules should be unloaded/loaded upon suspend/resume.

Among the user-space people, there are some who want the status quo, where 
the driver initializes the card, and then a user proggy sets it up the way 
it really should be, which causes the gap problem.

There was also a suggestion (which sounded pretty interesting) where the 
driver would not initialize the card until prompted to do so by a 
user-space program, which would also give it the correct settings.  It 
seems that the big problem with this is that the card may not get 
initialized when it needs to be.  The initialization/state-saver proggy may 
have to be called: on boot, on suspend, on restore, when the hardware is 
physically removed and replaced, when something goes wrong and the user 
wants to reset things, and on shutdown.

I just wanted to try to get all the arguments together on one page.  I hope 
I didn't miss anything, or make any big mistakes.  My own guess is that the 
first option is the most reliable, and that the last one is the most flexible.
--
This message has been brought to you by the letter alpha and the number pi.
David Feuer
David_Feuer@brown.edu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 23:00                     ` Paul Jakma
@ 2000-11-07  2:11                       ` Keith Owens
  0 siblings, 0 replies; 113+ messages in thread
From: Keith Owens @ 2000-11-07  2:11 UTC (permalink / raw)
  To: Paul Jakma; +Cc: linux-kernel

On Mon, 6 Nov 2000 23:00:05 +0000 (GMT), 
Paul Jakma <paul@clubi.ie> wrote:
>On Mon, 6 Nov 2000, Alan Cox wrote:
>> Its called modules.conf. It has all these nice preload directives in it
>
>cool..
>
>doesn't seem to be documented though in modutils 2.3.17. what exactly
>does it do?

man modules.conf (yes, it _is_ documented).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:09               ` Eric W. Biederman
  2000-11-06 21:17                 ` Alan Cox
@ 2000-11-07  2:09                 ` Keith Owens
  1 sibling, 0 replies; 113+ messages in thread
From: Keith Owens @ 2000-11-07  2:09 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: David Woodhouse, Oliver Xymoron, linux-kernel

On 06 Nov 2000 11:09:41 -0700, 
ebiederm@xmission.com (Eric W. Biederman) wrote:
>Well we don't have auto unload.

Check crontab, if it contains rmmod -a then you have auto unload.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:34                             ` James A. Sutherland
  2000-11-07  0:42                               ` Gerhard Mack
@ 2000-11-07  1:44                               ` Horst von Brand
  1 sibling, 0 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-07  1:44 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel

"James A. Sutherland" <jas88@cam.ac.uk> said:

[...]

> That only happens if the driver is stupid enough to try guessing "correct"
> volume settings.

It did not touch anything: By a fluke, or by default, the sound output was
going full blast, and the mike input was patched over to it ==> feedback
shriek until (a few tenths of second later) the volume settings _were_ set.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:43                                 ` James A. Sutherland
@ 2000-11-07  1:20                                   ` Gerhard Mack
  2000-11-07  8:41                                     ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Gerhard Mack @ 2000-11-07  1:20 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel

> Then none of this is relevant to you, since you can't unload any modules! And
> now you're the one doing the trolling... WTF do you think module code is
> supposed to do when you don't use modules?!
> 

Simple ... I'd rather the hardware was set to 0 on startup but I know what
problems that presents to modules..

And no it wasn't the driver doing it afik. Sound card starts on max volume
as soon as it's initialised.

	Gerhard

--
Gerhard Mack

gmack@innerfire.net

<>< As a computer I find your faith in technology amusing.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:42                               ` Gerhard Mack
@ 2000-11-07  0:43                                 ` James A. Sutherland
  2000-11-07  1:20                                   ` Gerhard Mack
  0 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  0:43 UTC (permalink / raw)
  To: Gerhard Mack; +Cc: linux-kernel

On Tue, 07 Nov 2000, Gerhard Mack wrote:
> On Tue, 7 Nov 2000, James A. Sutherland wrote:
> 
> > On Mon, 06 Nov 2000, Gerhard Mack wrote:
> > > Sure .. lets see you start a laptop in class or buisness meeting and have
> > > everyone turn to look at you wondering why your laptop let off an ear
> > > piercing shreak because the hardware defaults to all settings max.
> > 
> > That only happens if the driver is stupid enough to try guessing "correct"
> > volume settings. If it leaves well alone until it KNOWS the correct settings,
> > there is no ear piercing shriek. Nor is there any break in the sound if you
> > were listening to something from the mixer.
> > 
> > > And you will _STILL_ have that shriek for 1/2 - 1 second before the
> > > userspace app loads.
> > 
> > Wrong. The userspace app is the one triggering the device init, when it gives
> > the sound driver the correct volume settings. There is no half second delay.
> > 
> > > And no we couldn't unplug either the mike or the speakers since they come
> > > embedded in the laptop's case. 
> > > 
> > > I don't see in any of your trolling an answer for this problem.
> > 
> > It isn't trolling, and there is a perfectly simple answer, as I have already
> > explained.
> > 
> 
> And if I don't use modules?

Then none of this is relevant to you, since you can't unload any modules! And
now you're the one doing the trolling... WTF do you think module code is
supposed to do when you don't use modules?!


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:34                             ` James A. Sutherland
@ 2000-11-07  0:42                               ` Gerhard Mack
  2000-11-07  0:43                                 ` James A. Sutherland
  2000-11-07  1:44                               ` Horst von Brand
  1 sibling, 1 reply; 113+ messages in thread
From: Gerhard Mack @ 2000-11-07  0:42 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel

On Tue, 7 Nov 2000, James A. Sutherland wrote:

> On Mon, 06 Nov 2000, Gerhard Mack wrote:
> > Sure .. lets see you start a laptop in class or buisness meeting and have
> > everyone turn to look at you wondering why your laptop let off an ear
> > piercing shreak because the hardware defaults to all settings max.
> 
> That only happens if the driver is stupid enough to try guessing "correct"
> volume settings. If it leaves well alone until it KNOWS the correct settings,
> there is no ear piercing shriek. Nor is there any break in the sound if you
> were listening to something from the mixer.
> 
> > And you will _STILL_ have that shriek for 1/2 - 1 second before the
> > userspace app loads.
> 
> Wrong. The userspace app is the one triggering the device init, when it gives
> the sound driver the correct volume settings. There is no half second delay.
> 
> > And no we couldn't unplug either the mike or the speakers since they come
> > embedded in the laptop's case. 
> > 
> > I don't see in any of your trolling an answer for this problem.
> 
> It isn't trolling, and there is a perfectly simple answer, as I have already
> explained.
> 

And if I don't use modules?

	Gerhard


--
Gerhard Mack

gmack@innerfire.net

<>< As a computer I find your faith in technology amusing.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:27                         ` Alan Cox
@ 2000-11-07  0:38                           ` James A. Sutherland
  2000-11-07 12:07                             ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  0:38 UTC (permalink / raw)
  To: Alan Cox, James A. Sutherland
  Cc: Dan Hollis, David Woodhouse, Jeff Garzik, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

On Tue, 07 Nov 2000, Alan Cox wrote:
> > changing settings. If I plug in a hotplug soundcard and load the driver, I do
> > NOT want the driver to decide to set some settings. If I want settings set,
> > I'll do it myself (or have a script to do it).
> 
> How about if your stuff is already nicely set up and you remove then replug
> a device,

When I plug it in and modprobe is triggered to load the driver, a script then
runs to feed the device appropriate configuration info. Since the driver only
resets the hardware when it is given the correct configuration, there's no
problem.

> or remove and swap for an identical replacement part. Most people then
> want the configuration preserved.

Hmm... define "identical". I take a laptop home, use a USB NIC to talk to my
LAN at home (using NAT) with a 192.168.* address. Then I take it elsewhere and
use the same model of NIC on the college LAN. All of a sudden, I get myself
banging on the door complaining about misconfigured NICs :-)
   
> And guess what the simple modutils solution using an ELF section solves that
> too Want to go to default configuration ?
> 
> 	rm /var/run/modules/eth0.data
> 
> or wrap it in a GUI.

That sounds a lot like what I've been advocating all along, if that file is
created/updated by a script when eth0's driver is unloaded, then fed back to
eth0 on load.

> [BTW windows gets the USB speaker state management right, seems they store all
> the module persistent data in the registry!]

Yes, that's what we need. A registry, so configuration problems can be
persistent across boots, and even reinstallations... ;-)


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 23:28                           ` Gerhard Mack
@ 2000-11-07  0:34                             ` James A. Sutherland
  2000-11-07  0:42                               ` Gerhard Mack
  2000-11-07  1:44                               ` Horst von Brand
  0 siblings, 2 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  0:34 UTC (permalink / raw)
  To: Gerhard Mack; +Cc: linux-kernel

On Mon, 06 Nov 2000, Gerhard Mack wrote:
> On Mon, 6 Nov 2000, James A. Sutherland wrote:
> 
> > Except this isn't possible with the hardware in question! If it were, there
> > would be no problem. In cases where the hardware doesn't support the
> > functionality userspace "needs", why put the kludge in the kernel?
> > 
> > If userspace wants to know what settings it set last time, it should store
> > those values somewhere.
> > 
> > > jas88@cam.ac.uk said:
> > > >  The right thing in this context is not to screw with hardware
> > > > settings unless and until it is given settings to set. Do not set
> > > > values arbitrarily: set only the values you are explicitly given.
> > > > Anything else is simply a bug in your driver. 
> > > 
> > > It is unwise to assume that the hardware is in a sane state when the driver 
> > > has been unloaded and reloaded. I agree that you should set the values that 
> > > were explicitly given. That's why we should remember them.
> > 
> > No values are being explicitly given. Loading the driver should not cause
> > any settings to be changed: changing the settings should do that!
> > 
> > There is no need for the drivers to change any settings. If the settings need
> > to be (re)set, let userspace do it.
> >  
> > 
> > James. 
> 
> Sure .. lets see you start a laptop in class or buisness meeting and have
> everyone turn to look at you wondering why your laptop let off an ear
> piercing shreak because the hardware defaults to all settings max.

That only happens if the driver is stupid enough to try guessing "correct"
volume settings. If it leaves well alone until it KNOWS the correct settings,
there is no ear piercing shriek. Nor is there any break in the sound if you
were listening to something from the mixer.

> And you will _STILL_ have that shriek for 1/2 - 1 second before the
> userspace app loads.

Wrong. The userspace app is the one triggering the device init, when it gives
the sound driver the correct volume settings. There is no half second delay.

> And no we couldn't unplug either the mike or the speakers since they come
> embedded in the laptop's case. 
> 
> I don't see in any of your trolling an answer for this problem.

It isn't trolling, and there is a perfectly simple answer, as I have already
explained.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 19:09                           ` Oliver Xymoron
@ 2000-11-07  0:32                             ` Horst von Brand
  0 siblings, 0 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-07  0:32 UTC (permalink / raw)
  To: Oliver Xymoron; +Cc: linux-kernel

Oliver Xymoron <oxymoron@waste.org> say:

[...]

> Ioctl (or alternate device for plan9 groupies) is fine. My point is final
> initialization of the device is obviously delayed until the firmware is
> loaded.

Let's play perverse: What if I load the module, but don't initialize the
firmware, then unload? The fact that the firmware has been initialized has
to be kept somewhere...
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-07  0:18                       ` James A. Sutherland
@ 2000-11-07  0:27                         ` Alan Cox
  2000-11-07  0:38                           ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-07  0:27 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Dan Hollis, David Woodhouse, Jeff Garzik, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

> changing settings. If I plug in a hotplug soundcard and load the driver, I do
> NOT want the driver to decide to set some settings. If I want settings set,
> I'll do it myself (or have a script to do it).

How about if your stuff is already nicely set up and you remove then replug
a device, or remove and swap for an identical replacement part. Most people then
want the configuration preserved.

And guess what the simple modutils solution using an ELF section solves that too
Want to go to default configuration ?

	rm /var/run/modules/eth0.data

or wrap it in a GUI.

[BTW windows gets the USB speaker state management right, seems they store all
the module persistent data in the registry!]


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 20:46                             ` Evan Jeffrey
@ 2000-11-07  0:23                               ` James A. Sutherland
  0 siblings, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  0:23 UTC (permalink / raw)
  To: Evan Jeffrey; +Cc: linux-kernel, hobbes

On Mon, 06 Nov 2000, Evan Jeffrey wrote:
> > On Mon, 06 Nov 2000, David Woodhouse wrote:
> > > 
> > > No. You have to reset the hardware fully each time you load the module. 
> > > Although you _expect_ it to be in the state in which you left it, you can't
> >  
> > > be sure of that. 
> > 
> > If a reset is needed, I think it should come explicitly from userspace.
>  
> Take Alan's example of a USB device, say USB audio.  If it is disconnected
> and reconnected to add a hub, or anything else, the device may shut itself
> down, go to an undefined state, or even power cycle (if it draws power from 
> the USB +5V).  Same with hot-swap PCI cards.  The driver *MUST* reset the 
> device on load.  If saving mixer levels through this kind of transition is 
> desired (which it evidentally is), the module load/unload code must save and 
> restore the settings.

I'm not convinced.

> This is exactly equivelent to reseting hardware after a warm boot. 

Interesting. If that were done, my last sound card wouldn't have worked at all
under Linux: it had to be initialised under DOS before loading Linux. Had Linux
then reset everything, I'd have been soundless!

> Who knows
> what the Windows driver did to your card in the mean time. 

Either it initialises it (as it does, in this case), and I want (even NEED) it
to STAY initialised (i.e. if your driver does an unnecessary reset, your driver
is broken), or it doesn't, and I'll reset the card with an ioctl.

> A device driver
> can only guarantee that nobody horkes with its hardware while it is loaded--
> In the interim, the driver may have been connected to another computer,
> accessed by another driver, or accessed from userspace (say, VMWare doing
> a pass through driver).

So provide the FACILITY to reset the card, IFF it is needed. There are cases
where resetting the card is just stupid: don't force stupidity by design into
the kernel.

> I personally like the idea of having insmod/rmmod do copy-out/copy-in from
> a cache file in userspace.  That way, if we need large data sets (a ROM
> image for something.)  they don't take up kernel space when not in use.
> Also, it allows people to have persistant settings across reboot through
> the same mechanism--avoiding duplicating information in shutdown/startup 
> scripts.

I prefer the idea of the drivers which need this coming with a suitable
interface (/dev or /proc item) and a script to do this when needed.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:55                     ` Dan Hollis
@ 2000-11-07  0:18                       ` James A. Sutherland
  2000-11-07  0:27                         ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-07  0:18 UTC (permalink / raw)
  To: Dan Hollis
  Cc: David Woodhouse, Jeff Garzik, Alan Cox, Oliver Xymoron,
	Keith Owens, linux-kernel

On Mon, 06 Nov 2000, Dan Hollis wrote:
> On Mon, 6 Nov 2000, James A. Sutherland wrote:
> > So autoload the module with a "dont_screw_with_mixer" option. When the kernel
> > first boots, initialise the mixer to suitable settings (load the module with 
> > "do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
> > the mixer settings on load.
> 
> You are asking for real trouble on hotplug hardware if you insist on this.

How so? There is no need for the driver to decide off its own bat to go
changing settings. If I plug in a hotplug soundcard and load the driver, I do
NOT want the driver to decide to set some settings. If I want settings set,
I'll do it myself (or have a script to do it).


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:12                           ` David Woodhouse
  2000-11-06 17:45                             ` James A. Sutherland
  2000-11-06 18:37                             ` Paul Jakma
@ 2000-11-07  0:04                             ` Horst von Brand
  2 siblings, 0 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-07  0:04 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel

David Woodhouse <dwmw2@infradead.org> said:

[...]

> No. You should initialise the hardware completely when the driver is 
> reloaded. Although the expected case is that the levels just happen to be 
> the same as the last time the module was loaded, you can't know that the 
> machine hasn't been suspended and resumed since then.

Oh? Suspending with the module loaded is forbidden then?
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:06                         ` David Woodhouse
  2000-11-06 17:25                           ` Alon Ziv
  2000-11-06 17:25                           ` David Woodhouse
@ 2000-11-06 23:57                           ` Horst von Brand
  2 siblings, 0 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-06 23:57 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel

David Woodhouse <dwmw2@infradead.org> said:
> vonbrand@inf.utfsm.cl said:
> >  No funny "persistent data" mechanisms or screwups when the worker
> > gets removed and reinserted. In many cases the data module could be
> > shared among several others, in other cases it would have to be able
> > lo load several times or manage several incarnations of its payload. 

> The reason I brought this up now is because Keith's new 
> inter_module_register stuff could easily be used to provide this 
> functionality _without_ the extra module remaining loaded.

AFAIU, this is a acknowledged wart, to be added if there is no sane way out.
Better just loose it before it gets into the kernel, no?
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:01                           ` James A. Sutherland
@ 2000-11-06 23:54                             ` Horst von Brand
  2000-11-07  8:44                               ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Horst von Brand @ 2000-11-06 23:54 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel

"James A. Sutherland" <jas88@cam.ac.uk> said:
> On Mon, 06 Nov 2000, Horst von Brand wrote:

[...]

> > The problem (AFAIU) is that if the levels aren't set on startup, they are
> > random in some cases.

> So set them on startup. NOT when the driver is first loaded. Put it in
> the rc.d scripts.

There is a noticeable delay between to moment the module is insmod(8)ed,
and the moment when its settings are set by the startup script. Not funny
if it is going full blast ATM.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Vin~a del Mar, Chile                               +56 32 672616
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:33                         ` James A. Sutherland
@ 2000-11-06 23:28                           ` Gerhard Mack
  2000-11-07  0:34                             ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Gerhard Mack @ 2000-11-06 23:28 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel

On Mon, 6 Nov 2000, James A. Sutherland wrote:

> Except this isn't possible with the hardware in question! If it were, there
> would be no problem. In cases where the hardware doesn't support the
> functionality userspace "needs", why put the kludge in the kernel?
> 
> If userspace wants to know what settings it set last time, it should store
> those values somewhere.
> 
> > jas88@cam.ac.uk said:
> > >  The right thing in this context is not to screw with hardware
> > > settings unless and until it is given settings to set. Do not set
> > > values arbitrarily: set only the values you are explicitly given.
> > > Anything else is simply a bug in your driver. 
> > 
> > It is unwise to assume that the hardware is in a sane state when the driver 
> > has been unloaded and reloaded. I agree that you should set the values that 
> > were explicitly given. That's why we should remember them.
> 
> No values are being explicitly given. Loading the driver should not cause
> any settings to be changed: changing the settings should do that!
> 
> There is no need for the drivers to change any settings. If the settings need
> to be (re)set, let userspace do it.
>  
> 
> James. 

Sure .. lets see you start a laptop in class or buisness meeting and have
everyone turn to look at you wondering why your laptop let off an ear
piercing shreak because the hardware defaults to all settings max.

And you will _STILL_ have that shriek for 1/2 - 1 second before the
userspace app loads.

And no we couldn't unplug either the mike or the speakers since they come
embedded in the laptop's case. 

I don't see in any of your trolling an answer for this problem.

	Gerhard

 

--
Gerhard Mack

gmack@innerfire.net

<>< As a computer I find your faith in technology amusing.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 21:18                   ` Alan Cox
@ 2000-11-06 23:00                     ` Paul Jakma
  2000-11-07  2:11                       ` Keith Owens
  0 siblings, 1 reply; 113+ messages in thread
From: Paul Jakma @ 2000-11-06 23:00 UTC (permalink / raw)
  To: Alan Cox
  Cc: Paul Jakma, David Woodhouse, Jeff Garzik, Dan Hollis,
	Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Alan Cox wrote:
> Its called modules.conf. It has all these nice preload directives in it

cool..

doesn't seem to be documented though in modutils 2.3.17. what exactly
does it do?

regards,
-- 
Paul Jakma	paul@clubi.ie
PGP5 key: http://www.clubi.ie/jakma/publickey.txt
-------------------------------------------
Fortune:
I finally went to the eye doctor.  I got contacts.  I only need them to
read, so I got flip-ups.
		-- Steven Wright

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
@ 2000-11-06 22:48 Wayne.Brown
  0 siblings, 0 replies; 113+ messages in thread
From: Wayne.Brown @ 2000-11-06 22:48 UTC (permalink / raw)
  Cc: Alan Cox, James A. Sutherland, David Woodhouse, Jeff Garzik,
	Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel



This sounds to me like the most flexible way to do it.  If the module accepts
parameters then those who want the sound card initialized at every load can put
the desired settings in modules.conf.  The rest of us can just initialize it
once at boot time and the rest of the time the settings will be left untouched.





James A.Sutherland <jas88@cam.ac.uk> on 11/06/2000 11:38:44 AM

To:   Alan Cox <alan@lxorguk.ukuu.org.uk>, jas88@cam.ac.uk (James A. Sutherland)
cc:   dwmw2@infradead.org (David Woodhouse), jgarzik@mandrakesoft.com (Jeff
      Garzik), goemon@anime.net (Dan Hollis), alan@lxorguk.ukuu.org.uk (Alan
      Cox), oxymoron@waste.org (Oliver Xymoron), kaos@ocs.com.au (Keith Owens),
      linux-kernel@vger.kernel.org (bcc: Wayne Brown/Corporate/Altec)

Subject:  Re: Persistent module storage [was Linux 2.4 Status / TODO page]



On Mon, 06 Nov 2000, Alan Cox wrote:
> > So autoload the module with a "dont_screw_with_mixer" option. When the
kernel
> > first boots, initialise the mixer to suitable settings (load the module with
> > "do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
> > the mixer settings on load.
>
> Which is part of what persistent module data lets you do. And without having
> to mess with dont_screw_with_mixer (which if you get it wrong btw can be
> fatal and hang the hardware)

Eh? You just load the driver once, probably on boot, to configure sane values.
This time round, you use an argument (or an ioctl or whatever) to specify the
values you want. (cat /etc/sysconfig/sound/defaultvolume > /dev/sound/mixer or
whatever). After that, the module can be unloaded and loaded as needed, without
any need to touch the mixer settings except in response to *explicit* "set
volume" commands from userspace.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 19:49                               ` Rogier Wolff
@ 2000-11-06 21:34                                 ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:34 UTC (permalink / raw)
  To: Rogier Wolff; +Cc: Alan Cox, Alon Ziv, David Woodhouse, linux-kernel

> > 	if exists && is from this boot then && is right size
> > 		read data into __persistent ELF section
> > 	endif
> 
> Alan, why are you stating "if it's from this boot"? I can think that
> maybe you want to keep stuff across boots too. Maybe once we're at it,
> have two sections. One that is persistent across boots, the other
> isn't.

Possibly. The cases brought up so far are all 'within one boot'. But I agree
you could add long term persistent data if there was a need

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 19:27                             ` Tim Riker
@ 2000-11-06 21:33                               ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:33 UTC (permalink / raw)
  To: Tim Riker; +Cc: David Woodhouse, linux-kernel

> Barring this, we could create a persistantdata module that we can
> modprobe and then discover with Keith's inter_module_xxx and read/write
> opaque data to/from. Then if the user does not want to use it they can
> just "alias persistantdata off" it and poof.

All of this is kernel code we don't need.  Its not a good solution generically
or otherwise. Modutils should just use the persistent data stuff that has hooks
ready to roll already.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:39                       ` Paul Jakma
@ 2000-11-06 21:28                         ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:28 UTC (permalink / raw)
  To: Paul Jakma
  Cc: Alan Cox, James A. Sutherland, David Woodhouse, Jeff Garzik,
	Dan Hollis, Oliver Xymoron, Keith Owens, linux-kernel

> the sound card case for persistent modules is contentious i think.
> what other good reasons are there for persistent data?

Maintaining TV tuning
Maintaining configuration options for USB
Maintaining radio tuner frequencies
Speeding up module reloading (avoiding expensive re-inits - eg 30 seconds for
i2o_scsi)
Remembering IDE tuning options across ide module unloads
Avoiding rescanning the scsi bus on a scsi module reload
...


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:37                         ` Jeff Garzik
  2000-11-06 19:09                           ` Oliver Xymoron
@ 2000-11-06 21:19                           ` Alan Cox
  1 sibling, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:19 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Oliver Xymoron, David Woodhouse, Alan Cox, Keith Owens, linux-kernel

> Some devices have a firmware.h that is compiled into the driver.  A few
> sound devices use a function that loads a firmware file from userspace,
> given a filename.  The comment in drivers/sound/sound_firmware.c says
> that this is a poor method, and that the recommended method for
> uploading firmware to a device is via ioctl.

modutils has a post-install facility that supports firmware load via ioctl
beautifully too

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:22                 ` Paul Jakma
@ 2000-11-06 21:18                   ` Alan Cox
  2000-11-06 23:00                     ` Paul Jakma
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:18 UTC (permalink / raw)
  To: Paul Jakma
  Cc: David Woodhouse, Jeff Garzik, Dan Hollis, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

> i'd also like to see dist's adopt a nice config file specifying which
> modules to statically load at boot-time. (i know i want i them
> loaded). then maybe info from depmod could be applied to remove
> redundant loads.

Its called modules.conf. It has all these nice preload directives in it

> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:09               ` Eric W. Biederman
@ 2000-11-06 21:17                 ` Alan Cox
  2000-11-07  9:55                   ` Helge Hafting
  2000-11-07  2:09                 ` Keith Owens
  1 sibling, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 21:17 UTC (permalink / raw)
  To: Eric W. Biederman
  Cc: David Woodhouse, Oliver Xymoron, Keith Owens, linux-kernel

> It would probably be better (in this case) to increment the module count
> when the mixer settings go above 0, and decrement it when the settings 
> go totally to 0.  This prevents an unwanted unload.

Thats about 200 lines of code and also about 50,000 emails complaining people
cannot unload sound stuff.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:53                           ` James A. Sutherland
@ 2000-11-06 20:46                             ` Evan Jeffrey
  2000-11-07  0:23                               ` James A. Sutherland
  0 siblings, 1 reply; 113+ messages in thread
From: Evan Jeffrey @ 2000-11-06 20:46 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: linux-kernel, hobbes


> On Mon, 06 Nov 2000, David Woodhouse wrote:
> > 
> > No. You have to reset the hardware fully each time you load the module. 
> > Although you _expect_ it to be in the state in which you left it, you can't
>  
> > be sure of that. 
> 
> If a reset is needed, I think it should come explicitly from userspace.
 
Take Alan's example of a USB device, say USB audio.  If it is disconnected
and reconnected to add a hub, or anything else, the device may shut itself
down, go to an undefined state, or even power cycle (if it draws power from 
the USB +5V).  Same with hot-swap PCI cards.  The driver *MUST* reset the 
device on load.  If saving mixer levels through this kind of transition is 
desired (which it evidentally is), the module load/unload code must save and 
restore the settings.

This is exactly equivelent to reseting hardware after a warm boot.  Who knows
what the Windows driver did to your card in the mean time.  A device driver
can only guarantee that nobody horkes with its hardware while it is loaded--
In the interim, the driver may have been connected to another computer,
accessed by another driver, or accessed from userspace (say, VMWare doing
a pass through driver).

I personally like the idea of having insmod/rmmod do copy-out/copy-in from
a cache file in userspace.  That way, if we need large data sets (a ROM
image for something.)  they don't take up kernel space when not in use.
Also, it allows people to have persistant settings across reboot through
the same mechanism--avoiding duplicating information in shutdown/startup 
scripts.

Evan
---
Fear is the mind killer.   -- Frank Herbert, "Dune"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:34                             ` Alan Cox
@ 2000-11-06 19:49                               ` Rogier Wolff
  2000-11-06 21:34                                 ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: Rogier Wolff @ 2000-11-06 19:49 UTC (permalink / raw)
  To: Alan Cox; +Cc: Alon Ziv, David Woodhouse, linux-kernel

Alan Cox wrote:
> A simple more generic solution is to do this

[....]

> 	if exists && is from this boot then && is right size
> 		read data into __persistent ELF section
> 	endif

Alan, why are you stating "if it's from this boot"? I can think that
maybe you want to keep stuff across boots too. Maybe once we're at it,
have two sections. One that is persistent across boots, the other
isn't.

				Roger. 

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:25                           ` David Woodhouse
@ 2000-11-06 19:27                             ` Tim Riker
  2000-11-06 21:33                               ` Alan Cox
  0 siblings, 1 reply; 113+ messages in thread
From: Tim Riker @ 2000-11-06 19:27 UTC (permalink / raw)
  To: David Woodhouse, linux-kernel

Could we handle this by setting a nomixerreset=1 option in modules.conf
or as the module default that would effect module reloads. Then on boot
up explicitly modprobe with a mixerlevel=0 and then set the levels via
aumix etc?

This way the existing hardware can keep the levels if it knows how. As
mentioned there would also have to be a setlevels user script called
after suspend/resume.

Barring this, we could create a persistantdata module that we can
modprobe and then discover with Keith's inter_module_xxx and read/write
opaque data to/from. Then if the user does not want to use it they can
just "alias persistantdata off" it and poof.

David Woodhouse wrote:
> 
> alonz@usa.net said:
> > The best solution to the sound driver issue, IMHO, is still entirely
> > userspace--- just no-one has written it yet. What we should do: 1.
> > Before auto-unload of the driver, run a small utility which will read
> > mixer settings
> >    and save them somewhere 2. When auto-loading the driver, use driver
> > arguments which are initialized from the
> >    settings saved above
> 
> That could work, although it may be better to make it more generic and
> capable of handling any form of data.
> 
> Any form of persistent storage would do - and if it can be handled entirely
> in userspace, all the better. I merely pointed out that Keith's
> inter_module_xxx could provide this quite cleanly. Others disputed that it
> was required at all.
> 
> --
> dwmw2
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/

-- 
Tim Riker - http://rikers.org/ - short SIGs! <g>
All I need to know I could have learned in Kindergarten
... if I'd just been paying attention.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:37                         ` Jeff Garzik
@ 2000-11-06 19:09                           ` Oliver Xymoron
  2000-11-07  0:32                             ` Horst von Brand
  2000-11-06 21:19                           ` Alan Cox
  1 sibling, 1 reply; 113+ messages in thread
From: Oliver Xymoron @ 2000-11-06 19:09 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: David Woodhouse, Alan Cox, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Jeff Garzik wrote:

> Oliver Xymoron wrote:
> > 
> > On Mon, 6 Nov 2000, David Woodhouse wrote:
> > 
> > > The point here is that although I've put up with just keeping the sound
> > > driver loaded for the last few years, permanently taking up a large amount
> > > of DMA memory, the inter_module_xxx stuff that Keith is proposing would
> > > give us a simple way of storing the data which we want to store.
> > ...
> > > Being able to do it completely in userspace would be neater, though.
> > 
> > I think there are a bunch of other devices that need stuff from userspace
> > before they fully init, namely the ones that load proprietary firmware
> > images. Will an approach like that work here?
> 
> Some devices have a firmware.h that is compiled into the driver.  A few
> sound devices use a function that loads a firmware file from userspace,
> given a filename.  The comment in drivers/sound/sound_firmware.c says
> that this is a poor method, and that the recommended method for
> uploading firmware to a device is via ioctl.

Ioctl (or alternate device for plan9 groupies) is fine. My point is final
initialization of the device is obviously delayed until the firmware is
loaded. Adopting a similar strategy for initializing mixers (possibly
falling back to initializing with zero levels) minimizes the window
between resetting a device and having sane mixer settings.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:35                   ` James A. Sutherland
  2000-11-06 17:12                     ` Alan Cox
@ 2000-11-06 18:55                     ` Dan Hollis
  2000-11-07  0:18                       ` James A. Sutherland
  1 sibling, 1 reply; 113+ messages in thread
From: Dan Hollis @ 2000-11-06 18:55 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: David Woodhouse, Jeff Garzik, Alan Cox, Oliver Xymoron,
	Keith Owens, linux-kernel

On Mon, 6 Nov 2000, James A. Sutherland wrote:
> So autoload the module with a "dont_screw_with_mixer" option. When the kernel
> first boots, initialise the mixer to suitable settings (load the module with 
> "do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
> the mixer settings on load.

You are asking for real trouble on hotplug hardware if you insist on this.

-Dan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:12                     ` Alan Cox
  2000-11-06 17:38                       ` James A. Sutherland
@ 2000-11-06 18:39                       ` Paul Jakma
  2000-11-06 21:28                         ` Alan Cox
  1 sibling, 1 reply; 113+ messages in thread
From: Paul Jakma @ 2000-11-06 18:39 UTC (permalink / raw)
  To: Alan Cox
  Cc: James A. Sutherland, David Woodhouse, Jeff Garzik, Dan Hollis,
	Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Alan Cox wrote:

> Which is part of what persistent module data lets you do. And without having
> to mess with dont_screw_with_mixer (which if you get it wrong btw can be 
> fatal and hang the hardware)
> 

the sound card case for persistent modules is contentious i think.

what other good reasons are there for persistent data?

--paulj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:22                       ` Oliver Xymoron
@ 2000-11-06 18:37                         ` Jeff Garzik
  2000-11-06 19:09                           ` Oliver Xymoron
  2000-11-06 21:19                           ` Alan Cox
  0 siblings, 2 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 18:37 UTC (permalink / raw)
  To: Oliver Xymoron; +Cc: David Woodhouse, Alan Cox, Keith Owens, linux-kernel

Oliver Xymoron wrote:
> 
> On Mon, 6 Nov 2000, David Woodhouse wrote:
> 
> > The point here is that although I've put up with just keeping the sound
> > driver loaded for the last few years, permanently taking up a large amount
> > of DMA memory, the inter_module_xxx stuff that Keith is proposing would
> > give us a simple way of storing the data which we want to store.
> ...
> > Being able to do it completely in userspace would be neater, though.
> 
> I think there are a bunch of other devices that need stuff from userspace
> before they fully init, namely the ones that load proprietary firmware
> images. Will an approach like that work here?

Some devices have a firmware.h that is compiled into the driver.  A few
sound devices use a function that loads a firmware file from userspace,
given a filename.  The comment in drivers/sound/sound_firmware.c says
that this is a poor method, and that the recommended method for
uploading firmware to a device is via ioctl.

	Jeff


-- 
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:12                           ` David Woodhouse
  2000-11-06 17:45                             ` James A. Sutherland
@ 2000-11-06 18:37                             ` Paul Jakma
  2000-11-07  0:04                             ` Horst von Brand
  2 siblings, 0 replies; 113+ messages in thread
From: Paul Jakma @ 2000-11-06 18:37 UTC (permalink / raw)
  To: David Woodhouse
  Cc: James A. Sutherland, Horst von Brand, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, David Woodhouse wrote:

> No. You should initialise the hardware completely when the driver is 
> reloaded.

and it is. just that 'mixer levels' are subjective - different users
have different tastes. in what way does:

- init to mute
- user set to liking

fail people? 

(sound modules shouldn't be unloaded as a matter of course, and user
set can be done with post-install option of modules.conf)

> the same as the last time the module was loaded, you can't know that the 
> machine hasn't been suspended and resumed since then.
> 

reloading modules may be a neccessary hack at present to reinit the
drivers after suspend/resume, but surely the correct answer there is
to go fix power management. the modules are not unloaded by the kernel
as part of the suspend event and they are not loaded as part of the
resume event. the module persists across the power event, so if
something breaks, go fix the power management handling - the driver
doesn't handle it properly!

--paulj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:34                     ` David Woodhouse
@ 2000-11-06 18:22                       ` Oliver Xymoron
  2000-11-06 18:37                         ` Jeff Garzik
  0 siblings, 1 reply; 113+ messages in thread
From: Oliver Xymoron @ 2000-11-06 18:22 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Alan Cox, Jeff Garzik, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, David Woodhouse wrote:

> The point here is that although I've put up with just keeping the sound 
> driver loaded for the last few years, permanently taking up a large amount 
> of DMA memory, the inter_module_xxx stuff that Keith is proposing would 
> give us a simple way of storing the data which we want to store. 
...
> Being able to do it completely in userspace would be neater, though.

I think there are a bunch of other devices that need stuff from userspace
before they fully init, namely the ones that load proprietary firmware
images. Will an approach like that work here?

Alternately, we could have a "virtual module" called mixer-settings-n,
which when requested would tell modprobe to call a program to do its
fiddly things but wouldn't actually load a module.

The virtual module idea is ugly, yes, and perhaps what's needed is a more
generic userspace hook interface. Something that merged what
/sbin/hotplug, /sbin/modprobe, and the much-talked-about devfsd-like
notifier are supposed to do.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:37               ` David Woodhouse
                                   ` (2 preceding siblings ...)
  2000-11-06 15:15                 ` Martin Dalecki
@ 2000-11-06 18:22                 ` Paul Jakma
  2000-11-06 21:18                   ` Alan Cox
  3 siblings, 1 reply; 113+ messages in thread
From: Paul Jakma @ 2000-11-06 18:22 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

On Mon, 6 Nov 2000, David Woodhouse wrote:


> * Sound module is autoloaded again, default to zero levels.

so you use the 'post-install' option of modules.conf to run your
mixer-level setting script.

> 	This time it is _NOT_ fine. User is rightly pissed off :)
> 

even better: is there any pressing need for /all/ modules to be
auto-unloaded? things like sound modules should be statically loaded
at boot time and never removed for 99% of workstations i think.

i'd also like to see dist's adopt a nice config file specifying which
modules to statically load at boot-time. (i know i want i them
loaded). then maybe info from depmod could be applied to remove
redundant loads.

> The inter_module_xxx() stuff would facilitate this quite nicely.
> 

but if userspace can do it just as easily... (in the case of sound
modules anyway)

> --
> dwmw2

--paulj

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  8:02             ` David Woodhouse
@ 2000-11-06 18:09               ` Eric W. Biederman
  2000-11-06 21:17                 ` Alan Cox
  2000-11-07  2:09                 ` Keith Owens
  0 siblings, 2 replies; 113+ messages in thread
From: Eric W. Biederman @ 2000-11-06 18:09 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse <dwmw2@infradead.org> writes:

> The current situation is equivalent to stopping forwarding packets each
> time an app on the local machine decides it wants to send its own packets,
> after a period of inactivity.
> 
> Defaulting to zero on boot is fine. Defaulting to zero after the module
> has been auto-unloaded and auto-loaded again is less good.

Well we don't have auto unload.
And module persistent data for the second load case causes chaos with 
the goal of having exactly the same code in modules and compiled in
kernel code.

It would probably be better (in this case) to increment the module count
when the mixer settings go above 0, and decrement it when the settings 
go totally to 0.  This prevents an unwanted unload.

But for reliability and code simplicity there does not yet seem to
be a case for persistent module storage.

Eric
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:31                       ` Horst von Brand
  2000-11-06 17:06                         ` David Woodhouse
  2000-11-06 17:23                         ` Alan Cox
@ 2000-11-06 18:00                         ` Martin Dalecki
  2000-11-06 17:29                           ` Alan Cox
  2 siblings, 1 reply; 113+ messages in thread
From: Martin Dalecki @ 2000-11-06 18:00 UTC (permalink / raw)
  To: Horst von Brand; +Cc: David Woodhouse, linux-kernel

Horst von Brand wrote:
> 
> David Woodhouse <dwmw2@infradead.org> said:
> > jas88@cam.ac.uk said:
> > >  Irrelevant. The current mixer settings don't matter: what matters is
> > > that the driver does not change them.
> 
> > It does matter. The sound driver needs to be able to _read_ the current
> > levels. Almost all mixer programs will start by doing this, to set the
> > slider to the correct place.
> 
> OK, how then using _2_ modules, data and worker:

People that's all designing for the sake of design.
And it's trying to solve a non existant problem:
Just load the damn module once and leave it there where it is.
Drivers are supposed to handle present hardware - if the hardware
is there - there should be a driver handling it as well.
The argument for saving some memmory is nonapplicable becouse in
the case of expected usage in the future you have anyway to assume that
in this futere there will be sufficient memmory for it there. And then
please remember that all possible space savings are in the granularity
of
pages!

Could some one add this to the FAQ ... please!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:44                         ` David Woodhouse
@ 2000-11-06 17:53                           ` James A. Sutherland
  2000-11-06 20:46                             ` Evan Jeffrey
  0 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 17:53 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jas88@cam.ac.uk said:
> >  Except this isn't possible with the hardware in question! If it were,
> > there would be no problem. In cases where the hardware doesn't support
> > the functionality userspace "needs", why put the kludge in the kernel?
> 
> > If userspace wants to know what settings it set last time, it should
> > store those values somewhere.
> 
> No. You have to reset the hardware fully each time you load the module. 
> Although you _expect_ it to be in the state in which you left it, you can't 
> be sure of that. 

If a reset is needed, I think it should come explicitly from userspace.

> jas88@cam.ac.uk said:
> > Eh? You just load the driver once, probably on boot, to configure sane
> > values. This time round, you use an argument (or an ioctl or whatever)
> > to specify the values you want. (cat /etc/sysconfig/sound/
> > defaultvolume > /dev/sound/mixer or whatever). After that, the module
> > can be unloaded and loaded as needed, without any need to touch the
> > mixer settings except in response to *explicit* "set volume" commands
> > from userspace. 
> 
> Agreed. Where 'whatever' == persistent storage of some form. I care not 
> what form that takes. If you can store the data entirely in userspace and 
> still have them present at the time the driver initialises the hardware, 
> that's fine. 

That's what I've been getting at all along...

Probably have a simple load and unload script, which dumps state to a file
on unload, and restores it on load. Whenever the module's state is not saved,
the refcount is >0, so you can't unload it without saving state.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:12                           ` David Woodhouse
@ 2000-11-06 17:45                             ` James A. Sutherland
  2000-11-06 18:37                             ` Paul Jakma
  2000-11-07  0:04                             ` Horst von Brand
  2 siblings, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 17:45 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Horst von Brand, Keith Owens, linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jas88@cam.ac.uk said:
> >  So set them on startup. NOT when the driver is first loaded. Put it
> > in the rc.d scripts. 
> 
> No. You should initialise the hardware completely when the driver is 
> reloaded. Although the expected case is that the levels just happen to be 
> the same as the last time the module was loaded, you can't know that the 
> machine hasn't been suspended and resumed since then.

If suspend/resume changes the settings of the card, you need to deal with that
as a separate issue - otherwise resume isn't restoring things properly. Perhaps
you need to prevent module unloading. Just restoring the correct settings when
the driver is loaded is definitely too late.

> jas88@cam.ac.uk said:
> >  No need. Let userspace save it somewhere, if that's needed. 
> 
> Don't troll, James. Reread the thread and see why doing it in userspace is 
> too late.

Why is it too late? There is no need for the driver to set *any* volume levels
on load. When told to load the driver, just LOAD the DRIVER. Don't reset the
card, or make ANY changes.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:08                       ` David Woodhouse
  2000-11-06 17:33                         ` James A. Sutherland
@ 2000-11-06 17:44                         ` David Woodhouse
  2000-11-06 17:53                           ` James A. Sutherland
  1 sibling, 1 reply; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:44 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel


jas88@cam.ac.uk said:
>  Except this isn't possible with the hardware in question! If it were,
> there would be no problem. In cases where the hardware doesn't support
> the functionality userspace "needs", why put the kludge in the kernel?

> If userspace wants to know what settings it set last time, it should
> store those values somewhere.

No. You have to reset the hardware fully each time you load the module. 
Although you _expect_ it to be in the state in which you left it, you can't 
be sure of that. 


jas88@cam.ac.uk said:
> Eh? You just load the driver once, probably on boot, to configure sane
> values. This time round, you use an argument (or an ioctl or whatever)
> to specify the values you want. (cat /etc/sysconfig/sound/
> defaultvolume > /dev/sound/mixer or whatever). After that, the module
> can be unloaded and loaded as needed, without any need to touch the
> mixer settings except in response to *explicit* "set volume" commands
> from userspace. 

Agreed. Where 'whatever' == persistent storage of some form. I care not 
what form that takes. If you can store the data entirely in userspace and 
still have them present at the time the driver initialises the hardware, 
that's fine. 


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:12                     ` Alan Cox
@ 2000-11-06 17:38                       ` James A. Sutherland
  2000-11-06 18:39                       ` Paul Jakma
  1 sibling, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 17:38 UTC (permalink / raw)
  To: Alan Cox, James A. Sutherland
  Cc: David Woodhouse, Jeff Garzik, Dan Hollis, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 06 Nov 2000, Alan Cox wrote:
> > So autoload the module with a "dont_screw_with_mixer" option. When the kernel
> > first boots, initialise the mixer to suitable settings (load the module with 
> > "do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
> > the mixer settings on load.
> 
> Which is part of what persistent module data lets you do. And without having
> to mess with dont_screw_with_mixer (which if you get it wrong btw can be 
> fatal and hang the hardware)

Eh? You just load the driver once, probably on boot, to configure sane values.
This time round, you use an argument (or an ioctl or whatever) to specify the
values you want. (cat /etc/sysconfig/sound/defaultvolume > /dev/sound/mixer or
whatever). After that, the module can be unloaded and loaded as needed, without
any need to touch the mixer settings except in response to *explicit* "set
volume" commands from userspace.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:19                   ` Alan Cox
@ 2000-11-06 17:34                     ` David Woodhouse
  2000-11-06 18:22                       ` Oliver Xymoron
  0 siblings, 1 reply; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:34 UTC (permalink / raw)
  To: Alan Cox
  Cc: Martin Dalecki, Jeff Garzik, Dan Hollis, Oliver Xymoron,
	Keith Owens, linux-kernel


alan@lxorguk.ukuu.org.uk said:
> > No! The best way to do it are just *persistently loaded* modules.
> > It's THAT simple!
>
 So you want to split every sound driver into two or more modules ? 

The point here is that although I've put up with just keeping the sound 
driver loaded for the last few years, permanently taking up a large amount 
of DMA memory, the inter_module_xxx stuff that Keith is proposing would 
give us a simple way of storing the data which we want to store. 

It's even simpler (and cleaner) than having to split all the sound drivers 
up into data and worker modules.

Someone suggested combining the 'data' modules so that one data module was 
shared by different 'worker' modules.

Build that into the kernel rather than making it a module.

Call its functions 'inter_module_get' et al.

We seem to have returned to what I was suggesting in the first place.

Being able to do it completely in userspace would be neater, though.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:25                           ` Alon Ziv
@ 2000-11-06 17:34                             ` Alan Cox
  2000-11-06 19:49                               ` Rogier Wolff
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:34 UTC (permalink / raw)
  To: Alon Ziv; +Cc: David Woodhouse, linux-kernel

> 1. Before auto-unload of the driver, run a small utility which will read
> mixer settings
>    and save them somewhere
> 2. When auto-loading the driver, use driver arguments which are initialized
> from the
>    settings saved above
> All that's missing is the method of passing data from step 1 to step 2.

A simple more generic solution is to do this


struct things_to_keep my_bits
{
	..
};

struct things_to_keep __persistent card_info[NUM_CARDS]
{
}

and have insmod do

	load module up
	open /var/run/moduledata/$modname
	if exists && is from this boot then && is right size
		read data into __persistent ELF section
	endif
	load into kernel
	init module

and rmmod
	cleanup module
	open /var/run/moduledata/$modname
	write data from __persistent segment into file
	
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:08                       ` David Woodhouse
@ 2000-11-06 17:33                         ` James A. Sutherland
  2000-11-06 23:28                           ` Gerhard Mack
  2000-11-06 17:44                         ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 17:33 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jas88@cam.ac.uk said:
> >  Yippee. As we all know, implementing GUI volume controls and putting
> > the slider in the right place is a kernel function, and nothing to do
> > with userspace... 
> 
> Don't troll, James. The kernel needs to provide the functionality required 
> by userspace. The functionality required in this case is the facility to 
> read the current mixer levels.

Except this isn't possible with the hardware in question! If it were, there
would be no problem. In cases where the hardware doesn't support the
functionality userspace "needs", why put the kludge in the kernel?

If userspace wants to know what settings it set last time, it should store
those values somewhere.

> jas88@cam.ac.uk said:
> >  The right thing in this context is not to screw with hardware
> > settings unless and until it is given settings to set. Do not set
> > values arbitrarily: set only the values you are explicitly given.
> > Anything else is simply a bug in your driver. 
> 
> It is unwise to assume that the hardware is in a sane state when the driver 
> has been unloaded and reloaded. I agree that you should set the values that 
> were explicitly given. That's why we should remember them.

No values are being explicitly given. Loading the driver should not cause
any settings to be changed: changing the settings should do that!

There is no need for the drivers to change any settings. If the settings need
to be (re)set, let userspace do it.
 

James. 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 18:00                         ` Martin Dalecki
@ 2000-11-06 17:29                           ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:29 UTC (permalink / raw)
  To: Martin Dalecki; +Cc: Horst von Brand, David Woodhouse, linux-kernel

> Drivers are supposed to handle present hardware - if the hardware
> is there - there should be a driver handling it as well.

Thats not how things have worked historically. Thats not consistent with other
modules either.

> The argument for saving some memmory is nonapplicable becouse in
> the case of expected usage in the future you have anyway to assume that
> in this futere there will be sufficient memmory for it there. And then

Rubbish

> Could some one add this to the FAQ ... please!

You got the letters in the wrong order. Your proposal is at best a 
Frequently Questioned Answer

> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:06                         ` David Woodhouse
  2000-11-06 17:25                           ` Alon Ziv
@ 2000-11-06 17:25                           ` David Woodhouse
  2000-11-06 19:27                             ` Tim Riker
  2000-11-06 23:57                           ` Horst von Brand
  2 siblings, 1 reply; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:25 UTC (permalink / raw)
  To: Alon Ziv; +Cc: linux-kernel


alonz@usa.net said:
> The best solution to the sound driver issue, IMHO, is still entirely
> userspace--- just no-one has written it yet. What we should do: 1.
> Before auto-unload of the driver, run a small utility which will read
> mixer settings
>    and save them somewhere 2. When auto-loading the driver, use driver
> arguments which are initialized from the
>    settings saved above

That could work, although it may be better to make it more generic and 
capable of handling any form of data. 

Any form of persistent storage would do - and if it can be handled entirely
in userspace, all the better. I merely pointed out that Keith's 
inter_module_xxx could provide this quite cleanly. Others disputed that it 
was required at all.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 17:06                         ` David Woodhouse
@ 2000-11-06 17:25                           ` Alon Ziv
  2000-11-06 17:34                             ` Alan Cox
  2000-11-06 17:25                           ` David Woodhouse
  2000-11-06 23:57                           ` Horst von Brand
  2 siblings, 1 reply; 113+ messages in thread
From: Alon Ziv @ 2000-11-06 17:25 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel

The best solution to the sound driver issue, IMHO, is still entirely
userspace---
just no-one has written it yet.
What we should do:
1. Before auto-unload of the driver, run a small utility which will read
mixer settings
   and save them somewhere
2. When auto-loading the driver, use driver arguments which are initialized
from the
   settings saved above
All that's missing is the method of passing data from step 1 to step 2.

----- Original Message -----
From: "David Woodhouse" <dwmw2@infradead.org>
To: "Horst von Brand" <vonbrand@inf.utfsm.cl>
Cc: <linux-kernel@vger.kernel.org>
Sent: Monday, November 06, 2000 19:06
Subject: Re: Persistent module storage [was Linux 2.4 Status / TODO page]


>
> vonbrand@inf.utfsm.cl said:
> >  No funny "persistent data" mechanisms or screwups when the worker
> > gets removed and reinserted. In many cases the data module could be
> > shared among several others, in other cases it would have to be able
> > lo load several times or manage several incarnations of its payload.
>
> The reason I brought this up now is because Keith's new
> inter_module_register stuff could easily be used to provide this
> functionality _without_ the extra module remaining loaded.
>
>
> --
> dwmw2
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> Please read the FAQ at http://www.tux.org/lkml/
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:31                       ` Horst von Brand
  2000-11-06 17:06                         ` David Woodhouse
@ 2000-11-06 17:23                         ` Alan Cox
  2000-11-08 14:56                           ` Jamie Lokier
  2000-11-06 18:00                         ` Martin Dalecki
  2 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:23 UTC (permalink / raw)
  To: Horst von Brand; +Cc: David Woodhouse, linux-kernel

> No funny "persistent data" mechanisms or screwups when the worker gets
> removed and reinserted. In many cases the data module could be shared among
> several others, in other cases it would have to be able lo load several
> times or manage several incarnations of its payload.

It actually seems the persistent data mechanism in user space wouldnt be
much different in implementation.

Add a 'preserved' tag for one section of module memory. On load look up the
data, if its from this boot memcpy it into the module. On unload write it
back to disk. No kernel code needed.

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 15:15                 ` Martin Dalecki
@ 2000-11-06 17:19                   ` Alan Cox
  2000-11-06 17:34                     ` David Woodhouse
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:19 UTC (permalink / raw)
  To: Martin Dalecki
  Cc: David Woodhouse, Jeff Garzik, Dan Hollis, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

> > Persistent storage is the best way to do it though. It doesn't have to be
> > persistent over reboots, just during the lifetime of the kernel.
> 
> No! The best way to do it are just *persistently loaded* modules.
> It's THAT simple!

So you want to split every sound driver into two or more modules ? 

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:35                   ` James A. Sutherland
@ 2000-11-06 17:12                     ` Alan Cox
  2000-11-06 17:38                       ` James A. Sutherland
  2000-11-06 18:39                       ` Paul Jakma
  2000-11-06 18:55                     ` Dan Hollis
  1 sibling, 2 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 17:12 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: David Woodhouse, Jeff Garzik, Dan Hollis, Alan Cox,
	Oliver Xymoron, Keith Owens, linux-kernel

> So autoload the module with a "dont_screw_with_mixer" option. When the kernel
> first boots, initialise the mixer to suitable settings (load the module with 
> "do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
> the mixer settings on load.

Which is part of what persistent module data lets you do. And without having
to mess with dont_screw_with_mixer (which if you get it wrong btw can be 
fatal and hang the hardware)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:57                         ` Horst von Brand
  2000-11-06 17:01                           ` James A. Sutherland
@ 2000-11-06 17:12                           ` David Woodhouse
  2000-11-06 17:45                             ` James A. Sutherland
                                               ` (2 more replies)
  1 sibling, 3 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:12 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: Horst von Brand, Keith Owens, linux-kernel


jas88@cam.ac.uk said:
>  So set them on startup. NOT when the driver is first loaded. Put it
> in the rc.d scripts. 

No. You should initialise the hardware completely when the driver is 
reloaded. Although the expected case is that the levels just happen to be 
the same as the last time the module was loaded, you can't know that the 
machine hasn't been suspended and resumed since then.


jas88@cam.ac.uk said:
>  No need. Let userspace save it somewhere, if that's needed. 

Don't troll, James. Reread the thread and see why doing it in userspace is 
too late.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 15:34                     ` David Woodhouse
  2000-11-06 16:31                       ` Horst von Brand
  2000-11-06 16:42                       ` James A. Sutherland
@ 2000-11-06 17:08                       ` David Woodhouse
  2000-11-06 17:33                         ` James A. Sutherland
  2000-11-06 17:44                         ` David Woodhouse
  2 siblings, 2 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:08 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel


jas88@cam.ac.uk said:
>  Yippee. As we all know, implementing GUI volume controls and putting
> the slider in the right place is a kernel function, and nothing to do
> with userspace... 

Don't troll, James. The kernel needs to provide the functionality required 
by userspace. The functionality required in this case is the facility to 
read the current mixer levels.


jas88@cam.ac.uk said:
>  The right thing in this context is not to screw with hardware
> settings unless and until it is given settings to set. Do not set
> values arbitrarily: set only the values you are explicitly given.
> Anything else is simply a bug in your driver. 

It is unwise to assume that the hardware is in a sane state when the driver 
has been unloaded and reloaded. I agree that you should set the values that 
were explicitly given. That's why we should remember them.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:31                       ` Horst von Brand
@ 2000-11-06 17:06                         ` David Woodhouse
  2000-11-06 17:25                           ` Alon Ziv
                                             ` (2 more replies)
  2000-11-06 17:23                         ` Alan Cox
  2000-11-06 18:00                         ` Martin Dalecki
  2 siblings, 3 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 17:06 UTC (permalink / raw)
  To: Horst von Brand; +Cc: linux-kernel


vonbrand@inf.utfsm.cl said:
>  No funny "persistent data" mechanisms or screwups when the worker
> gets removed and reinserted. In many cases the data module could be
> shared among several others, in other cases it would have to be able
> lo load several times or manage several incarnations of its payload. 

The reason I brought this up now is because Keith's new 
inter_module_register stuff could easily be used to provide this 
functionality _without_ the extra module remaining loaded.


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:57                         ` Horst von Brand
@ 2000-11-06 17:01                           ` James A. Sutherland
  2000-11-06 23:54                             ` Horst von Brand
  2000-11-06 17:12                           ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 17:01 UTC (permalink / raw)
  To: Horst von Brand; +Cc: David Woodhouse, Keith Owens, linux-kernel

On Mon, 06 Nov 2000, Horst von Brand wrote:
> [Chopped down Cc: list]
> "James A. Sutherland" <jas88@cam.ac.uk> said:
> > On Mon, 06 Nov 2000, David Woodhouse wrote:
> 
> [...]
> 
> > > It does not know them. Correct. But with persistent module storage, it 
> > > _could_ know them.
> 
> > No it cannot. The desired levels have not been defined: there are no
> > desired levels to determine! Don't tamper with settings you don't need
> > to. 
> 
> The problem (AFAIU) is that if the levels aren't set on startup, they are
> random in some cases.

So set them on startup. NOT when the driver is first loaded. Put it in
the rc.d scripts.

> So you'd have to save (at least) the fact that they
> have been initalized. 

No, you don't.

> Just that would be easy: Set aside a word in the
> kernel, which is set to 0 when booting, and which then gets the value 1
> when the hardware is initialized.

Why bother? Just set the settings *explicitly* on boot, rather than in the
driver itself.

> For more fancy stuff, splitting the
> module into data/code (as I suggested) should do the trick with minimal
> impact on the rest.

No need. Let userspace save it somewhere, if that's needed.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 16:42                       ` James A. Sutherland
@ 2000-11-06 16:57                         ` Horst von Brand
  2000-11-06 17:01                           ` James A. Sutherland
  2000-11-06 17:12                           ` David Woodhouse
  0 siblings, 2 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-06 16:57 UTC (permalink / raw)
  To: James A. Sutherland; +Cc: David Woodhouse, Keith Owens, linux-kernel

[Chopped down Cc: list]
"James A. Sutherland" <jas88@cam.ac.uk> said:
> On Mon, 06 Nov 2000, David Woodhouse wrote:

[...]

> > It does not know them. Correct. But with persistent module storage, it 
> > _could_ know them.

> No it cannot. The desired levels have not been defined: there are no
> desired levels to determine! Don't tamper with settings you don't need
> to. 

The problem (AFAIU) is that if the levels aren't set on startup, they are
random in some cases. So you'd have to save (at least) the fact that they
have been initalized. Just that would be easy: Set aside a word in the
kernel, which is set to 0 when booting, and which then gets the value 1
when the hardware is initialized. For more fancy stuff, splitting the
module into data/code (as I suggested) should do the trick with minimal
impact on the rest.
-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 15:34                     ` David Woodhouse
  2000-11-06 16:31                       ` Horst von Brand
@ 2000-11-06 16:42                       ` James A. Sutherland
  2000-11-06 16:57                         ` Horst von Brand
  2000-11-06 17:08                       ` David Woodhouse
  2 siblings, 1 reply; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 16:42 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jas88@cam.ac.uk said:
> >  Irrelevant. The current mixer settings don't matter: what matters is
> > that the driver does not change them.
> 
> It does matter. The sound driver needs to be able to _read_ the current 
> levels.

So do so. That's a hardware/driver issue. If the hardware is broken, put
a workaround in the driver for that hardware (make the driver persistent,
as Horst suggested, perhaps). Don't kludge the kernel to mask hardware
bugs.

> Almost all mixer programs will start by doing this, to set the 
> slider to the correct place.

Yippee. As we all know, implementing GUI volume controls
and putting the slider in the right place is a kernel function,
and nothing to do with userspace...

If you want your volume control applet to be able to read the
current volume settings, even on buggy hardware which can't
really do that, put the kludge in userspace. Or if you really want,
put it in your driver for buggy hardware, in the way Horst suggested.

> > > The driver needs to reset the card to the desired levels. 
> 
> > What desired levels? The only desired levels are the current ones,
> > which the driver does not and (sometimes) cannot know. Leave well
> > alone.
> 
> It does not know them. Correct. But with persistent module storage, it 
> _could_ know them.

No it cannot. The desired levels have not been defined: there are no
desired levels to determine! Don't tamper with settings you don't need
to. 

> It cannot know them the _first_ time the module is 
> loaded after booting. That's fine. On subsequent loads, it can and 
> should DTRT.

The right thing in this context is not to screw with hardware settings
unless and until it is given settings to set. Do not set values arbitrarily:
set only the values you are explicitly given. Anything else is simply
a bug in your driver.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 15:34                     ` David Woodhouse
@ 2000-11-06 16:31                       ` Horst von Brand
  2000-11-06 17:06                         ` David Woodhouse
                                           ` (2 more replies)
  2000-11-06 16:42                       ` James A. Sutherland
  2000-11-06 17:08                       ` David Woodhouse
  2 siblings, 3 replies; 113+ messages in thread
From: Horst von Brand @ 2000-11-06 16:31 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel

David Woodhouse <dwmw2@infradead.org> said:
> jas88@cam.ac.uk said:
> >  Irrelevant. The current mixer settings don't matter: what matters is
> > that the driver does not change them.

> It does matter. The sound driver needs to be able to _read_ the current 
> levels. Almost all mixer programs will start by doing this, to set the 
> slider to the correct place.

OK, how then using _2_ modules, data and worker:

- Data (containing the mixer levels or whatever other data you want to save)
  can only be unloaded after resetting to some default state. When loading
  it sets the default state.
- Worker does the work, and on loading loads the data one (if not yet
  resident) [This is automatic as the worker depends on symbols the data
  module exports].

No funny "persistent data" mechanisms or screwups when the worker gets
removed and reinserted. In many cases the data module could be shared among
several others, in other cases it would have to be able lo load several
times or manage several incarnations of its payload.

Sure, makes sense only if the worker module is largeish; if not, just let
it stay put (When reconfiguring anything, increment module use count;
decrement on reset. This should do the trick also for the data module
above).
-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:40                   ` David Woodhouse
  2000-11-06 15:23                     ` James A. Sutherland
@ 2000-11-06 15:34                     ` David Woodhouse
  2000-11-06 16:31                       ` Horst von Brand
                                         ` (2 more replies)
  1 sibling, 3 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 15:34 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel


jas88@cam.ac.uk said:
>  Irrelevant. The current mixer settings don't matter: what matters is
> that the driver does not change them.

It does matter. The sound driver needs to be able to _read_ the current 
levels. Almost all mixer programs will start by doing this, to set the 
slider to the correct place.

> > The driver needs to reset the card to the desired levels. 

> What desired levels? The only desired levels are the current ones,
> which the driver does not and (sometimes) cannot know. Leave well
> alone.

It does not know them. Correct. But with persistent module storage, it 
_could_ know them. It cannot know them the _first_ time the module is 
loaded after booting. That's fine. On subsequent loads, it can and 
should DTRT.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:40                   ` David Woodhouse
@ 2000-11-06 15:23                     ` James A. Sutherland
  2000-11-06 15:34                     ` David Woodhouse
  1 sibling, 0 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 15:23 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jas88@cam.ac.uk said:
> >  So autoload the module with a "dont_screw_with_mixer" option. When
> > the kernel first boots, initialise the mixer to suitable settings
> > (load the module with  "do_screw_with_mixer" or whatever); thereafter,
> > the driver shouldn't change the mixer settings on load. 
> 
> Not reliable. You can't read back the current mixer state from all 
> hardware, even if you _are_ willing to assume that it has remained in a 
> sensible state while the driver has been unloaded. 

Irrelevant. The current mixer settings don't matter: what matters is that the
driver does not change them.

> The driver needs to reset the card to the desired levels. 

What desired levels? The only desired levels are the current ones, which
the driver does not and (sometimes) cannot know. Leave well alone.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:37               ` David Woodhouse
  2000-11-06 11:40                 ` Jeff Garzik
  2000-11-06 11:47                 ` David Woodhouse
@ 2000-11-06 15:15                 ` Martin Dalecki
  2000-11-06 17:19                   ` Alan Cox
  2000-11-06 18:22                 ` Paul Jakma
  3 siblings, 1 reply; 113+ messages in thread
From: Martin Dalecki @ 2000-11-06 15:15 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel

David Woodhouse wrote:
> 
> jgarzik@mandrakesoft.com said:
> >  * Driver initializes mixer to 100% muted * Userspace app sets desired
> > values to /dev/mixer * Userspace app opens /dev/dsp to play sound
> 
> > I don't see where any sound can "escape" in this scenario, and it
> > doesn't require any module data persistence...
> 
> * User boots kernel
> * User loads mixer app
> * Sound module is autoloaded, defaults to zero levels. This is fine.
> * User sets 'line in' level to appropriate level to listen to radio
> * User closes mixer app
> * Time passes
> * Sound module is unloaded
> * User continues to happily listen to radio through sound card
> * Time passes
> * User is listening intently to something on the radio
> * Something wants to beep through /dev/audio
> * Sound module is autoloaded again, default to zero levels.
>         This time it is _NOT_ fine. User is rightly pissed off :)
> 
> It's fine to default to zero levels the first time the sound module is
> loaded after booting. Not on subsequent reloads though.
> 
> A long time ago, I made the sb16 driver use the persistent storage facility
> of kerneld to store mixer levels. I was happy with this right up until
> kerneld disappeared :)

It was removed for good reasons.

> I then made a version which read the current mixer levels back from the
> hardware on initialisation, and didn't reset them. That didn't work on all
> sb16 hardware, but it worked for me (tm).
> 
> Persistent storage is the best way to do it though. It doesn't have to be
> persistent over reboots, just during the lifetime of the kernel.

No! The best way to do it are just *persistently loaded* modules.
It's THAT simple!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:12                   ` David Woodhouse
  2000-11-06 13:38                     ` Jeff Garzik
@ 2000-11-06 13:56                     ` David Woodhouse
  1 sibling, 0 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 13:56 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel


jgarzik@mandrakesoft.com said:
>  I am thinking about the bigger picture:  You are unloading a driver,
> then continuing to use the hardware.  To me, that is an undefined
> state.

We're only using the pass-through levels. It's undefined but it doesn't
matter to the software. I'd actually suggest that for hardware which does
stop the pass-through audio when the driver is unloaded, we really ought not
unload the driver while those levels are non-zero.

We should still reset the hardware completely when we reload the driver -
it's just that we should reset it to the levels previously set by the user,
rather than resetting it to zeroes.


jgarzik@mandrakesoft.com said:
>  However, since simply leaving the driver loaded solves all this mess,
> it doesn't seem worth changing drivers to do anything different. 

Leaving the driver loaded has been my solution ever since kerneld was taken 
out. I merely commented that Keith's new stuff would allow me to get 
persistent storage working again. It's not very difficult to change the 
driver to use it.

I believe the SBLive! driver is a little larger than the example you 
pasted. I think we probably do care about adding a little bit more to the 
pool of permanently unswappable pages here and there.


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  8:00             ` David Woodhouse
@ 2000-11-06 13:44               ` Andrew Pimlott
  0 siblings, 0 replies; 113+ messages in thread
From: Andrew Pimlott @ 2000-11-06 13:44 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel

On Mon, Nov 06, 2000 at 08:00:05AM +0000, David Woodhouse wrote:
> I'm more interested in the case where the module is loaded for the second
> time:

Is there really a reason to unload a module in normal usage?  Beyond
miniscule memory savings and hack value?  You can solve the whole
problem with a loud "don't do that".

Andrew
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:47                 ` David Woodhouse
                                     ` (3 preceding siblings ...)
  2000-11-06 13:35                   ` James A. Sutherland
@ 2000-11-06 13:40                   ` David Woodhouse
  2000-11-06 15:23                     ` James A. Sutherland
  2000-11-06 15:34                     ` David Woodhouse
  4 siblings, 2 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 13:40 UTC (permalink / raw)
  To: James A. Sutherland
  Cc: Jeff Garzik, Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens,
	linux-kernel


jas88@cam.ac.uk said:
>  So autoload the module with a "dont_screw_with_mixer" option. When
> the kernel first boots, initialise the mixer to suitable settings
> (load the module with  "do_screw_with_mixer" or whatever); thereafter,
> the driver shouldn't change the mixer settings on load. 

Not reliable. You can't read back the current mixer state from all 
hardware, even if you _are_ willing to assume that it has remained in a 
sensible state while the driver has been unloaded. 

The driver needs to reset the card to the desired levels. 

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 13:12                   ` David Woodhouse
@ 2000-11-06 13:38                     ` Jeff Garzik
  2000-11-06 13:56                     ` David Woodhouse
  1 sibling, 0 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 13:38 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> 
> jgarzik@mandrakesoft.com said:
> > > The sound card allows itself to be unloaded when the pass-through
> > > mixer levels are non-zero. This is reasonable iff ...
> 
> > I don't think that is reasonable.
> 
> You don't think that it's reasonable for the sound card to allow itself to
> be unloaded when the pass-through mixer levels are non-zero?
> 
> So you're suggesting that we should prevent the sound drivers from being
> unloaded at all in that situation?

I am thinking about the bigger picture:  You are unloading a driver,
then continuing to use the hardware.  To me, that is an undefined state.


> That would also solve the problem, at the cost of still keeping the sound
> module in unpagable RAM all the time.

Oh, the horror!

[jgarzik@rum linux_2_4]$ ls -l drivers/sound/via82cxxx_audio.o
-rw-r--r--    1 jgarzik  jgarzik     27968 Nov  6 03:28
drivers/sound/via82cxxx_audio.o

So you would rather load everybody's kernel down with mixer level /
module persistence gunk... than simply load a kernel module at boot, and
leave it alone?


> With persistent storage, the sound driver is free to reset and initialise
> the sound card hardware upon reload - it's just that it can initialise it to
> the levels which the user had previously set, rather than to the compiled-in
> default levels (which are preferably zero).
> 
> Initialising the levels to a default and expecting a user-space app to fix it
> later is not good enough.

The one thing that you and I agree on:  It would be nice if the driver
did not init the mixer to a set of defaults, when a preferred set is
available.

However, since simply leaving the driver loaded solves all this mess, it
doesn't seem worth changing drivers to do anything different.

	Jeff


-- 
Jeff Garzik             | "When I do this, my computer freezes."
Building 1024           |          -user
MandrakeSoft            | "Don't do that."
                        |          -level 1
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:47                 ` David Woodhouse
                                     ` (2 preceding siblings ...)
  2000-11-06 13:21                   ` David Woodhouse
@ 2000-11-06 13:35                   ` James A. Sutherland
  2000-11-06 17:12                     ` Alan Cox
  2000-11-06 18:55                     ` Dan Hollis
  2000-11-06 13:40                   ` David Woodhouse
  4 siblings, 2 replies; 113+ messages in thread
From: James A. Sutherland @ 2000-11-06 13:35 UTC (permalink / raw)
  To: David Woodhouse, Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 06 Nov 2000, David Woodhouse wrote:
> jgarzik@mandrakesoft.com said:
> > > * User continues to happily listen to radio through sound card
> > You're using the sound card without a driver?
> 
> Yes. The sound card allows itself to be unloaded when the pass-through mixer
> levels are non-zero. This is reasonable iff it can be reloaded without 
> destroying those levels again.
> 
> jgarzik@mandrakesoft.com said:
> >  If you create a post-action in /etc/modules.conf which initializes
> > the mixer to proper levels, this problem does not exist.
> 
> Yes it does. It can be a few seconds between initialisation and the 
> post-action running. That's plenty of time to miss what the news announcer 
> was saying about whether you need to go to work today (my gf is a teacher) 
> or to wake the entire house if the mixer levels don't default to zero.

So autoload the module with a "dont_screw_with_mixer" option. When the kernel
first boots, initialise the mixer to suitable settings (load the module with 
"do_screw_with_mixer" or whatever); thereafter, the driver shouldn't change
the mixer settings on load.


James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:47                 ` David Woodhouse
  2000-11-06 11:57                   ` Jeff Garzik
  2000-11-06 13:12                   ` David Woodhouse
@ 2000-11-06 13:21                   ` David Woodhouse
  2000-11-06 13:35                   ` James A. Sutherland
  2000-11-06 13:40                   ` David Woodhouse
  4 siblings, 0 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 13:21 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel


I think we're getting confused. What I'm advocating is something like this:

init_module()
{
	struct mixer_levels *levels;

	levels = inter_module_get("mysoundcard_mixerlevels");

	if (!levels)
		/* We haven't been loaded before. Default to zero */
		levels = &default_levels;

	init_hardware(levels);
}

cleanup_module()
{
	struct mixer_levels *levels = kmalloc(sizeof *levels);

	if (levels) {
		/* Record current the levels so we can init the hardware
		   to the same next time we're loaded */
		memcpy(levels, current_levels, sizeof(*levels));
		inter_module_register("mysoundcard_mixerlevels", levels);
	}
}


(Note it's pseudocode. I _know_ it doesn't compile and that the name we 
pass to inter_module_register is removed when the module is unloaded. Oh 
and that inter_module_register will panic() and kill the whole system on 
the second unload because a registration with that name already exists.)


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:47                 ` David Woodhouse
  2000-11-06 11:57                   ` Jeff Garzik
@ 2000-11-06 13:12                   ` David Woodhouse
  2000-11-06 13:38                     ` Jeff Garzik
  2000-11-06 13:56                     ` David Woodhouse
  2000-11-06 13:21                   ` David Woodhouse
                                     ` (2 subsequent siblings)
  4 siblings, 2 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 13:12 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel


jgarzik@mandrakesoft.com said:
> > The sound card allows itself to be unloaded when the pass-through
> > mixer levels are non-zero. This is reasonable iff ...

> I don't think that is reasonable. 

You don't think that it's reasonable for the sound card to allow itself to 
be unloaded when the pass-through mixer levels are non-zero? 

So you're suggesting that we should prevent the sound drivers from being 
unloaded at all in that situation?

That would also solve the problem, at the cost of still keeping the sound 
module in unpagable RAM all the time.

jgarzik@mandrakesoft.com said:
> The first thing most drivers do is reset the hardware.   That
> inevitably leads to some sort of blip, when it comes to sound drivers.

A _momentary_ blip on certain hardware is acceptable if it's unavoidable.
Changing the levels and leaving them wrong for seconds before a user-space 
post-install script fixes them is not acceptable.

jgarzik@mandrakesoft.com said:
> You are depending on the hardware to keep its state -between- driver
> unload and driver reload.  That seems inherently unstable to me. 

No we're not. After the kerneld code was removed, I hacked up something to
do that, but it was a suboptimal solution and wasn't reliable on all
hardware. As I said, persistent storage is the better solution.

With persistent storage, the sound driver is free to reset and initialise
the sound card hardware upon reload - it's just that it can initialise it to
the levels which the user had previously set, rather than to the compiled-in
default levels (which are preferably zero). 

Initialising the levels to a default and expecting a user-space app to fix it
later is not good enough.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:57                   ` Jeff Garzik
@ 2000-11-06 12:03                     ` Alan Cox
  0 siblings, 0 replies; 113+ messages in thread
From: Alan Cox @ 2000-11-06 12:03 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: David Woodhouse, Dan Hollis, Alan Cox, Oliver Xymoron,
	Keith Owens, linux-kernel

> I don't think that is reasonable.

I think its totally reasonable.

> The first thing most drivers do is reset the hardware.   That inevitably

Because there is no persistent storage to remember the fact the hardware is
running.

> You are depending on the hardware to keep its state -between- driver
> unload and driver reload.  That seems inherently unstable to me.  It
> amazes me that such is supported.

Well if you want to rewrite the entire module handling and locking so that
mixer levels determine the load/unload behaviour according to AC97 register
combinations and then train users to mute all their inputs before using
rmmod go ahead 8)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:47                 ` David Woodhouse
@ 2000-11-06 11:57                   ` Jeff Garzik
  2000-11-06 12:03                     ` Alan Cox
  2000-11-06 13:12                   ` David Woodhouse
                                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:57 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> 
> jgarzik@mandrakesoft.com said:
> > > * User continues to happily listen to radio through sound card
> > You're using the sound card without a driver?
> 
> Yes. The sound card allows itself to be unloaded when the pass-through mixer
> levels are non-zero. This is reasonable iff it can be reloaded without
> destroying those levels again.

I don't think that is reasonable.

The first thing most drivers do is reset the hardware.   That inevitably
leads to some sort of blip, when it comes to sound drivers.  If you
-don't- reset the hardware, the driver is using hardware that is in an
unknown state.  (using hardware w/out resetting it == unknown state)

You are depending on the hardware to keep its state -between- driver
unload and driver reload.  That seems inherently unstable to me.  It
amazes me that such is supported.

	Jeff


-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:37               ` David Woodhouse
  2000-11-06 11:40                 ` Jeff Garzik
@ 2000-11-06 11:47                 ` David Woodhouse
  2000-11-06 11:57                   ` Jeff Garzik
                                     ` (4 more replies)
  2000-11-06 15:15                 ` Martin Dalecki
  2000-11-06 18:22                 ` Paul Jakma
  3 siblings, 5 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 11:47 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel



jgarzik@mandrakesoft.com said:
> > * User continues to happily listen to radio through sound card
> You're using the sound card without a driver?

Yes. The sound card allows itself to be unloaded when the pass-through mixer
levels are non-zero. This is reasonable iff it can be reloaded without 
destroying those levels again.

jgarzik@mandrakesoft.com said:
>  If you create a post-action in /etc/modules.conf which initializes
> the mixer to proper levels, this problem does not exist.

Yes it does. It can be a few seconds between initialisation and the 
post-action running. That's plenty of time to miss what the news announcer 
was saying about whether you need to go to work today (my gf is a teacher) 
or to wake the entire house if the mixer levels don't default to zero.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:37               ` David Woodhouse
@ 2000-11-06 11:40                 ` Jeff Garzik
  2000-11-06 11:47                 ` David Woodhouse
                                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:40 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> * Sound module is unloaded
> * User continues to happily listen to radio through sound card

You're using the sound card without a driver?


> * Time passes
> * User is listening intently to something on the radio
> * Something wants to beep through /dev/audio
> * Sound module is autoloaded again, default to zero levels.
>         This time it is _NOT_ fine. User is rightly pissed off :)

If you create a post-action in /etc/modules.conf which initializes the
mixer to proper levels, this problem does not exist.

No kernel coding required.

	Jeff


-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:06             ` David Woodhouse
  2000-11-06 11:09               ` Jeff Garzik
  2000-11-06 11:20               ` Jeff Garzik
@ 2000-11-06 11:37               ` David Woodhouse
  2000-11-06 11:40                 ` Jeff Garzik
                                   ` (3 more replies)
  2 siblings, 4 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 11:37 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel


jgarzik@mandrakesoft.com said:
>  * Driver initializes mixer to 100% muted * Userspace app sets desired
> values to /dev/mixer * Userspace app opens /dev/dsp to play sound

> I don't see where any sound can "escape" in this scenario, and it
> doesn't require any module data persistence... 


* User boots kernel
* User loads mixer app
* Sound module is autoloaded, defaults to zero levels. This is fine.
* User sets 'line in' level to appropriate level to listen to radio
* User closes mixer app
* Time passes
* Sound module is unloaded
* User continues to happily listen to radio through sound card
* Time passes
* User is listening intently to something on the radio
* Something wants to beep through /dev/audio
* Sound module is autoloaded again, default to zero levels.
	This time it is _NOT_ fine. User is rightly pissed off :)



It's fine to default to zero levels the first time the sound module is 
loaded after booting. Not on subsequent reloads though. 

A long time ago, I made the sb16 driver use the persistent storage facility 
of kerneld to store mixer levels. I was happy with this right up until 
kerneld disappeared :)

I then made a version which read the current mixer levels back from the 
hardware on initialisation, and didn't reset them. That didn't work on all 
sb16 hardware, but it worked for me (tm). 

Persistent storage is the best way to do it though. It doesn't have to be 
persistent over reboots, just during the lifetime of the kernel.

The inter_module_xxx() stuff would facilitate this quite nicely.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:35               ` Alan Cox
@ 2000-11-06 11:36                 ` Jeff Garzik
  0 siblings, 0 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:36 UTC (permalink / raw)
  To: Alan Cox
  Cc: Dan Hollis, David Woodhouse, Oliver Xymoron, Keith Owens, linux-kernel

Alan Cox wrote:
> 
> > > This is why alsa starts up all devices totally muted. Maybe its time for
> > > David to move to alsa ;)
> >
> > I wouldn't mind leaving devices totally muted until open()...
> 
> You need to leave the mixer for cd, tv and radio pass through

Good point.  Also might need to flush default settings to the mixer, if
you start playing w/out first setting the mixer to anything...

-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:04             ` Jeff Garzik
@ 2000-11-06 11:35               ` Alan Cox
  2000-11-06 11:36                 ` Jeff Garzik
  0 siblings, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 11:35 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Dan Hollis, Alan Cox, David Woodhouse, Oliver Xymoron,
	Keith Owens, linux-kernel

> > This is why alsa starts up all devices totally muted. Maybe its time for
> > David to move to alsa ;)
> 
> I wouldn't mind leaving devices totally muted until open()...

You need to leave the mixer for cd, tv and radio pass through
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:06             ` David Woodhouse
  2000-11-06 11:09               ` Jeff Garzik
@ 2000-11-06 11:20               ` Jeff Garzik
  2000-11-06 11:37               ` David Woodhouse
  2 siblings, 0 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:20 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

Remember the /dev/mixer and /dev/dsp are separate.

* Driver initializes mixer to 100% muted
* Userspace app sets desired values to /dev/mixer
* Userspace app opens /dev/dsp to play sound

I don't see where any sound can "escape" in this scenario, and it
doesn't require any module data persistence...

	Jeff


-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:06             ` David Woodhouse
@ 2000-11-06 11:09               ` Jeff Garzik
  2000-11-06 11:20               ` Jeff Garzik
  2000-11-06 11:37               ` David Woodhouse
  2 siblings, 0 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:09 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Dan Hollis, Alan Cox, Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> 
> goemon@anime.net said:
> >  This is why alsa starts up all devices totally muted. Maybe its time
> > for David to move to alsa ;)
> 
> Muted is not what I want either, although that's fine when the module is
> _first_ loaded after booting.
> 
> What I want is for the mixer settings not to change at all, when the module
> is auto-unloaded and later auto-loaded again. I may have set them to pass
> through the line input.

The API allows for setup activity to occur on the fd before sound is
actually started, mixer setup can be one of those steps...

-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:03           ` Dan Hollis
  2000-11-06 11:04             ` Jeff Garzik
@ 2000-11-06 11:06             ` David Woodhouse
  2000-11-06 11:09               ` Jeff Garzik
                                 ` (2 more replies)
  1 sibling, 3 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06 11:06 UTC (permalink / raw)
  To: Dan Hollis
  Cc: Alan Cox, Jeff Garzik, Oliver Xymoron, Keith Owens, linux-kernel


goemon@anime.net said:
>  This is why alsa starts up all devices totally muted. Maybe its time
> for David to move to alsa ;)

Muted is not what I want either, although that's fine when the module is 
_first_ loaded after booting.

What I want is for the mixer settings not to change at all, when the module
is auto-unloaded and later auto-loaded again. I may have set them to pass 
through the line input.

--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 11:03           ` Dan Hollis
@ 2000-11-06 11:04             ` Jeff Garzik
  2000-11-06 11:35               ` Alan Cox
  2000-11-06 11:06             ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06 11:04 UTC (permalink / raw)
  To: Dan Hollis
  Cc: Alan Cox, David Woodhouse, Oliver Xymoron, Keith Owens, linux-kernel

Dan Hollis wrote:
> 
> On Mon, 6 Nov 2000, Alan Cox wrote:
> > And they don't solve the problem David was talking about. There is a short
> > deeply unpleasant scream from some soundcards on reload because the card init
> > and the 0.5-1 second later aumix run dont stop the feedback loop fast enough
> > when a mic is plugged in
> 
> This is why alsa starts up all devices totally muted. Maybe its time for
> David to move to alsa ;)

I wouldn't mind leaving devices totally muted until open()...

-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06 10:53         ` Alan Cox
@ 2000-11-06 11:03           ` Dan Hollis
  2000-11-06 11:04             ` Jeff Garzik
  2000-11-06 11:06             ` David Woodhouse
  0 siblings, 2 replies; 113+ messages in thread
From: Dan Hollis @ 2000-11-06 11:03 UTC (permalink / raw)
  To: Alan Cox
  Cc: Jeff Garzik, David Woodhouse, Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Alan Cox wrote:
> And they don't solve the problem David was talking about. There is a short
> deeply unpleasant scream from some soundcards on reload because the card init
> and the 0.5-1 second later aumix run dont stop the feedback loop fast enough
> when a mic is plugged in

This is why alsa starts up all devices totally muted. Maybe its time for
David to move to alsa ;)

-Dan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:25       ` Jeff Garzik
  2000-11-06  7:29         ` David Woodhouse
@ 2000-11-06 10:53         ` Alan Cox
  2000-11-06 11:03           ` Dan Hollis
  1 sibling, 1 reply; 113+ messages in thread
From: Alan Cox @ 2000-11-06 10:53 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: David Woodhouse, Oliver Xymoron, Keith Owens, linux-kernel

> > Implement a way for a userspace tool to get the correct mixer levels in
> > place at the time the sound hardware is reset, so there are no glitches in
> > the levels, and I'll agree with you.
> 
> Linux-Mandrake's initscripts run aumix on bootup and shutdown, to take
> care of this...

And they don't solve the problem David was talking about. There is a short
deeply unpleasant scream from some soundcards on reload because the card init
and the 0.5-1 second later aumix run dont stop the feedback loop fast enough
when a mic is plugged in

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:48           ` Oliver Xymoron
@ 2000-11-06  8:02             ` David Woodhouse
  2000-11-06 18:09               ` Eric W. Biederman
  0 siblings, 1 reply; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  8:02 UTC (permalink / raw)
  To: Oliver Xymoron; +Cc: Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Oliver Xymoron wrote:

> > 'init module' is still _after_ 'set mixer levels'. There is a period
> > during which the mixer levels are changed.
> 
> Perhaps you mean before? Otherwise you've lost me.

Yeah, sorry, not enough coffee yet this morning.

> > The desired mixer levels should be available to the module at the time of
> > initialisation.
> 
> Is this because active audio sources other than /dev/dsp writers are
> suddenly in and out of the mix? If there's nothing on the inputs, it
> shouldn't matter whether you're changing the levels.

Yes. 

> The right way to do this (according to any sound engineer) is to
> initialize all the levels to zero unless told otherwise. This would
> doubtless annoy the average user, but is more or less equivalent to not
> forwarding packets by default.

The current situation is equivalent to stopping forwarding packets each
time an app on the local machine decides it wants to send its own packets,
after a period of inactivity.

Defaulting to zero on boot is fine. Defaulting to zero after the module
has been auto-unloaded and auto-loaded again is less good.

-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:45           ` Jeff Garzik
@ 2000-11-06  8:00             ` David Woodhouse
  2000-11-06 13:44               ` Andrew Pimlott
  0 siblings, 1 reply; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  8:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Jeff Garzik wrote:

> David Woodhouse wrote:
> > The desired mixer levels should be available to the module at the time of
> > initialisation.
> 
> For drivers built into the kernel that gets messy.  The command line is
> only so long.  Sounds messy for modules too.  Further (responding to
> your other e-mail), few probably care about having the mixer containing
> default, not custom, values for 10 seconds between driver init and aumix
> execution from initscripts...

I don't mean this to happen on boot. As you say, that gets messy. The
first time a module is loaded after booting, the levels can be all zeroed. 

I'm more interested in the case where the module is loaded for the second
time:

User loads a mixer to set the 'line' level to something sensible so he can
listen to the radio, which is routed through the sound card to his amp.

User closes mixer program. Module is unloaded. Levels remain the same -
all is well.

Some time later, something tries to 'beep' via /dev/audio. Module is
reloaded, the feed the user was listening to is interrupted.

Actually, the way it happened to me was that it was five in the morning, I
was in halls of residence, and suddenly I was playing the radio at full
volume :)

After fixing the sb16 driver to use the existing persistent storage, and
watching that facility disappear from the module support shortly
thereafter, I just decided not to autoload the sound modules.

-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:32         ` David Woodhouse
  2000-11-06  7:45           ` Jeff Garzik
@ 2000-11-06  7:48           ` Oliver Xymoron
  2000-11-06  8:02             ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: Oliver Xymoron @ 2000-11-06  7:48 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Keith Owens, linux-kernel

On Mon, 6 Nov 2000, David Woodhouse wrote:

> On Mon, 6 Nov 2000, Oliver Xymoron wrote:
> 
> > If I understand you correctly:
> > 
> > process 1         process 2
...
> 
> > Is there any reason we ever want to unblock process 1 before process 2
> > terminates?
> 
> No, and I don't think we do. That's not the point.
> 
> 'init module' is still _after_ 'set mixer levels'. There is a period
> during which the mixer levels are changed.

Perhaps you mean before? Otherwise you've lost me.

> The desired mixer levels should be available to the module at the time of
> initialisation.

Is this because active audio sources other than /dev/dsp writers are
suddenly in and out of the mix? If there's nothing on the inputs, it
shouldn't matter whether you're changing the levels.

The right way to do this (according to any sound engineer) is to
initialize all the levels to zero unless told otherwise. This would
doubtless annoy the average user, but is more or less equivalent to not
forwarding packets by default.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:32         ` David Woodhouse
@ 2000-11-06  7:45           ` Jeff Garzik
  2000-11-06  8:00             ` David Woodhouse
  2000-11-06  7:48           ` Oliver Xymoron
  1 sibling, 1 reply; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06  7:45 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> The desired mixer levels should be available to the module at the time of
> initialisation.

For drivers built into the kernel that gets messy.  The command line is
only so long.  Sounds messy for modules too.  Further (responding to
your other e-mail), few probably care about having the mixer containing
default, not custom, values for 10 seconds between driver init and aumix
execution from initscripts...

It sounds smarter to delay mixer initialization, or mute all mixer
channels at init.  That effectively initializes the mixer channels to
the custom values you desire, without having to add special case module
gunk for the subset of people who need correct mixer values Right
Now(tm).

	Jeff


-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:28       ` Oliver Xymoron
@ 2000-11-06  7:32         ` David Woodhouse
  2000-11-06  7:45           ` Jeff Garzik
  2000-11-06  7:48           ` Oliver Xymoron
  0 siblings, 2 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  7:32 UTC (permalink / raw)
  To: Oliver Xymoron; +Cc: Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Oliver Xymoron wrote:

> If I understand you correctly:
> 
> process 1         process 2
> open(/dev/dsp)
> modprobe->        
>                   load module
>                   init module   (can't remember which context, actually)
> start writing     
>                   set mixer levels
> 

> Is there any reason we ever want to unblock process 1 before process 2
> terminates?

No, and I don't think we do. That's not the point.

'init module' is still _after_ 'set mixer levels'. There is a period
during which the mixer levels are changed.

The desired mixer levels should be available to the module at the time of
initialisation.


-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:25       ` Jeff Garzik
@ 2000-11-06  7:29         ` David Woodhouse
  2000-11-06 10:53         ` Alan Cox
  1 sibling, 0 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  7:29 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Oliver Xymoron, Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Jeff Garzik wrote:

> Linux-Mandrake's initscripts run aumix on bootup and shutdown, to take
> care of this...

So does Red Hat. You can also have a post-install script which does it
after a module is auto-loaded. There can still be a number of seconds
between the initialisation of the hardware and the desired mixer levels
actually getting set.


-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:17     ` David Woodhouse
  2000-11-06  7:25       ` Jeff Garzik
@ 2000-11-06  7:28       ` Oliver Xymoron
  2000-11-06  7:32         ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: Oliver Xymoron @ 2000-11-06  7:28 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Keith Owens, linux-kernel

On Mon, 6 Nov 2000, David Woodhouse wrote:

> On Mon, 6 Nov 2000, Oliver Xymoron wrote:
> 
> > Hopefully not. The standard examples (mixer levels, etc) are better
> > handled with a userspace tool hooked by modprobe. This even gets
> > persistence across reboots if that's what's wanted.
> 
> Implement a way for a userspace tool to get the correct mixer levels in
> place at the time the sound hardware is reset, so there are no glitches in
> the levels, and I'll agree with you.

If I understand you correctly:

process 1         process 2
open(/dev/dsp)
modprobe->        
                  load module
                  init module   (can't remember which context, actually)
start writing     
                  set mixer levels

Is there any reason we ever want to unblock process 1 before process 2
terminates?

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:17     ` David Woodhouse
@ 2000-11-06  7:25       ` Jeff Garzik
  2000-11-06  7:29         ` David Woodhouse
  2000-11-06 10:53         ` Alan Cox
  2000-11-06  7:28       ` Oliver Xymoron
  1 sibling, 2 replies; 113+ messages in thread
From: Jeff Garzik @ 2000-11-06  7:25 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Oliver Xymoron, Keith Owens, linux-kernel

David Woodhouse wrote:
> 
> On Mon, 6 Nov 2000, Oliver Xymoron wrote:
> 
> > Hopefully not. The standard examples (mixer levels, etc) are better
> > handled with a userspace tool hooked by modprobe. This even gets
> > persistence across reboots if that's what's wanted.
> 
> Implement a way for a userspace tool to get the correct mixer levels in
> place at the time the sound hardware is reset, so there are no glitches in
> the levels, and I'll agree with you.

Linux-Mandrake's initscripts run aumix on bootup and shutdown, to take
care of this...

-- 
Jeff Garzik             | Dinner is ready when
Building 1024           | the smoke alarm goes off.
MandrakeSoft            |	-/usr/games/fortune
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  7:12   ` Oliver Xymoron
@ 2000-11-06  7:17     ` David Woodhouse
  2000-11-06  7:25       ` Jeff Garzik
  2000-11-06  7:28       ` Oliver Xymoron
  0 siblings, 2 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  7:17 UTC (permalink / raw)
  To: Oliver Xymoron; +Cc: Keith Owens, linux-kernel

On Mon, 6 Nov 2000, Oliver Xymoron wrote:

> Hopefully not. The standard examples (mixer levels, etc) are better
> handled with a userspace tool hooked by modprobe. This even gets
> persistence across reboots if that's what's wanted.

Implement a way for a userspace tool to get the correct mixer levels in
place at the time the sound hardware is reset, so there are no glitches in
the levels, and I'll agree with you.

-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  1:28 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
  2000-11-06  6:39   ` David Woodhouse
@ 2000-11-06  7:12   ` Oliver Xymoron
  2000-11-06  7:17     ` David Woodhouse
  1 sibling, 1 reply; 113+ messages in thread
From: Oliver Xymoron @ 2000-11-06  7:12 UTC (permalink / raw)
  To: Keith Owens; +Cc: David Woodhouse, linux-kernel

On Mon, 6 Nov 2000, Keith Owens wrote:

> What do people think, do we need module persistent storage?

Hopefully not. The standard examples (mixer levels, etc) are better
handled with a userspace tool hooked by modprobe. This even gets
persistence across reboots if that's what's wanted.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Re: Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  1:28 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
@ 2000-11-06  6:39   ` David Woodhouse
  2000-11-06  7:12   ` Oliver Xymoron
  1 sibling, 0 replies; 113+ messages in thread
From: David Woodhouse @ 2000-11-06  6:39 UTC (permalink / raw)
  To: Keith Owens; +Cc: linux-kernel

On Mon, 6 Nov 2000, Keith Owens wrote:

> On Mon, 6 Nov 2000 00:54:51 +0000 (GMT), 
> David Woodhouse <dwmw2@infradead.org> wrote:
> >On Mon, 6 Nov 2000, Keith Owens wrote:
> >
> >> I'm not sure why you think this can be used for module persistent
> >> storage.  If a module calls inter_module_register() on load, it should
> >> call inter_module_unregister() on unload.  All the registered data
> >> points into the loaded module, remove the module and the storage
> >> disappears as well.
> >
> >You can kmalloc() both the im_name and userdata arguments to
> >inter_module_register and you ought to be able to pass NULL as the owner.
> 
> Ughh!  That is definitely abusing the inter_module functions.  If we
> need persistent module storage then we should add a clean interface to
> do it instead of using kmalloc and overloading inter_module_xxx.

Why? It's got to get kmalloc'd anyway, and code reuse is
_good_. Experiment with different names for inter_module_xxx until you
feel happier :)

> What do people think, do we need module persistent storage? 

The primary reason that I've often lamented its removal is for
auto-loaded sound drivers to store their mixer level on unload, in order
to reset to the same values upon being reloaded.

> This will probably be a 2.5 change but I want to get an idea of the
> requirements before coding anything.

Strictly speaking, all the inter_module_xxx stuff should probably wait for
2.5.

-- 
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

* Persistent module storage [was Linux 2.4 Status / TODO page]
  2000-11-06  0:54 Linux 2.4 Status / TODO page (Updated as of 2.4.0-test10) David Woodhouse
@ 2000-11-06  1:28 ` Keith Owens
  2000-11-06  6:39   ` David Woodhouse
  2000-11-06  7:12   ` Oliver Xymoron
  0 siblings, 2 replies; 113+ messages in thread
From: Keith Owens @ 2000-11-06  1:28 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-kernel

On Mon, 6 Nov 2000 00:54:51 +0000 (GMT), 
David Woodhouse <dwmw2@infradead.org> wrote:
>On Mon, 6 Nov 2000, Keith Owens wrote:
>
>> I'm not sure why you think this can be used for module persistent
>> storage.  If a module calls inter_module_register() on load, it should
>> call inter_module_unregister() on unload.  All the registered data
>> points into the loaded module, remove the module and the storage
>> disappears as well.
>
>You can kmalloc() both the im_name and userdata arguments to
>inter_module_register and you ought to be able to pass NULL as the owner.

Ughh!  That is definitely abusing the inter_module functions.  If we
need persistent module storage then we should add a clean interface to
do it instead of using kmalloc and overloading inter_module_xxx.

What do people think, do we need module persistent storage?  There are
already entries in struct module for persistent data but there is no
way of setting those fields, nor is there any code in modutils to
handle persistent storage.  This will probably be a 2.5 change but I
want to get an idea of the requirements before coding anything.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 113+ messages in thread

end of thread, other threads:[~2000-11-08 14:56 UTC | newest]

Thread overview: 113+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3A06A053.56F09ACB@mandrakesoft.com>
2000-11-06 12:29 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
2000-11-06 17:07   ` Alan Cox
2000-11-06 18:09     ` Martin Dalecki
2000-11-06 17:30       ` Alan Cox
2000-11-06 17:05 ` Alan Cox
2000-11-06 18:30   ` Paul Jakma
2000-11-06 21:12   ` Martin Mares
2000-11-07  1:17     ` Horst von Brand
2000-11-07  9:59       ` Martin Mares
2000-11-07 10:59     ` Martin Dalecki
2000-11-07 12:27       ` Alan Cox
2000-11-07  7:55 David Feuer
  -- strict thread matches above, loose matches on Subject: below --
2000-11-06 22:48 Wayne.Brown
2000-11-06  0:54 Linux 2.4 Status / TODO page (Updated as of 2.4.0-test10) David Woodhouse
2000-11-06  1:28 ` Persistent module storage [was Linux 2.4 Status / TODO page] Keith Owens
2000-11-06  6:39   ` David Woodhouse
2000-11-06  7:12   ` Oliver Xymoron
2000-11-06  7:17     ` David Woodhouse
2000-11-06  7:25       ` Jeff Garzik
2000-11-06  7:29         ` David Woodhouse
2000-11-06 10:53         ` Alan Cox
2000-11-06 11:03           ` Dan Hollis
2000-11-06 11:04             ` Jeff Garzik
2000-11-06 11:35               ` Alan Cox
2000-11-06 11:36                 ` Jeff Garzik
2000-11-06 11:06             ` David Woodhouse
2000-11-06 11:09               ` Jeff Garzik
2000-11-06 11:20               ` Jeff Garzik
2000-11-06 11:37               ` David Woodhouse
2000-11-06 11:40                 ` Jeff Garzik
2000-11-06 11:47                 ` David Woodhouse
2000-11-06 11:57                   ` Jeff Garzik
2000-11-06 12:03                     ` Alan Cox
2000-11-06 13:12                   ` David Woodhouse
2000-11-06 13:38                     ` Jeff Garzik
2000-11-06 13:56                     ` David Woodhouse
2000-11-06 13:21                   ` David Woodhouse
2000-11-06 13:35                   ` James A. Sutherland
2000-11-06 17:12                     ` Alan Cox
2000-11-06 17:38                       ` James A. Sutherland
2000-11-06 18:39                       ` Paul Jakma
2000-11-06 21:28                         ` Alan Cox
2000-11-06 18:55                     ` Dan Hollis
2000-11-07  0:18                       ` James A. Sutherland
2000-11-07  0:27                         ` Alan Cox
2000-11-07  0:38                           ` James A. Sutherland
2000-11-07 12:07                             ` Alan Cox
2000-11-07 12:13                               ` James A. Sutherland
2000-11-07 12:35                                 ` Alan Cox
2000-11-07 12:49                                   ` James A. Sutherland
2000-11-07 12:52                                     ` Alan Cox
2000-11-07 12:51                                   ` Petko Manolov
2000-11-06 13:40                   ` David Woodhouse
2000-11-06 15:23                     ` James A. Sutherland
2000-11-06 15:34                     ` David Woodhouse
2000-11-06 16:31                       ` Horst von Brand
2000-11-06 17:06                         ` David Woodhouse
2000-11-06 17:25                           ` Alon Ziv
2000-11-06 17:34                             ` Alan Cox
2000-11-06 19:49                               ` Rogier Wolff
2000-11-06 21:34                                 ` Alan Cox
2000-11-06 17:25                           ` David Woodhouse
2000-11-06 19:27                             ` Tim Riker
2000-11-06 21:33                               ` Alan Cox
2000-11-06 23:57                           ` Horst von Brand
2000-11-06 17:23                         ` Alan Cox
2000-11-08 14:56                           ` Jamie Lokier
2000-11-06 18:00                         ` Martin Dalecki
2000-11-06 17:29                           ` Alan Cox
2000-11-06 16:42                       ` James A. Sutherland
2000-11-06 16:57                         ` Horst von Brand
2000-11-06 17:01                           ` James A. Sutherland
2000-11-06 23:54                             ` Horst von Brand
2000-11-07  8:44                               ` James A. Sutherland
2000-11-06 17:12                           ` David Woodhouse
2000-11-06 17:45                             ` James A. Sutherland
2000-11-06 18:37                             ` Paul Jakma
2000-11-07  0:04                             ` Horst von Brand
2000-11-06 17:08                       ` David Woodhouse
2000-11-06 17:33                         ` James A. Sutherland
2000-11-06 23:28                           ` Gerhard Mack
2000-11-07  0:34                             ` James A. Sutherland
2000-11-07  0:42                               ` Gerhard Mack
2000-11-07  0:43                                 ` James A. Sutherland
2000-11-07  1:20                                   ` Gerhard Mack
2000-11-07  8:41                                     ` James A. Sutherland
2000-11-07  1:44                               ` Horst von Brand
2000-11-06 17:44                         ` David Woodhouse
2000-11-06 17:53                           ` James A. Sutherland
2000-11-06 20:46                             ` Evan Jeffrey
2000-11-07  0:23                               ` James A. Sutherland
2000-11-06 15:15                 ` Martin Dalecki
2000-11-06 17:19                   ` Alan Cox
2000-11-06 17:34                     ` David Woodhouse
2000-11-06 18:22                       ` Oliver Xymoron
2000-11-06 18:37                         ` Jeff Garzik
2000-11-06 19:09                           ` Oliver Xymoron
2000-11-07  0:32                             ` Horst von Brand
2000-11-06 21:19                           ` Alan Cox
2000-11-06 18:22                 ` Paul Jakma
2000-11-06 21:18                   ` Alan Cox
2000-11-06 23:00                     ` Paul Jakma
2000-11-07  2:11                       ` Keith Owens
2000-11-06  7:28       ` Oliver Xymoron
2000-11-06  7:32         ` David Woodhouse
2000-11-06  7:45           ` Jeff Garzik
2000-11-06  8:00             ` David Woodhouse
2000-11-06 13:44               ` Andrew Pimlott
2000-11-06  7:48           ` Oliver Xymoron
2000-11-06  8:02             ` David Woodhouse
2000-11-06 18:09               ` Eric W. Biederman
2000-11-06 21:17                 ` Alan Cox
2000-11-07  9:55                   ` Helge Hafting
2000-11-07  2:09                 ` Keith Owens

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).