From: James Simmons Date: Sun, 28 Aug 2016 20:16:56 +0000 (-0400) Subject: LU-8560 libcfs: handle stacktrace function address() change X-Git-Tag: 2.8.58~31 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=fb436c078ddb95f2371d93a37e4f67a31701add2 LU-8560 libcfs: handle stacktrace function address() change Starting in linux kernel 4.6 the address() function from struct stacktrace now return an int. Update Lustre to handle this change. Change-Id: I7d14c9134de3ae5642e2cad7d1d3829eb4ee9c50 Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/22207 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Frank Zago Reviewed-by: John L. Hammond Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index d7e1a45..b559798 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -339,6 +339,25 @@ crypto_hash_helpers, [ ]) # LIBCFS_CRYPTO_HASH_HELPERS # +# LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT +# +# linux 4.6 kernel changed stacktrace_ops address to return an int +# +AC_DEFUN([LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT], [ +LB_CHECK_COMPILE([if 'struct stacktrace_ops' address function returns an int], +stacktrace_ops_address_return_int, [ + #include +],[ + int rc; + + rc = ((struct stacktrace_ops *)0)->address(NULL, 0, 0); +],[ + AC_DEFINE(STACKTRACE_OPS_ADDRESS_RETURN_INT, 1, + ['struct stacktrace_ops' address function returns an int]) +]) +]) # LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT + +# # LIBCFS_PROG_LINUX # # LibCFS linux kernel checks @@ -380,6 +399,8 @@ LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK LIBCFS_FPU_API # 4.5 LIBCFS_CRYPTO_HASH_HELPERS +# 4.6 +LIBCFS_STACKTRACE_OPS_ADDRESS_RETURN_INT ]) # LIBCFS_PROG_LINUX # diff --git a/libcfs/libcfs/linux/linux-debug.c b/libcfs/libcfs/linux/linux-debug.c index 92d5361..7d97fb5 100644 --- a/libcfs/libcfs/linux/linux-debug.c +++ b/libcfs/libcfs/linux/linux-debug.c @@ -208,13 +208,21 @@ static int print_trace_stack(void *data, char *name) return 0; } -static void print_trace_address(void *data, unsigned long addr, int reliable) +#ifdef STACKTRACE_OPS_ADDRESS_RETURN_INT +static int +#else +static void +#endif +print_trace_address(void *data, unsigned long addr, int reliable) { char fmt[32]; touch_nmi_watchdog(); sprintf(fmt, " [<%016lx>] %s%%s\n", addr, reliable ? "": "? "); __print_symbol(fmt, addr); +#ifdef STACKTRACE_OPS_ADDRESS_RETURN_INT + return 0; +#endif } static const struct stacktrace_ops print_trace_ops = {