Skip to content

Commit

Permalink
Perform KABI checks in parallel
Browse files Browse the repository at this point in the history
Reduce the time required for ./configure to perform the needed
KABI checks by allowing kbuild to compile multiple test cases in
parallel.  This was accomplished by splitting each test's source
code from the logic handling whether that code could be compiled
or not.

By introducing this split it's possible to minimize the number of
times kbuild needs to be invoked.  As importantly, it means all of
the tests can be built in parallel.  This does require a little extra
care since we expect some tests to fail, so the --keep-going (-k)
option must be provided otherwise some tests may not get compiled.
Furthermore, since a failure during the kbuild modpost phase will
result in an early exit; the final linking phase is limited to tests
which passed the initial compilation and produced an object file.

Once everything has been built the configure script proceeds as
previously.  The only significant difference is that it now merely
needs to test for the existence of a .ko file to determine the
result of a given test.  This vastly speeds up the entire process.

New test cases should use ZFS_LINUX_TEST_SRC to declare their test
source code and ZFS_LINUX_TEST_RESULT to check the result.  All of
the existing kernel-*.m4 files have been updated accordingly, see
config/kernel-current-time.m4 for a basic example.  The legacy
ZFS_LINUX_TRY_COMPILE macro has been kept to handle special cases
but it's use is not encouraged.

                  master (secs)   patched (secs)
                  -------------   ----------------
autogen.sh        61              68
configure         137             24  (~17% of current run time)
make -j $(nproc)  44              44
make rpms         287             150

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes openzfs#8547
Closes openzfs#9132
Closes openzfs#9341
Conflicts:
	Makefile.am
	config/kernel-fpu.m4
  • Loading branch information
behlendorf authored and tonyhutter committed Dec 27, 2019
1 parent be71dd1 commit f74461d
Show file tree
Hide file tree
Showing 118 changed files with 3,256 additions and 2,160 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Makefile.in
# Top level generated files specific to this top level dir
#
/bin
/build
/configure
/config.log
/config.status
Expand Down
9 changes: 5 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ gitrev:

BUILT_SOURCES = gitrev

distclean-local:
-$(RM) -R autom4te*.cache
# Double-colon rules are allowed; there are multiple independent definitions.
distclean-local::
-$(RM) -R autom4te*.cache build
-find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-o -name .pc -o -name .hg -o -name .git \) -prune -o \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
Expand Down Expand Up @@ -92,8 +93,8 @@ commitcheck:
fi

cstyle:
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
! -name '*.mod.c' -type f \
@find ${top_srcdir} -name build -prune -o -name '*.[hc]' \
! -name 'zfs_config.*' ! -name '*.mod.c' -type f \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+

shellcheck:
Expand Down
3 changes: 1 addition & 2 deletions config/iconv.m4
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ size_t iconv();
[am_cv_proto_iconv_arg1="const"])
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
AC_MSG_RESULT([
$am_cv_proto_iconv])
AC_MSG_RESULT([$am_cv_proto_iconv])
else
dnl When compiling GNU libiconv on a system that does not have iconv yet,
dnl pick the POSIX compliant declaration without 'const'.
Expand Down
18 changes: 12 additions & 6 deletions config/kernel-access-ok-type.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ dnl #
dnl # - access_ok(type, addr, size)
dnl # + access_ok(addr, size)
dnl #
AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
ZFS_LINUX_TRY_COMPILE([
AC_DEFUN([ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE], [
ZFS_LINUX_TEST_SRC([access_ok_type], [
#include <linux/uaccess.h>
],[
const void __user __attribute__((unused)) *addr = (void *) 0xdeadbeef;
const void __user __attribute__((unused)) *addr =
(void *) 0xdeadbeef;
unsigned long __attribute__((unused)) size = 1;
int error __attribute__((unused)) = access_ok(0, addr, size);
],[
])
])

AC_DEFUN([ZFS_AC_KERNEL_ACCESS_OK_TYPE], [
AC_MSG_CHECKING([whether access_ok() has 'type' parameter])
ZFS_LINUX_TEST_RESULT([access_ok_type], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1, [kernel has access_ok with 'type' parameter])
AC_DEFINE(HAVE_ACCESS_OK_TYPE, 1,
[kernel has access_ok with 'type' parameter])
],[
AC_MSG_RESULT(no)
])
Expand Down
Loading

0 comments on commit f74461d

Please sign in to comment.