Bryan Drewery
2016-01-27 19:27:26 UTC
Hi,
WITH_FAST_DEPEND makes 'make depend' mostly a NOP and pushes the
dependency generation to the compilation phase which saves around 35%
time in the kernel build. Various bugs have been found with the
implementation and all but 1 are now fixed. The last is not including
the dependency files via .depend (really .MAKE.DEPENDFILE) which make
considers special when finding missing targets (it would be nice if make
had something like a .dinclude to flag any file with this magic). I
have a fix in testing that I plan to commit today.
I would like to enable FAST_DEPEND by default in the kernel build.
I have been asked to also remove the old mkdep version of 'make depend'.
I am unsure on this as I think it may be useful for some people for the
sake of debugging. However it does entail running the preprocessor and
given you can compile the entire kernel in minutes usually it may not be
worth keeping this as opposed to just compiling to generate them.
Keeping a behavior of generating the depend files pre-compile or
without-compile is my only real question here. I could likely work this
without-compile behavior into the FAST_DEPEND method to avoid needing
mkdep entirely.
The old code is horrendous, slow, and easily wrong and hard to maintain.
Some of the code that would be removed:
sys/conf/kern.post.mk
sys/conf/kern.pre.mk
it slow there. I do want to enable it by default and make the same
decisions there in the future.
WITH_FAST_DEPEND makes 'make depend' mostly a NOP and pushes the
dependency generation to the compilation phase which saves around 35%
time in the kernel build. Various bugs have been found with the
implementation and all but 1 are now fixed. The last is not including
the dependency files via .depend (really .MAKE.DEPENDFILE) which make
considers special when finding missing targets (it would be nice if make
had something like a .dinclude to flag any file with this magic). I
have a fix in testing that I plan to commit today.
I would like to enable FAST_DEPEND by default in the kernel build.
I have been asked to also remove the old mkdep version of 'make depend'.
I am unsure on this as I think it may be useful for some people for the
sake of debugging. However it does entail running the preprocessor and
given you can compile the entire kernel in minutes usually it may not be
worth keeping this as opposed to just compiling to generate them.
Keeping a behavior of generating the depend files pre-compile or
without-compile is my only real question here. I could likely work this
without-compile behavior into the FAST_DEPEND method to avoid needing
mkdep entirely.
The old code is horrendous, slow, and easily wrong and hard to maintain.
Some of the code that would be removed:
sys/conf/kern.post.mk
.depend: .PRECIOUS ${SRCS}
.if ${MK_FAST_DEPEND} == "no"
rm -f ${.TARGET}.tmp
# C files
${MAKE} -V CFILES_NORMAL -V SYSTEM_CFILES -V GEN_CFILES | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${CFLAGS}
${MAKE} -V CFILES_CDDL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_CFLAGS} \
${FBT_CFLAGS} ${DTRACE_CFLAGS}
${MAKE} -V CFILES_LINUXKPI | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
${CFLAGS} ${LINUXKPI_INCLUDES}
${MAKE} -V CFILES_OFED -V CFILES_MLX5 | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
${CFLAGS} ${OFEDINCLUDES}
# Assembly files
${MAKE} -V SFILES_NORMAL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ASM_CFLAGS}
${MAKE} -V SFILES_CDDL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_ASM_CFLAGS}
mv ${.TARGET}.tmp ${.TARGET}
.else
{ \
echo '.for __dependfile in $${DEPENDFILES_OBJS}'; \
echo '.sinclude "$${__dependfile}"'; \
echo '.endfor'; \
} > ${.TARGET}
.endif
(the for loop is a pending fix for the .depend issue).if ${MK_FAST_DEPEND} == "no"
rm -f ${.TARGET}.tmp
# C files
${MAKE} -V CFILES_NORMAL -V SYSTEM_CFILES -V GEN_CFILES | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${CFLAGS}
${MAKE} -V CFILES_CDDL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_CFLAGS} \
${FBT_CFLAGS} ${DTRACE_CFLAGS}
${MAKE} -V CFILES_LINUXKPI | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
${CFLAGS} ${LINUXKPI_INCLUDES}
${MAKE} -V CFILES_OFED -V CFILES_MLX5 | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp \
${CFLAGS} ${OFEDINCLUDES}
# Assembly files
${MAKE} -V SFILES_NORMAL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ASM_CFLAGS}
${MAKE} -V SFILES_CDDL | \
CC="${_MKDEPCC}" xargs mkdep -a -f ${.TARGET}.tmp ${ZFS_ASM_CFLAGS}
mv ${.TARGET}.tmp ${.TARGET}
.else
{ \
echo '.for __dependfile in $${DEPENDFILES_OBJS}'; \
echo '.sinclude "$${__dependfile}"'; \
echo '.endfor'; \
} > ${.TARGET}
.endif
sys/conf/kern.pre.mk
.if ${MK_FAST_DEPEND} == "no" && (make(depend) || make(kernel-depend))
# This hack lets us use the ipfilter code without spamming a new
# include path into contrib'ed source files.
INCLUDES+= -I$S/contrib/ipfilter
# ... and the same for ath
INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal
# ... and the same for the NgATM stuff
INCLUDES+= -I$S/contrib/ngatm
# ... and the same for vchiq
INCLUDES+= -I$S/contrib/vchiq
# ... and the same for twa
INCLUDES+= -I$S/dev/twa
# ... and the same for cxgb and cxgbe
INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe
.endif
As for world, it is far larger and impacts ports. So I am still taking# This hack lets us use the ipfilter code without spamming a new
# include path into contrib'ed source files.
INCLUDES+= -I$S/contrib/ipfilter
# ... and the same for ath
INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal
# ... and the same for the NgATM stuff
INCLUDES+= -I$S/contrib/ngatm
# ... and the same for vchiq
INCLUDES+= -I$S/contrib/vchiq
# ... and the same for twa
INCLUDES+= -I$S/dev/twa
# ... and the same for cxgb and cxgbe
INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe
.endif
it slow there. I do want to enable it by default and make the same
decisions there in the future.
--
Regards,
Bryan Drewery
Regards,
Bryan Drewery