Page MenuHomeFreeBSD

Minor speedup for load_kld function
AbandonedPublic

Authored by crees on Dec 28 2018, 2:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 18, 4:21 AM
Unknown Object (File)
Feb 11 2024, 9:02 PM
Unknown Object (File)
Jan 13 2024, 11:16 AM
Unknown Object (File)
Dec 22 2023, 9:42 PM
Unknown Object (File)
Dec 21 2023, 11:46 AM
Unknown Object (File)
Nov 15 2023, 3:37 PM
Unknown Object (File)
Oct 10 2023, 2:32 PM
Unknown Object (File)
Aug 7 2023, 6:37 PM

Details

Summary

Remove now unnecessary kldstat check before attempting to load modules.

Since r233109, kldload has the -n option, which silently ignores options
that are already loaded.

https://lists.freebsd.org/pipermail/freebsd-rc/2018-December/003899.html

Test Plan
[crees@pegasus]~/workspace/src/head% sudo sh
# . libexec/rc/rc.subr
# kldstat |grep cuse
# load_kld cuse4bsd
# kldstat |grep cuse
15    1 0xffffffff818c3000 40a0     cuse.ko
# load_kld cuse4bsd
# load_kld doesntexist
kldload: can't load doesntexist: No such file or directory
sh: WARNING: Unable to load kernel module doesntexist
# kldunload cuse
# load_kld -m nothing -e noop /boot/modules/cuse4bsd.ko
# kldstat |grep cuse
15    1 0xffffffff818c3000 4c80     cuse4bsd.ko
# load_kld -m nothing -e noop /boot/modules/cuse4bsd.ko
# load_kld -m nothing -e noop /boot/modules/cuse4bsd.ko
# load_kld -m nothing -e noop /boot/modules/cuse4bsd.ko
# kldstat |grep cuse
15    1 0xffffffff818c3000 4c80     cuse4bsd.ko
#

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

crees edited the summary of this revision. (Show Details)
bcr added a subscriber: bcr.

OK for the man page changes, .Dd bump upon commit. ;-)

This revision is now accepted and ready to land.Dec 28 2018, 3:01 PM
rgrimes added a subscriber: rgrimes.

I have performed a visual only review.

I have performed a visual only review.

Greatly appreciated. Can I take that as approval by a src developer?

I have performed a visual only review.

Greatly appreciated. Can I take that as approval by a src developer?

I am sorry, I do not have that authority at this time.

jilles added a subscriber: jilles.
jilles added inline comments.
libexec/rc/rc.subr
1866 ↗(On Diff #52366)

Debug output will be different, but I think it is enough to mention that in the commit message.

Fantastic, thanks for the approval and tip.

This revision was automatically updated to reflect the committed changes.
crees added a subscriber: avg.

I've reverted the patch for now (thanks again Jilles for your approval).

If the zfs.ko module is loaded, a zfs module exists in the kernel, but I suspect that zfs doesn't exist in a kernel with it compiled in; only zfsctrl, based on what avg has suggested (Andriy, hope you don't mind me subscribing you).

I think that changing required_modules to zfsctrl in the zfs script should fix this, but I'll need to verify that before trying to commit again, as well as verify that zfs.ko is loaded if it doesn't.

If the zfs.ko module is loaded, a zfs module exists in the kernel, but I suspect that zfs doesn't exist in a kernel with it compiled in; only zfsctrl, based on what avg has suggested

Once again, you are confusing a name of a loadable file with a name of a module. Which is not surprising as that duality is confusing. E.g., a single loadable file can contains multiple modules.
Whether ZFS is compiled into the kernel or loaded via zfs.ko, the module name is still zfsctrl. It's the module name.

Thanks very much for the explanation-- I think my terminology is just off here (I do understand what you mean). I have some ideas to get this to work, but I'll get back when I've tried them, may not be for a few days.

I don't think the upheaval or risk of further bugs is worth this-- the code works as-is right now.