svn commit: r367692 - head/sys/sys

John Baldwin jhb at FreeBSD.org
Wed Nov 18 00:48:39 UTC 2020


On 11/17/20 2:37 PM, Warner Losh wrote:
> On Tue, Nov 17, 2020 at 3:18 PM John Baldwin <jhb at freebsd.org> wrote:
> 
>> On 11/14/20 2:34 PM, Warner Losh wrote:
>>> true, but a version bump forces that and versions are cheap enough...
>>
>> Strictly speaking, version bumps don't force anything to recompile, they
>> just ensure that newer modules won't load on older kernels.  In this case,
>> the change to sys/ucred.h will result in sys/ucred.h's mtime changing so
>> that any kernel modules being built via NO_CLEAN=yes will rebuild ok.
>>
>> I'm not quite sure where this mantra that version bumps force rebuilds
>> came from, but they don't.  It's true that since it lives in <sys/param.h>
>> and most things include that, it mostly forces a rebuild, but that's
>> mostly a side effect, not due to explicit magic around __FreeBSD_version.
>>
> 
> It's more that modules stop loading when there's a version bump. This is
> both good and bad. It's good when there's a legit, KBI change that's likely
> to affect modules. This one seems on the edge. ZFS is affected, but most
> drivers are not.
> 
> It's bad when there's not really a problem since the last bump and you have
> to rebuild your kernel + modules to be a matched set. For production, you
> always want this, but sometimes you want to be able to run slightly newer
> modules than the kernel and that's oftentimes OK because some bumps don't
> affect KBI.

To be clear, it only blocks loading modules newer than the running kernel.
This still doesn't "force" recompilation in that nothing in the base build
system (I'm not counting ports here, but things in src/sys) compares
__FreeBSD_version values and forces a clean if there is a mismatch.  Only
header mtimes force rebuilds.

That is, you build by hand instead of using buildkernel, or you go ahead
and run 'make reinstallkernel' and then load, or run 'make installkernel'
and then go mess with the sysctl to undo the changes to rewrite your
module path so you can load an old module.  If you build a kernel from
your development tree and boot that, then the module will load fine (it's
what I generally do except in cases where I'm already running a kernel from
said tree and have a module I can unload/load in which case I do the
reinstallkernel route).

-- 
John Baldwin


More information about the svn-src-head mailing list