liblockdep: Fix compile errors
PATCH v2 1/2 liblockdep: Fix compile errors
Following commit caused failures.
dfaaf3fa0: (Use __jhash_mix() for iterate_chain_key()) Fixed by adding jhash.h
75dd602a5: (lockdep: Fix lock_chain::base size) Fixed by adding ARRAY_SIZE macro definition and changing the MAX_LOCK_DEPTH value to similar defined in linux/sched.h
--- tools/lib/lockdep/lockdep.c | 2 +- tools/lib/lockdep/uinclude/linux/bitops.h | 8 +- tools/lib/lockdep/uinclude/linux/compiler.h | 1 + tools/lib/lockdep/uinclude/linux/jhash.h | 175 +++++++++++++++++++++ tools/lib/lockdep/uinclude/linux/kernel.h | 1 + tools/lib/lockdep/uinclude/linux/lockdep.h | 2 +- .../uinclude/linux/unaligned/packed_struct.h | 46 ++++++ 7 files changed, 232 insertions(+), 3 deletions(-) create mode 100644 tools/lib/lockdep/uinclude/linux/jhash.h create mode 100644 tools/lib/lockdep/uinclude/linux/unaligned/packed_struct.h
tools/lib/lockdep/lockdep.c +1 -1
@@ -4,5 +4,5 @@#define hlist_for_each_entry_rcu hlist_for_each_entry#define hlist_add_head_rcu hlist_add_head#define hlist_del_rcu hlist_del - +#define prandom_u32 rand#include "../../../kernel/locking/lockdep.c"
tools/lib/lockdep/uinclude/linux/bitops.h +7 -1
@@ -1,3 +1,9 @@ +#ifndef _LINUX_BITOPS_H +#define _LINUX_BITOPS_H -/* empty file */ +static inline __u32 rol32 (__u32 word,unsigned int shift) +{ +return (word << shift) | (word >> ((-shift) &31 )); +} +#endif
tools/lib/lockdep/uinclude/linux/compiler.h +1 -0
@@ -2,6 +2,7 @@#define _LIBLOCKDEP_LINUX_COMPILER_H_#define __used __attribute__((__unused__)) +#define __packed __attribute__((__packed__))#define unlikely#define READ_ONCE (x) (x)#define WRITE_ONCE (x, val) x=(val)
tools/lib/lockdep/uinclude/linux/jhash.h new file +175 -0
175 lines not on this page · raw message
tools/lib/lockdep/uinclude/linux/kernel.h +1 -0
@@ -44,4 +44,5 @@#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })#endif +#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]))#endif
tools/lib/lockdep/uinclude/linux/lockdep.h +1 -1
@@ -8,7 +8,7 @@#include <linux/utsname.h> #include <linux/compiler.h> -#define MAX_LOCK_DEPTH 2000UL +#define MAX_LOCK_DEPTH 48UL#define asmlinkage#define __visible
tools/lib/lockdep/uinclude/linux/unaligned/packed_struct.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.4.11
PATCH v2 2/2 liblockdep: Remove -lpthread compiler option
With -lpthread option, the test for ABBA_2threads was failing, and test passed if it was removed. Since -pthread compiler option is sufficient for linking to pthread libraries, this patch removes -lpthread.
--- tools/lib/lockdep/run_tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/lockdep/run_tests.sh +2 -2
@@ -4,7 +4,7 @@ make &> /dev/null for i in `ls tests/*.c`; do testname=$(basename "$i" .c) - gcc -o tests/$testname -pthread -lpthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null + gcc -o tests/$testname -pthread $i liblockdep.a -Iinclude -D__USE_LIBLOCKDEP &> /dev/null echo -ne "$testname... " if [ $(timeout 1 ./tests/$testname | wc -l) -gt 0 ]; then echo "PASSED!"
@@ -18,7 +18,7 @@ done for i in `ls tests/*.c`; do testname=$(basename "$i" .c) - gcc -o tests/$testname -pthread -lpthread -Iinclude $i &> /dev/null + gcc -o tests/$testname -pthread -Iinclude $i &> /dev/null echo -ne "(PRELOAD) $testname... " if [ $(timeout 1 ./lockdep ./tests/$testname | wc -l) -gt 0 ]; then echo "PASSED!"
Signature · 1 line
2.4.11
tools/lib/lockdep/uinclude/linux/jhash.h line 1
Quoted 7 lines · Vishal Thanki
tools/lib/lockdep/uinclude/linux/jhash.h new file +1
-0@@ -0,0 +1,175 @@ +#ifndef _LINUX_JHASH_H
Oh, we don't need to copy the whole thing. I was thinking about something like:
tools/lib/lockdep/uinclude/linux/unaligned/packed_struct.h new file +1 -0
@@ -0,0 +1,2 @@ +#include "../../../include/linux/unaligned/packed_struct.h"
for both packed_struct.h and jhash.h. This was we get the advantage of having any fixes to those headers automatically go into liblockdep as well.
Thanks,
Sasha