kext autloading

Here you can discuss every aspect of OpenZFS on OS X. Note: not for support requests!

kext autloading

Postby RJVB » Wed Dec 20, 2023 11:06 am

I'm only an occasional ZFS user with sufficient recollection of how earlier O3x versions could cause kernel panics that I prefer to have the ZFS kext loaded only when I actually need it, idem for importing pools.

I build from source myself, so it's trivial to patch the code so the zpool command will load the kext if that's not yet the case, from the non-standard location where I put it normally (under /opt/local). I do load the zconfigd and InvariantDisks plists into launchd but not the others; this prevents the kext from autoloading behind my back. I do put zfs.fs under /System, to prevent the popup invitation to initialise the unrecognised volume everytime I import a pool.

So far so good but the other day I thought I'd start putting the zfs.kext into the standard location under /System because after all there are lots of kexts there that aren't loaded automatically. To my surprise the kext did load when I rebooted after a crash that wasn't related to ZFS. I definitely didn't have a pool imported at the time of the crash but I may have still had the kext loaded.

What reason could the system have had to load the kext? Is that because of the filesystem plugin under /System or is there simply logic in place to reload kexts that were loaded when the system was rebooted?
RJVB
 
Posts: 54
Joined: Tue May 23, 2017 12:32 pm

Re: kext autloading

Postby lundman » Wed Jan 03, 2024 4:37 pm

IIRC: The trigger to load or not is from module/os/macos/zfs/Info.plist

<key>IOResourceMatch</key>
<string>IOBSD</string>

but I don't really know how it works.

However, you should know, with newer macOS (Monterey and onwards) it will only load kexts at boot. So the
optional-load plan will only work while you stay with old (or you are willing to reboot to load it)

Even if you boot, then issue kextunload, XNU will go and reload it for you again. Sigh.
User avatar
lundman
 
Posts: 1337
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: kext autloading

Postby RJVB » Thu Jan 04, 2024 3:02 am

I assume that the auto-loading comes from the presence of the filesystem plugin at a system location. I'd have to check if the modules for other suppored filesystems are also loaded before having used them.

I have 16Gb of RAM in my laptop and I have now seen the free memory indicator jump up by about 5% just after unloading the kext (admittedly after having used a pool). I can't help but think of that as "significant" for something that isn't supposed to be doing anything anymore.

On a related note: how does one make ZFS drop the ARC cache on OS X?

lundman wrote:So the
optional-load plan will only work while you stay with old (or you are willing to reboot to load it)


That's fine with me. IF I buy another Mac it will be an old enough one that I can afford it, and probably able to run 10.15 on at best.

Even if you boot, then issue kextunload, XNU will go and reload it for you again. Sigh.


Be grateful that you can still build your own software without having to pay Apple...

If that behaviour comes from the kernel you could build your own patched version, if *that* is still an option nowadays?
RJVB
 
Posts: 54
Joined: Tue May 23, 2017 12:32 pm

Re: kext autloading

Postby nsarasa » Sun Feb 04, 2024 6:44 pm

RJVB wrote:I assume that the auto-loading comes from the presence of the filesystem plugin at a system location. I'd have to check if the modules for other suppored filesystems are also loaded before having used them.

I have 16Gb of RAM in my laptop and I have now seen the free memory indicator jump up by about 5% just after unloading the kext (admittedly after having used a pool)geometry dash subzero I can't help but think of that as "significant" for something that isn't supposed to be doing anything anymore.

On a related note: how does one make ZFS drop the ARC cache on OS X?

That's fine with me. IF I buy another Mac it will be an old enough one that I can afford it, and probably able to run 10.15 on at best.

Be grateful that you can still build your own software without having to pay Apple...


If that behaviour comes from the kernel you could build your own patched version, if *that* is still an option nowadays?


En fait, créer votre propre logiciel sans payer Apple est une bonne chose. Je pense que les erreurs ou les mécanismes de fonctionnement qui posent problème mais n'affectent pas trop la situation globale peuvent être pris en compte et ignorés.
nsarasa
 
Posts: 1
Joined: Sun Feb 04, 2024 6:41 pm

Re: kext autloading

Postby Sharko » Tue Feb 06, 2024 12:30 pm

nsarasa wrote:En fait, créer votre propre logiciel sans payer Apple est une bonne chose. Je pense que les erreurs ou les mécanismes de fonctionnement qui posent problème mais n'affectent pas trop la situation globale peuvent être pris en compte et ignorés.


ChatGPT est également entré dans la conversation ici, je pense.
Sharko
 
Posts: 230
Joined: Thu May 12, 2016 12:19 pm


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 58 guests