From: Bruno Faccini Date: Wed, 12 Nov 2014 14:23:06 +0000 (+0100) Subject: LU-5953 build: use installed OFED by default X-Git-Tag: 2.7.51~16 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=refs%2Fchanges%2F86%2F12686%2F19 LU-5953 build: use installed OFED by default During LNET autoconf phase, if OFED installed and its devel headers are available, default to use it instead of in-Kernel IB driver. Also handle wrong case where OFED installed but not devel preventing to build against OFED. Had to add new "patches" vs "kernel_patches" dir name use in recent OFED versions and to avoid its check to collide with inkernel-IB builds case. Current OFED headers detection mechanism allow for non-standard prefix but relies on "ofed_info" command and on "%prefix/openib" link (both are ok for 1.5.x and 3.x versions), and should work for both source and DKMS Lustre builds. Test-Parameters: nettypes=o2ib Signed-off-by: Bruno Faccini Change-Id: I82639f8392d5fe707a3b1a1719d53ab937e918b5 Reviewed-on: http://review.whamcloud.com/12686 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index 5d57ff8..a1194e4 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -148,27 +148,53 @@ AC_DEFUN([LN_CONFIG_DLC], [ # # LN_CONFIG_O2IB # +# If current OFED installed (assume with "ofed_info") and devel +# headers are not found, error because we assume OFED infiniband +# driver needs to be used and we must configure/build with it. +# Current OFED headers detection mechanism allow for non-standard +# prefix but relies on "ofed_info" command and on "%prefix/openib" +# link (both are ok for 1.5.x and 3.x versions), and should work +# for both source and DKMS builds. +# AC_DEFUN([LN_CONFIG_O2IB], [ AC_MSG_CHECKING([whether to use Compat RDMA]) AC_ARG_WITH([o2ib], - AC_HELP_STRING([--with-o2ib=path], + AC_HELP_STRING([--with-o2ib=[yes|no|]], [build o2iblnd against path]), - [ - case $with_o2ib in - yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband" - ENABLEO2IB=2 - ;; - no) ENABLEO2IB=0 - ;; - *) O2IBPATHS=$with_o2ib - ENABLEO2IB=3 - ;; - esac - ],[ - O2IBPATHS="$LINUX $LINUX/drivers/infiniband" - ENABLEO2IB=1 - ]) -AS_IF([test $ENABLEO2IB -eq 0], [ + [], [with_o2ib="yes"]) + +case $with_o2ib in + yes) AS_IF([which ofed_info 2>/dev/null], [ + O2IBPATHS=$(ofed_info | egrep -w 'compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs rpm -ql | grep '/openib$') + AS_IF([test -z "$O2IBPATHS"], [ + AC_MSG_ERROR([ +You seem to have an OFED installed but have not installed it's devel package. +If you still want to build Lustre for your OFED I/B stack, you need to install its devel headers RPM. +Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no. + ]) + ]) + AS_IF([test $(echo $O2IBPATHS | wc -w) -ge 2], [ + AC_MSG_ERROR([ +It appears that you have multiple OFED versions installed. +If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM. +Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no. + ]) + ]) + OFED="yes" + ], [ + O2IBPATHS="$LINUX $LINUX/drivers/infiniband" + ]) + ENABLEO2IB="yes" + ;; + no) ENABLEO2IB="no" + ;; + *) O2IBPATHS=$with_o2ib + ENABLEO2IB="withpath" + OFED="yes" + ;; +esac + +AS_IF([test $ENABLEO2IB = "no"], [ AC_MSG_RESULT([no]) ], [ o2ib_found=false @@ -177,12 +203,14 @@ AS_IF([test $ENABLEO2IB -eq 0], [ -f ${O2IBPATH}/include/rdma/ib_cm.h -a \ -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \ -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \)], [ - AS_IF([test \( -d ${O2IBPATH}/kernel_patches -a \ + AS_IF([test \( \( \( -d ${O2IBPATH}/patches -a \ + \( "x$OFED" = "xyes" \) \) -o \ + -d ${O2IBPATH}/kernel_patches \) -a \ -f ${O2IBPATH}/Makefile \)], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([ -you appear to be trying to use the OFED distribution's source +trying to use the, explicit or detected, OFED distribution's source directory (${O2IBPATH}) rather than the "development/headers" directory which is likely in ${O2IBPATH%-*} ]) @@ -194,9 +222,8 @@ directory which is likely in ${O2IBPATH%-*} if ! $o2ib_found; then AC_MSG_RESULT([no]) case $ENABLEO2IB in - 1) ;; - 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]) ;; - 3) AC_MSG_ERROR([bad --with-o2ib path]) ;; + "yes") AC_MSG_ERROR([no OFED nor kernel OpenIB gen2 headers present]) ;; + "withpath") AC_MSG_ERROR([bad --with-o2ib path]) ;; *) AC_MSG_ERROR([internal error]) ;; esac else @@ -263,15 +290,14 @@ directory which is likely in ${O2IBPATH%-*} O2IBLND="o2iblnd" ],[ case $ENABLEO2IB in - 1) ;; - 2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]) ;; - 3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;; + "yes") AC_MSG_ERROR([can't compile with OpenIB gen2 headers]) ;; + "withpath") AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;; *) AC_MSG_ERROR([internal error]) ;; esac ]) # we know at this point that the found OFED source is good O2IB_SYMVER="" - if test $ENABLEO2IB -eq 3 ; then + if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then # OFED default rpm not handle sles10 Modules.symvers name for name in Module.symvers Modules.symvers; do if test -f $O2IBPATH/$name; then @@ -290,7 +316,7 @@ directory which is likely in ${O2IBPATH%-*} cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE rm $PWD/$SYMVERFILE.old else - AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there]) + AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there]) fi fi @@ -301,7 +327,7 @@ AC_SUBST(EXTRA_OFED_INCLUDE) AC_SUBST(O2IBLND) # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument -AS_IF([test $ENABLEO2IB -ne 0], [ +AS_IF([test $ENABLEO2IB != "no"], [ LB_CHECK_COMPILE([if 'rdma_create_id' wants four args], rdma_create_id_4args, [ #ifdef HAVE_COMPAT_RDMA