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)
Nov 17 2024, 12:28 PM
Unknown Object (File)
Nov 16 2024, 3:13 PM
Unknown Object (File)
Nov 12 2024, 2:30 PM
Unknown Object (File)
Nov 12 2024, 3:58 AM
Unknown Object (File)
Nov 12 2024, 3:02 AM
Unknown Object (File)
Oct 20 2024, 5:59 AM
Unknown Object (File)
Oct 3 2024, 1:09 PM
Unknown Object (File)
Oct 3 2024, 9:05 AM

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.