From 1393ba5c9beb2b33e315d9d4348a15ab3d1bf3a6 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 6 Nov 2015 15:29:52 -0500 Subject: [PATCH 1/3] tools/liblockdep: remove task argument from debug_check_no_locks_held The tas argument was removed from the kernel code in 1b1d2fb4 ("lockdep: remove task argument from debug_check_no_locks_held"). Remove it in loblockdep too. Signed-off-by: Sasha Levin --- tools/lib/lockdep/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c index 8ef602f18a32..9be663340f0a 100644 --- a/tools/lib/lockdep/common.c +++ b/tools/lib/lockdep/common.c @@ -18,7 +18,7 @@ __attribute__((constructor)) static void liblockdep_init(void) __attribute__((destructor)) static void liblockdep_exit(void) { - debug_check_no_locks_held(¤t_obj); + debug_check_no_locks_held(); } struct task_struct *__curr(void) From e308e942e122f5de1a180f0b2a4002d09a757f45 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 6 Nov 2015 15:34:23 -0500 Subject: [PATCH 2/3] tools/liblockdep: add userspace versions of WRITE_ONCE and RCU_INIT_POINTER These were added to the kernel code in cee34d88c ("lockdep: Fix a race between /proc/lock_stat and module unload"). There's nothing special we need to do about them in userspace. Signed-off-by: Sasha Levin --- tools/lib/lockdep/uinclude/linux/compiler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/lib/lockdep/uinclude/linux/compiler.h b/tools/lib/lockdep/uinclude/linux/compiler.h index 7ac838a1f196..6386dc3182a0 100644 --- a/tools/lib/lockdep/uinclude/linux/compiler.h +++ b/tools/lib/lockdep/uinclude/linux/compiler.h @@ -3,5 +3,7 @@ #define __used __attribute__((__unused__)) #define unlikely +#define WRITE_ONCE(x, val) x=(val) +#define RCU_INIT_POINTER(p, v) p=(v) #endif From 2b62c2dbb902625f5c5a30c0209f261b1cf15a2a Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Fri, 6 Nov 2015 15:47:29 -0500 Subject: [PATCH 3/3] tools/liblockdep: explicitly declare lockdep API we call from liblockdep It seems that newer gcc complains about lack of explicit declaration for some of the API we use, add it in. Signed-off-by: Sasha Levin --- tools/lib/lockdep/include/liblockdep/common.h | 2 ++ tools/lib/lockdep/uinclude/linux/lockdep.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib/lockdep/include/liblockdep/common.h b/tools/lib/lockdep/include/liblockdep/common.h index 0bda630027c3..a60c14b9662a 100644 --- a/tools/lib/lockdep/include/liblockdep/common.h +++ b/tools/lib/lockdep/include/liblockdep/common.h @@ -43,6 +43,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, struct lockdep_map *nest_lock, unsigned long ip); void lock_release(struct lockdep_map *lock, int nested, unsigned long ip); +extern void debug_check_no_locks_freed(const void *from, unsigned long len); +extern void lockdep_init(void); #define STATIC_LOCKDEP_MAP_INIT(_name, _key) \ { .name = (_name), .key = (void *)(_key), } diff --git a/tools/lib/lockdep/uinclude/linux/lockdep.h b/tools/lib/lockdep/uinclude/linux/lockdep.h index c1552c28507e..c808c7d02d21 100644 --- a/tools/lib/lockdep/uinclude/linux/lockdep.h +++ b/tools/lib/lockdep/uinclude/linux/lockdep.h @@ -6,7 +6,7 @@ #include #include #include - +#include #define MAX_LOCK_DEPTH 2000UL @@ -54,5 +54,6 @@ static struct new_utsname *init_utsname(void) #define static_obj(x) 1 #define debug_show_all_locks() +extern void debug_check_no_locks_held(void); #endif