-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
config: cache results of kernel checks #17106
Conversation
As a dkms user, any suggestions for getting this to work with the dkms PRE_BUILD command in I assume one would want to add Or would that be dangerous if the logic behind the caching changes? Say one is updating from OpenZFS 2.3.1 to 2.3.2... it would be useful to reuse a PRE_BUILD="configure
--disable-dependency-tracking
--prefix=/usr
--with-config=kernel
--with-linux=\$(
if [ -e "\${kernel_source_dir/%build/source}" ]
then
echo "\${kernel_source_dir/%build/source}"
else
echo "\${kernel_source_dir}"
fi
)
--with-linux-obj="\${kernel_source_dir}"
\$(
[[ -n \"\${ICP_ROOT}\" ]] && \\
{
echo --with-qat=\"\${ICP_ROOT}\"
}
)
\$(
[[ -r \${PACKAGE_CONFIG} ]] \\
&& source \${PACKAGE_CONFIG} \\
&& shopt -q -s extglob \\
&& \\
{
if [[ \${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
then
echo --enable-debug
fi
if [[ \${ZFS_DKMS_ENABLE_DEBUGINFO,,} == @(y|yes) ]]
then
echo --enable-debuginfo
fi
}
)
" |
de7146e
to
d4dce51
Compare
@satmandu your suggestion I personally wouldn't though unless you're actually doing DKMS builds tens of times a day, because on any machine you're likely to run OpenZFS on this will save, what, 30 seconds? I'd be wondering more why you're doing that many DKMS builds! It's not going to help on a kernel update (no cache for that version), and the cache also holds library test results, which might change in a library upgrade. It might save a little bit in an OpenZFS upgrade as we don't often change the meaning of existing tests (generally only when adding or removing support for kernel versions), but again, only likely to be a few seconds. Of course, if you're just doing it for yourself, then go for it - it's probably fine if you know what you're doing. I'd be against it for end-users though because if it goes wrong, it's not at all obvious what to do. The answer is "delete config.cache, rerun from scratch", not something a casual upgrader should be expected to know. |
d4dce51
to
e2b1542
Compare
Works for me 👍
|
Could we get one more review on this one? I'd like to pull it in. |
Kernel checks are the heaviest part of the configure checks. This allows the results to be cached through the normal autoconf cache. Since we don't want to reuse cached values for different kernels, but don't want to discard the entire cache on every kernel, we instead add a short checksum to kernel config cache keys, based on the version and path, so the cache can hold results for multiple different kernels. Sponsored-by: https://despairlabs.com/sponsor/ Signed-off-by: Rob Norris <[email protected]>
e2b1542
to
c9ed5b1
Compare
@satmandu any objections to this PR? |
No objections! |
Mint, cheers! |
Motivation and Context
Kernel checks are the heaviest part of the configure checks. This allows the results to be cached through the normal autoconf cache.
Since we don't want to reuse cached values for different kernels, but don't want to discard the entire cache on every kernel, we instead add a short checksum to kernel config cache keys, based on the version and path, so the cache can hold results for multiple different kernels.
Description
In
ZFS_AC_KERNEL
, once we've done the kernel detection, we create a simple checksum out ofkernelsrc
,kernelbuild
andkernsrcver
.In
ZFS_LINUX_TEST_SRC
, if the output cache key exists (regardless of value), we skip creating the test source at all, since we don't want to build it.Then the test module build runs as normal, if there's anything left that wasn't cached already.
In
ZFS_LINUX_TEST_RESULT
andZFS_LINUX_TEST_RESULT_SYMBOL
, if the cache key doesn't exist, we run the test and set the cache var from it. Then, based on the cached value, we run the "yes" or "no" commands.How Has This Been Tested?
By hand, trying combinations of
--config-cache
and different kernels, then building.Without
--config-cache
, works as normal.With
--config-cache
, works as normal, and all sorts of interesting kernel things in the cache. Just one:Running again with
--config-cache
, same result just faster.Building against a different kernel, again, slow on the first run, fast on the next. And then, two items in the cache:
And finally, the real win for me is on a potato riscv board I've been messing with this weekend:
Types of changes
Checklist:
Signed-off-by
.