Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Modules vs. in-kernel?
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
andrewski
Guru
Guru


Joined: 30 Apr 2004
Posts: 366
Location: Royersford, PA, USA

PostPosted: Mon Nov 22, 2004 6:15 am    Post subject: Modules vs. in-kernel? Reply with quote

I saw on this message that Daniel Drake thinks that building important hardware into the kernel is a better idea than making modules. Kind of a revolutionary idea to a lamer like I am, who's always gone by the "when in doubt, build as module, unless needed at boot" rule....

What is the general consensus on this? Is Daniel just ultra-733T (no offense, I'm trying to be funny)? Or does he have a good point?

I have an NVIDIA video card, a Creative SB sound card, a madwifi-powered wifi card, and two hard drives. Should I build any of this into my kernel? Is there anything else that's not obvious that I should consider building in-kernel?
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 6:41 am    Post subject: module or kernel resident? Reply with quote

There are good reasons for going either way. This is the Gentoo distribution of Linux -- the Burger King "have-it-your-way" Linux. How would you like your kernel, sir? Any fries with that?

Modules are favored by driver writers because you do not have to reboot to unload and reinstall a driver or other module. They are also essential for dynamic boot-time configuration and hotplugging. If you think you might ever have to repair a broken box by pulling a bad board and plugging a similar board of a different kind -- such as a video board -- then you want to use a module for that functionality.

Kernel resident is essential for things needed at boot time, before modules are loaded, unless you can use an initrd to load those modules. Kernel resident modules make for a faster boot time -- important for some high availability server applications. Kernel resident modules also eliminate the possibility that a successful intrusion exploit would also be able to substitute a hacked version of a module into your running system.
Back to top
View user's profile Send private message
andrewski
Guru
Guru


Joined: 30 Apr 2004
Posts: 366
Location: Royersford, PA, USA

PostPosted: Mon Nov 22, 2004 6:52 am    Post subject: Reply with quote

Well, my system is just a desktop (ATM, hopefully a home server soon :P) so the largest appeal is faster boot times. Since I usually just reboot when I update a kernel driver (except nvidia or madwifi), would I benefit to have other drivers reside in the kernel?
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 7:18 am    Post subject: KISS for workstations Reply with quote

I usually follow the KISS principle for workstations, as they are usually behind several layers of defense, and thus not as exposed to attack from outside, and they do not need such fast boot times, as usually only one person is waiting for them, not a whole corporation or all of its customers. :o

I would use modules for everything on a workstation unless you had an definite needs to have something kernel resident for boot, such as a particular filesystem type, or LVM, or EVMS, or RAID, etc., and that only if it applies to the root filesystem. :D
Back to top
View user's profile Send private message
Deranger
Veteran
Veteran


Joined: 26 Aug 2004
Posts: 1215

PostPosted: Mon Nov 22, 2004 8:43 am    Post subject: Reply with quote

I am using this rule: "Disable everything that you don't need" --> Resulting 1.4 MB kernel, all compiled in except iptables.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 9:15 am    Post subject: so what happens if a board dies? Reply with quote

So if you have a board fail, such as a disk controller, how do you boot your system if you have to replace it with a different type -- such as lets say you loose your SCSI board that runs your RAID on a server, and its the middle of the night on a weekend, and although the old board was a Bus-Logic, all you can find in the spare parts bin is an Adaptec? How do you boot the system after the board swap? Do you have to boot with a live CD, and the build another kernel? If you used modules and genkernel, this would not be necessary, thus getting the system back online faster. :o
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 9:22 am    Post subject: one more thing... Reply with quote

One more point: if you are building for a very tiny system, such as an embedded application, or a very old slow box with limited ram and disk size, them compile everything in you need, and nothing you don't need.

It is important to realize that, at least for most of my usual situations, the above is not the case. I prefer to keep things as flexible as possible -- unless I feel I have a good reason to do otherwise.
Back to top
View user's profile Send private message
popel
n00b
n00b


Joined: 29 May 2004
Posts: 3

PostPosted: Mon Nov 22, 2004 10:20 am    Post subject: my 2 cents Reply with quote

put everything into the kernel that is realy stable:
- discdrivers
- network drivers
- usb driver
- ...

everything that is not that stable should be done as module.
examples:
- dvb driver
- graphics device drivers
- lirc
- and everything for ugly hardware.
normaly u know what makes problems. Modules alow u to reload/reset a brocken driver without reboot.

hope this helps
popel
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 10:30 am    Post subject: ans then your ethernet board dies... Reply with quote

So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.

This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.

Use modules unless you must use kernel resident!
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 10:32 am    Post subject: or at least... Reply with quote

Or at least keep a bootable kernel in your /boot partition with a line in your /boot/grub/grub.conf that will let you boot a kernel that uses modules in an emergency. :D
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Mon Nov 22, 2004 4:05 pm    Post subject: Re: ans then your ethernet board dies... Reply with quote

Moriah wrote:
So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.

This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.

Use modules unless you must use kernel resident!


You keep insisting on modules being so much better but what's the big deal about whipping out the livecd in a hardware emergency/replacement situation? It's not like it happens often.. does it?
_________________
undvd - ripping dvds should be as simple as unzip
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 4:40 pm    Post subject: Sometimes it *IS* a big deal Reply with quote

Not all of the boxes here have a CD drive, and I have had *MANY* occasions when I tried to use a CD drive only to find out that the thing no longer worked.

I usually do my installs directly over the network, booting from some other distribution. I use redhat as a bootstrap loader to install gentoo if I have to start from scratch because I can install redhat from my local webserver with only 2 floppies.

I have only had a very few times when a floppy drive did not work, and some of my systems have all the IDE ports taken by disk drives, so there is not even any place to connect a CD drive in an emergency. :o
Back to top
View user's profile Send private message
Soul_rebel
Tux's lil' helper
Tux's lil' helper


Joined: 12 Nov 2004
Posts: 88

PostPosted: Mon Nov 22, 2004 5:05 pm    Post subject: Reply with quote

sometimes is nice to have usb as a module: for example it lets you "turn off" an adsl modem that has lost syncronization without having to be physically in the proximity... i have got a script that uses this for my router-server pc.
_________________
LinuX @ the Speed of Thought
Back to top
View user's profile Send private message
andrewski
Guru
Guru


Joined: 30 Apr 2004
Posts: 366
Location: Royersford, PA, USA

PostPosted: Mon Nov 22, 2004 5:14 pm    Post subject: Re: ans then your ethernet board dies... Reply with quote

Moriah wrote:
So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.

This is especially inconvenient if you need to fetch a file over the network to do this, as you have no network to fetch it over.

Use modules unless you must use kernel resident!
But if I have a kernel custom-compiled for my system and I put something in that's not in my kernel, it won't matter whether it's a module or not; it won't be there and I'll have to resort to something else anyway.
Back to top
View user's profile Send private message
Fitzsimmons
Guru
Guru


Joined: 01 Jan 2003
Posts: 415
Location: Waterloo, Ontario, Canada

PostPosted: Mon Nov 22, 2004 5:19 pm    Post subject: Re: ans then your ethernet board dies... Reply with quote

Moriah wrote:
So if your ethernet board dies, and it was installed in the kernel, and you replace it with whatever you can get your hands on quickly, and its not the same kind, then you have to do a kernel build to get the network up.
[snip]


No you don't! You just compile the module for the new ethernet board and modprobe it. You don't need to build the whole kernel again, just the modules.
Back to top
View user's profile Send private message
Moriah
Advocate
Advocate


Joined: 27 Mar 2004
Posts: 2383
Location: Kentucky

PostPosted: Mon Nov 22, 2004 6:21 pm    Post subject: Reply with quote

Good point!

But what if it was your disk interface instead of your ethernet board? You change the disk interface to a different brand, and you still have problems unless you used genkernel or some other boot-time hardware detection mechanism.

At the least, you must have another machine you can compile the necessary module on, and then you still have to use trinux or something like it to get the module on your boot disk so you can boot, assuming there is no cd drive on the sick box.

Moral: make an optimized kernel if you want to, but keep a genkernel around so you can boot in an emergency.
Back to top
View user's profile Send private message
andrewski
Guru
Guru


Joined: 30 Apr 2004
Posts: 366
Location: Royersford, PA, USA

PostPosted: Mon Nov 22, 2004 6:24 pm    Post subject: Reply with quote

Moriah wrote:
Moral: make an optimized kernel if you want to, but keep a genkernel around so you can boot in an emergency.
Ah, but to be sure, that's something different than you've been saying the last few posts. That (in my head, anyway) seems like a good moral.
Back to top
View user's profile Send private message
MK
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2002
Posts: 97
Location: Bærum, Norway

PostPosted: Mon Nov 22, 2004 6:30 pm    Post subject: Reply with quote

I prefer having as much as possible as modules, don't like having a static kernel, and modules isn't that much slower. Also I got lots of SCSI drives I don't use anymore, so I can load the module when I need the cdr etc, no need to wait for scsi drivers to load at boot. I also always keep a kernel where everything is compiled in, because of some bad experience in the past...
Back to top
View user's profile Send private message
numerodix
l33t
l33t


Joined: 18 Jul 2002
Posts: 743
Location: nl.eu

PostPosted: Mon Nov 22, 2004 6:57 pm    Post subject: Re: Sometimes it *IS* a big deal Reply with quote

Moriah wrote:
Not all of the boxes here have a CD drive, and I have had *MANY* occasions when I tried to use a CD drive only to find out that the thing no longer worked.

I usually do my installs directly over the network, booting from some other distribution. I use redhat as a bootstrap loader to install gentoo if I have to start from scratch because I can install redhat from my local webserver with only 2 floppies.

I have only had a very few times when a floppy drive did not work, and some of my systems have all the IDE ports taken by disk drives, so there is not even any place to connect a CD drive in an emergency. :o


Well if your setup is that particular, maybe you should have stated those reasons in your argumentation? ;)

For most desktop users, I would imagine genkernel is a bit unnecessary for daily use. Not only does it take longer to boot because of the hardware auto-detection, it also takes ages to compile because you need boatloads of modules. I suppose for servers it doesn't matter whether it takes a minute or three minutes to boot cause you're not sitting around waiting for it to boot anyway. And you probably don't reboot often, so why not genkernel.
_________________
undvd - ripping dvds should be as simple as unzip
Back to top
View user's profile Send private message
Deranger
Veteran
Veteran


Joined: 26 Aug 2004
Posts: 1215

PostPosted: Mon Nov 22, 2004 8:16 pm    Post subject: Reply with quote

I have never used genkernel and I'm proud of it :wink:

LiveCD is definately the fastest way to deal all the problems.
Back to top
View user's profile Send private message
MighMoS
Guru
Guru


Joined: 24 Apr 2003
Posts: 416
Location: @ ~

PostPosted: Mon Nov 22, 2004 8:31 pm    Post subject: Reply with quote

For a server I have, I've disabled all modules, and module loading functionality, closing one way a hacker could gain full kernel access to my system :D. But for my desktop I still build most things into the kernel so I don't have to worry about hot/coldplugging, or stuffs like that. Its not mission critical, hardware doesn't die every week, and what's in there doesn't really move around. I know what I use my box for, so I don't need every possible option. For me it just makes sense to build it into the kernel.
_________________
jabber: MighMoS@jabber.org

localhost # export HOME=`which heart`
Back to top
View user's profile Send private message
Fitzsimmons
Guru
Guru


Joined: 01 Jan 2003
Posts: 415
Location: Waterloo, Ontario, Canada

PostPosted: Mon Nov 22, 2004 8:58 pm    Post subject: Reply with quote

MK wrote:
I prefer having as much as possible as modules, don't like having a static kernel, and modules isn't that much slower. Also I got lots of SCSI drives I don't use anymore, so I can load the module when I need the cdr etc, no need to wait for scsi drivers to load at boot. I also always keep a kernel where everything is compiled in, because of some bad experience in the past...


Actually I've heard that modules are actually slightly faster than builtin. However, I've also heard that -ffast-math and -funroll-loops are good ideas, so like everything else, I took it with my obligitory salt.
Back to top
View user's profile Send private message
tuber
Apprentice
Apprentice


Joined: 12 Nov 2004
Posts: 267

PostPosted: Mon Nov 22, 2004 11:15 pm    Post subject: Re: ans then your ethernet board dies... Reply with quote

Fitzsimmons wrote:


No you don't! You just compile the module for the new ethernet board and modprobe it. You don't need to build the whole kernel again, just the modules.


So if I decide that I want to enable a module that was previously disabled, I can just run "make menuconfig" (or something), enable the module, skip making the kernel, and go directly to "make modules_install" and modprobe with the currently running kernel?
Back to top
View user's profile Send private message
Fitzsimmons
Guru
Guru


Joined: 01 Jan 2003
Posts: 415
Location: Waterloo, Ontario, Canada

PostPosted: Tue Nov 23, 2004 5:11 pm    Post subject: Reply with quote

I believe it would be
Code:

#make modules modules_install


but otherwise, yes.
Back to top
View user's profile Send private message
Archangel1
Veteran
Veteran


Joined: 21 Apr 2004
Posts: 1212
Location: Work

PostPosted: Tue Nov 23, 2004 9:47 pm    Post subject: Reply with quote

I haven't bothered to modularise everything on mine. If by some freak a bit of hardware died, and both CD drives nuked themselves so I couldn't restore off a LiveCD, there's a fair chance the computer won't be usable *anyway* because it's been dropped or hit by a power spike or something. I'm not likely to fix it by compiling new modules inside the existing system.

Some things are necessary as modules though; USB on a laptop springs to mind (the modules are removed before suspending), and ALSA apparently likes modules better, although I've heard of it working fine built-in.

And of course the nVidia drivers; if not for them I could probably set up my desktop without module loading capability.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum