From 0300a6efd226f138b3f6968f82b0a4313074a1a6 Mon Sep 17 00:00:00 2001 From: Andrew Perepechko Date: Sat, 28 Apr 2018 11:32:03 +0300 Subject: [PATCH] LU-10964 build: armv7 client build fixes This commit is supposed to fix armv7 Lustre client build, mostly 64-bit division related changes. Change-Id: I93d83d577351c1a1053e39a162cb1e85fc4e8aa3 Signed-off-by: Andrew Perepechko Reviewed-on: https://review.whamcloud.com/32194 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Alexander Zarochentsev Reviewed-by: Oleg Drokin --- config/lustre-build-linux.m4 | 2 +- lnet/selftest/conrpc.c | 3 ++- lnet/selftest/console.c | 2 +- lustre/ldlm/ldlm_request.c | 3 ++- lustre/obdclass/lprocfs_status.c | 2 +- lustre/ptlrpc/import.c | 18 +++++++++--------- lustre/ptlrpc/service.c | 5 +++-- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/config/lustre-build-linux.m4 b/config/lustre-build-linux.m4 index 8967c01..d0e604e 100644 --- a/config/lustre-build-linux.m4 +++ b/config/lustre-build-linux.m4 @@ -528,7 +528,7 @@ MODULE_LICENSE("GPL");]) AC_DEFUN([LB_LINUX_COMPILE_IFELSE], [m4_ifvaln([$1], [AC_LANG_CONFTEST([AC_LANG_SOURCE([$1])])])dnl rm -f build/conftest.o build/conftest.mod.c build/conftest.ko -SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/') +SUBARCH=$(echo $target_cpu | sed -e 's/powerpc.*/powerpc/' -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/' -e 's/aarch64.*/arm64/' -e 's/armv7.*/arm/') AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] LDFLAGS= ${LD:+LD="$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_CHECK_INCLUDE -I$LINUX/arch/$SUBARCH/include -Iinclude -Iarch/$SUBARCH/include/generated -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -Iinclude/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi ${SPL_OBJ:+-include $SPL_OBJ/spl_config.h} ${ZFS_OBJ:+-include $ZFS_OBJ/zfs_config.h} ${SPL:+-I$SPL -I$SPL/include } ${ZFS:+-I$ZFS -I$ZFS/include} -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST diff --git a/lnet/selftest/conrpc.c b/lnet/selftest/conrpc.c index 56a6bde..e5d7787 100644 --- a/lnet/selftest/conrpc.c +++ b/lnet/selftest/conrpc.c @@ -1252,7 +1252,8 @@ lstcon_rpc_pinger(void *arg) if (nd->nd_state != LST_NODE_ACTIVE) continue; - intv = ktime_ms_delta(ktime_get(), nd->nd_stamp) / MSEC_PER_SEC; + intv = div_u64(ktime_ms_delta(ktime_get(), nd->nd_stamp), + MSEC_PER_SEC); if (intv < nd->nd_timeout / 2) continue; diff --git a/lnet/selftest/console.c b/lnet/selftest/console.c index 45bcdfa..ee41bf3 100644 --- a/lnet/selftest/console.c +++ b/lnet/selftest/console.c @@ -1708,7 +1708,7 @@ lstcon_new_session_id(struct lst_sid *sid) LNetGetId(1, &id); sid->ses_nid = id.nid; - sid->ses_stamp = ktime_get_ns() / NSEC_PER_MSEC; + sid->ses_stamp = div_u64(ktime_get_ns(), NSEC_PER_MSEC); } int diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 55b395c..014b67a 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -1650,7 +1650,8 @@ static enum ldlm_policy_res ldlm_cancel_lrur_policy(struct ldlm_namespace *ns, slv = ldlm_pool_get_slv(pl); lvf = ldlm_pool_get_lvf(pl); - la = ktime_to_ns(ktime_sub(cur, lock->l_last_used)) / NSEC_PER_SEC; + la = div_u64(ktime_to_ns(ktime_sub(cur, lock->l_last_used)), + NSEC_PER_SEC); lv = lvf * la * unused; /* Inform pool about current CLV to see it via debugfs. */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 7a0003d..7a202e2 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -2053,7 +2053,7 @@ static int str_to_u64_parse(char *buffer, unsigned long count, } /* the multiplier limits how large the value can be */ - wrap_indicator /= mult; + wrap_indicator = div64_u64(wrap_indicator, mult); if (strwhole) { rc = kstrtoull(strwhole, base, &whole); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 3ecc4dc..363cf2d 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -305,16 +305,16 @@ void ptlrpc_invalidate_import(struct obd_import *imp) * out. Use obd_timeout if calculated value is smaller * than it. */ - if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_REPL_UNLINK)) { - timeout = ptlrpc_inflight_timeout(imp); - timeout += timeout / 3; + if (!OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_LONG_REPL_UNLINK)) { + timeout = ptlrpc_inflight_timeout(imp); + timeout += div_u64(timeout, 3); - if (timeout == 0) - timeout = obd_timeout; - } else { - /* decrease the interval to increase race condition */ - timeout = 1; - } + if (timeout == 0) + timeout = obd_timeout; + } else { + /* decrease the interval to increase race condition */ + timeout = 1; + } CDEBUG(D_RPCTRACE, "Sleeping %llds for inflight to error out\n", timeout); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 5f2322f..9625af5 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -2102,7 +2102,8 @@ ptlrpc_server_handle_request(struct ptlrpc_service_part *svcpt, if (unlikely(ptlrpc_check_req(request))) goto put_conn; ptlrpc_update_export_timer(request->rq_export, - timediff_usecs / (USEC_PER_SEC / 2)); + div_u64(timediff_usecs, + USEC_PER_SEC / 2)); } /* Discard requests queued for longer than the deadline. @@ -2189,7 +2190,7 @@ put_conn: DEBUG_REQ(D_ADAPTTO, request, "sent %d early replies before finishing in %llds", request->rq_early_count, - arrived_usecs / USEC_PER_SEC); + div_u64(arrived_usecs, USEC_PER_SEC)); } ptlrpc_server_finish_active_request(svcpt, request); -- 1.8.3.1