Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace

kernel/locking/lockdep.c deals with validating locking scenarios for
various architectures supported by the kernel. There isn't
anything kernel specific going on in lockdep, and when we
compare userspace to other architectures that don't have to deal
with irqs such as s390, they become all too similar.

We wrap kernel/locking/lockdep.c and include/linux/lockdep.h with
several headers which allow us to build and use lockdep from
userspace. We don't touch the kernel code itself which means
that any work done on lockdep in the kernel will automatically
benefit userspace lockdep as well!

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: torvalds@linux-foundation.org
Link: http://lkml.kernel.org/r/1371163284-6346-3-git-send-email-sasha.levin@oracle.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Sasha Levin and committed by
Ingo Molnar
5634bd7d 8dce7a9a

+720
+251
tools/lib/lockdep/Makefile
··· 1 + # liblockdep version 2 + LL_VERSION = 0 3 + LL_PATCHLEVEL = 0 4 + LL_EXTRAVERSION = 1 5 + 6 + # file format version 7 + FILE_VERSION = 1 8 + 9 + MAKEFLAGS += --no-print-directory 10 + 11 + 12 + # Makefiles suck: This macro sets a default value of $(2) for the 13 + # variable named by $(1), unless the variable has been set by 14 + # environment or command line. This is necessary for CC and AR 15 + # because make sets default values, so the simpler ?= approach 16 + # won't work as expected. 17 + define allow-override 18 + $(if $(or $(findstring environment,$(origin $(1))),\ 19 + $(findstring command line,$(origin $(1)))),,\ 20 + $(eval $(1) = $(2))) 21 + endef 22 + 23 + # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. 24 + $(call allow-override,CC,$(CROSS_COMPILE)gcc) 25 + $(call allow-override,AR,$(CROSS_COMPILE)ar) 26 + 27 + INSTALL = install 28 + 29 + # Use DESTDIR for installing into a different root directory. 30 + # This is useful for building a package. The program will be 31 + # installed in this directory as if it was the root directory. 32 + # Then the build tool can move it later. 33 + DESTDIR ?= 34 + DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 35 + 36 + prefix ?= /usr/local 37 + libdir_relative = lib 38 + libdir = $(prefix)/$(libdir_relative) 39 + bindir_relative = bin 40 + bindir = $(prefix)/$(bindir_relative) 41 + 42 + export DESTDIR DESTDIR_SQ INSTALL 43 + 44 + # copy a bit from Linux kbuild 45 + 46 + ifeq ("$(origin V)", "command line") 47 + VERBOSE = $(V) 48 + endif 49 + ifndef VERBOSE 50 + VERBOSE = 0 51 + endif 52 + 53 + ifeq ("$(origin O)", "command line") 54 + BUILD_OUTPUT := $(O) 55 + endif 56 + 57 + ifeq ($(BUILD_SRC),) 58 + ifneq ($(BUILD_OUTPUT),) 59 + 60 + define build_output 61 + $(if $(VERBOSE:1=),@)$(MAKE) -C $(BUILD_OUTPUT) \ 62 + BUILD_SRC=$(CURDIR) -f $(CURDIR)/Makefile $1 63 + endef 64 + 65 + saved-output := $(BUILD_OUTPUT) 66 + BUILD_OUTPUT := $(shell cd $(BUILD_OUTPUT) && /bin/pwd) 67 + $(if $(BUILD_OUTPUT),, \ 68 + $(error output directory "$(saved-output)" does not exist)) 69 + 70 + all: sub-make 71 + 72 + gui: force 73 + $(call build_output, all_cmd) 74 + 75 + $(filter-out gui,$(MAKECMDGOALS)): sub-make 76 + 77 + sub-make: force 78 + $(call build_output, $(MAKECMDGOALS)) 79 + 80 + 81 + # Leave processing to above invocation of make 82 + skip-makefile := 1 83 + 84 + endif # BUILD_OUTPUT 85 + endif # BUILD_SRC 86 + 87 + # We process the rest of the Makefile if this is the final invocation of make 88 + ifeq ($(skip-makefile),) 89 + 90 + srctree := $(if $(BUILD_SRC),$(BUILD_SRC),$(CURDIR)) 91 + objtree := $(CURDIR) 92 + src := $(srctree) 93 + obj := $(objtree) 94 + 95 + export prefix libdir bindir src obj 96 + 97 + # Shell quotes 98 + libdir_SQ = $(subst ','\'',$(libdir)) 99 + bindir_SQ = $(subst ','\'',$(bindir)) 100 + 101 + LIB_FILE = liblockdep.a liblockdep.so 102 + BIN_FILE = lockdep 103 + 104 + CONFIG_INCLUDES = 105 + CONFIG_LIBS = 106 + CONFIG_FLAGS = 107 + 108 + OBJ = $@ 109 + N = 110 + 111 + export Q VERBOSE 112 + 113 + LIBLOCKDEP_VERSION = $(LL_VERSION).$(LL_PATCHLEVEL).$(LL_EXTRAVERSION) 114 + 115 + INCLUDES = -I. -I/usr/local/include -I./uinclude $(CONFIG_INCLUDES) 116 + 117 + # Set compile option CFLAGS if not set elsewhere 118 + CFLAGS ?= -g -DCONFIG_LOCKDEP -DCONFIG_STACKTRACE -DCONFIG_PROVE_LOCKING -DBITS_PER_LONG=__WORDSIZE -DLIBLOCKDEP_VERSION='"$(LIBLOCKDEP_VERSION)"' -rdynamic -O0 -g 119 + 120 + override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ) 121 + 122 + ifeq ($(VERBOSE),1) 123 + Q = 124 + print_compile = 125 + print_app_build = 126 + print_fpic_compile = 127 + print_shared_lib_compile = 128 + print_install = 129 + else 130 + Q = @ 131 + print_compile = echo ' CC '$(OBJ); 132 + print_app_build = echo ' BUILD '$(OBJ); 133 + print_fpic_compile = echo ' CC FPIC '$(OBJ); 134 + print_shared_lib_compile = echo ' BUILD SHARED LIB '$(OBJ); 135 + print_static_lib_build = echo ' BUILD STATIC LIB '$(OBJ); 136 + print_install = echo ' INSTALL '$1' to $(DESTDIR_SQ)$2'; 137 + endif 138 + 139 + do_fpic_compile = \ 140 + ($(print_fpic_compile) \ 141 + $(CC) -c $(CFLAGS) $(EXT) -fPIC $< -o $@) 142 + 143 + do_app_build = \ 144 + ($(print_app_build) \ 145 + $(CC) $^ -rdynamic -o $@ $(CONFIG_LIBS) $(LIBS)) 146 + 147 + do_compile_shared_library = \ 148 + ($(print_shared_lib_compile) \ 149 + $(CC) --shared $^ -o $@ -lpthread -ldl) 150 + 151 + do_build_static_lib = \ 152 + ($(print_static_lib_build) \ 153 + $(RM) $@; $(AR) rcs $@ $^) 154 + 155 + 156 + define do_compile 157 + $(print_compile) \ 158 + $(CC) -c $(CFLAGS) $(EXT) $< -o $(obj)/$@; 159 + endef 160 + 161 + $(obj)/%.o: $(src)/%.c 162 + $(Q)$(call do_compile) 163 + 164 + %.o: $(src)/%.c 165 + $(Q)$(call do_compile) 166 + 167 + PEVENT_LIB_OBJS = common.o lockdep.o preload.o rbtree.o 168 + 169 + ALL_OBJS = $(PEVENT_LIB_OBJS) 170 + 171 + CMD_TARGETS = $(LIB_FILE) 172 + 173 + TARGETS = $(CMD_TARGETS) 174 + 175 + 176 + all: all_cmd 177 + 178 + all_cmd: $(CMD_TARGETS) 179 + 180 + liblockdep.so: $(PEVENT_LIB_OBJS) 181 + $(Q)$(do_compile_shared_library) 182 + 183 + liblockdep.a: $(PEVENT_LIB_OBJS) 184 + $(Q)$(do_build_static_lib) 185 + 186 + $(PEVENT_LIB_OBJS): %.o: $(src)/%.c 187 + $(Q)$(do_fpic_compile) 188 + 189 + ## make deps 190 + 191 + all_objs := $(sort $(ALL_OBJS)) 192 + all_deps := $(all_objs:%.o=.%.d) 193 + 194 + # let .d file also depends on the source and header files 195 + define check_deps 196 + @set -e; $(RM) $@; \ 197 + $(CC) -MM $(CFLAGS) $< > $@.$$$$; \ 198 + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ 199 + $(RM) $@.$$$$ 200 + endef 201 + 202 + $(all_deps): .%.d: $(src)/%.c 203 + $(Q)$(call check_deps) 204 + 205 + $(all_objs) : %.o : .%.d 206 + 207 + dep_includes := $(wildcard $(all_deps)) 208 + 209 + ifneq ($(dep_includes),) 210 + include $(dep_includes) 211 + endif 212 + 213 + ### Detect environment changes 214 + TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):$(ARCH):$(CROSS_COMPILE) 215 + 216 + tags: force 217 + $(RM) tags 218 + find . -name '*.[ch]' | xargs ctags --extra=+f --c-kinds=+px \ 219 + --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' 220 + 221 + TAGS: force 222 + $(RM) TAGS 223 + find . -name '*.[ch]' | xargs etags \ 224 + --regex='/_PE(\([^,)]*\).*/PEVENT_ERRNO__\1/' 225 + 226 + define do_install 227 + $(print_install) \ 228 + if [ ! -d '$(DESTDIR_SQ)$2' ]; then \ 229 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \ 230 + fi; \ 231 + $(INSTALL) $1 '$(DESTDIR_SQ)$2' 232 + endef 233 + 234 + install_lib: all_cmd 235 + $(Q)$(call do_install,$(LIB_FILE),$(libdir_SQ)) 236 + $(Q)$(call do_install,$(BIN_FILE),$(bindir_SQ)) 237 + 238 + install: install_lib 239 + 240 + clean: 241 + $(RM) *.o *~ $(TARGETS) *.a *.so $(VERSION_FILES) .*.d 242 + $(RM) tags TAGS 243 + 244 + endif # skip-makefile 245 + 246 + PHONY += force 247 + force: 248 + 249 + # Declare the contents of the .PHONY variable as phony. We keep that 250 + # information in a variable so we can use it in if_changed and friends. 251 + .PHONY: $(PHONY)
+33
tools/lib/lockdep/common.c
··· 1 + #include <stddef.h> 2 + #include <stdbool.h> 3 + #include <linux/compiler.h> 4 + #include <linux/lockdep.h> 5 + #include <unistd.h> 6 + #include <sys/syscall.h> 7 + 8 + static __thread struct task_struct current_obj; 9 + 10 + /* lockdep wants these */ 11 + bool debug_locks = true; 12 + bool debug_locks_silent; 13 + 14 + __attribute__((constructor)) static void liblockdep_init(void) 15 + { 16 + lockdep_init(); 17 + } 18 + 19 + __attribute__((destructor)) static void liblockdep_exit(void) 20 + { 21 + debug_check_no_locks_held(&current_obj); 22 + } 23 + 24 + struct task_struct *__curr(void) 25 + { 26 + if (current_obj.pid == 0) { 27 + /* Makes lockdep output pretty */ 28 + prctl(PR_GET_NAME, current_obj.comm); 29 + current_obj.pid = syscall(__NR_gettid); 30 + } 31 + 32 + return &current_obj; 33 + }
+2
tools/lib/lockdep/lockdep.c
··· 1 + #include <linux/lockdep.h> 2 + #include "../../../kernel/locking/lockdep.c"
+1
tools/lib/lockdep/lockdep_internals.h
··· 1 + #include "../../../kernel/locking/lockdep_internals.h"
+1
tools/lib/lockdep/lockdep_states.h
··· 1 + #include "../../../kernel/locking/lockdep_states.h"
+1
tools/lib/lockdep/rbtree.c
··· 1 + #include "../../../lib/rbtree.c"
+3
tools/lib/lockdep/uinclude/asm/hweight.h
··· 1 + 2 + /* empty file */ 3 +
+3
tools/lib/lockdep/uinclude/asm/sections.h
··· 1 + 2 + /* empty file */ 3 +
+3
tools/lib/lockdep/uinclude/linux/bitops.h
··· 1 + 2 + /* empty file */ 3 +
+7
tools/lib/lockdep/uinclude/linux/compiler.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_COMPILER_H_ 2 + #define _LIBLOCKDEP_LINUX_COMPILER_H_ 3 + 4 + #define __used __attribute__((__unused__)) 5 + #define unlikely 6 + 7 + #endif
+12
tools/lib/lockdep/uinclude/linux/debug_locks.h
··· 1 + #ifndef _LIBLOCKDEP_DEBUG_LOCKS_H_ 2 + #define _LIBLOCKDEP_DEBUG_LOCKS_H_ 3 + 4 + #include <stddef.h> 5 + #include <linux/compiler.h> 6 + 7 + #define DEBUG_LOCKS_WARN_ON(x) (x) 8 + 9 + extern bool debug_locks; 10 + extern bool debug_locks_silent; 11 + 12 + #endif
+3
tools/lib/lockdep/uinclude/linux/delay.h
··· 1 + 2 + /* empty file */ 3 +
+7
tools/lib/lockdep/uinclude/linux/export.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_EXPORT_H_ 2 + #define _LIBLOCKDEP_LINUX_EXPORT_H_ 3 + 4 + #define EXPORT_SYMBOL(sym) 5 + #define EXPORT_SYMBOL_GPL(sym) 6 + 7 + #endif
+3
tools/lib/lockdep/uinclude/linux/ftrace.h
··· 1 + 2 + /* empty file */ 3 +
+3
tools/lib/lockdep/uinclude/linux/gfp.h
··· 1 + 2 + /* empty file */ 3 +
+11
tools/lib/lockdep/uinclude/linux/hardirq.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_HARDIRQ_H_ 2 + #define _LIBLOCKDEP_LINUX_HARDIRQ_H_ 3 + 4 + #define SOFTIRQ_BITS 0UL 5 + #define HARDIRQ_BITS 0UL 6 + #define SOFTIRQ_SHIFT 0UL 7 + #define HARDIRQ_SHIFT 0UL 8 + #define hardirq_count() 0UL 9 + #define softirq_count() 0UL 10 + 11 + #endif
+1
tools/lib/lockdep/uinclude/linux/hash.h
··· 1 + #include "../../../include/linux/hash.h"
+3
tools/lib/lockdep/uinclude/linux/interrupt.h
··· 1 + 2 + /* empty file */ 3 +
+38
tools/lib/lockdep/uinclude/linux/irqflags.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 2 + #define _LIBLOCKDEP_LINUX_TRACE_IRQFLAGS_H_ 3 + 4 + # define trace_hardirq_context(p) 0 5 + # define trace_softirq_context(p) 0 6 + # define trace_hardirqs_enabled(p) 0 7 + # define trace_softirqs_enabled(p) 0 8 + # define trace_hardirq_enter() do { } while (0) 9 + # define trace_hardirq_exit() do { } while (0) 10 + # define lockdep_softirq_enter() do { } while (0) 11 + # define lockdep_softirq_exit() do { } while (0) 12 + # define INIT_TRACE_IRQFLAGS 13 + 14 + # define stop_critical_timings() do { } while (0) 15 + # define start_critical_timings() do { } while (0) 16 + 17 + #define raw_local_irq_disable() do { } while (0) 18 + #define raw_local_irq_enable() do { } while (0) 19 + #define raw_local_irq_save(flags) ((flags) = 0) 20 + #define raw_local_irq_restore(flags) do { } while (0) 21 + #define raw_local_save_flags(flags) ((flags) = 0) 22 + #define raw_irqs_disabled_flags(flags) do { } while (0) 23 + #define raw_irqs_disabled() 0 24 + #define raw_safe_halt() 25 + 26 + #define local_irq_enable() do { } while (0) 27 + #define local_irq_disable() do { } while (0) 28 + #define local_irq_save(flags) ((flags) = 0) 29 + #define local_irq_restore(flags) do { } while (0) 30 + #define local_save_flags(flags) ((flags) = 0) 31 + #define irqs_disabled() (1) 32 + #define irqs_disabled_flags(flags) (0) 33 + #define safe_halt() do { } while (0) 34 + 35 + #define trace_lock_release(x, y) 36 + #define trace_lock_acquire(a, b, c, d, e, f, g) 37 + 38 + #endif
+32
tools/lib/lockdep/uinclude/linux/kallsyms.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_KALLSYMS_H_ 2 + #define _LIBLOCKDEP_LINUX_KALLSYMS_H_ 3 + 4 + #include <linux/kernel.h> 5 + #include <stdio.h> 6 + 7 + #define KSYM_NAME_LEN 128 8 + 9 + struct module; 10 + 11 + static inline const char *kallsyms_lookup(unsigned long addr, 12 + unsigned long *symbolsize, 13 + unsigned long *offset, 14 + char **modname, char *namebuf) 15 + { 16 + return NULL; 17 + } 18 + 19 + #include <execinfo.h> 20 + #include <stdlib.h> 21 + static inline void print_ip_sym(unsigned long ip) 22 + { 23 + char **name; 24 + 25 + name = backtrace_symbols((void **)&ip, 1); 26 + 27 + printf("%s\n", *name); 28 + 29 + free(name); 30 + } 31 + 32 + #endif
+25
tools/lib/lockdep/uinclude/linux/kern_levels.h
··· 1 + #ifndef __KERN_LEVELS_H__ 2 + #define __KERN_LEVELS_H__ 3 + 4 + #define KERN_SOH "" /* ASCII Start Of Header */ 5 + #define KERN_SOH_ASCII '' 6 + 7 + #define KERN_EMERG KERN_SOH "" /* system is unusable */ 8 + #define KERN_ALERT KERN_SOH "" /* action must be taken immediately */ 9 + #define KERN_CRIT KERN_SOH "" /* critical conditions */ 10 + #define KERN_ERR KERN_SOH "" /* error conditions */ 11 + #define KERN_WARNING KERN_SOH "" /* warning conditions */ 12 + #define KERN_NOTICE KERN_SOH "" /* normal but significant condition */ 13 + #define KERN_INFO KERN_SOH "" /* informational */ 14 + #define KERN_DEBUG KERN_SOH "" /* debug-level messages */ 15 + 16 + #define KERN_DEFAULT KERN_SOH "" /* the default kernel loglevel */ 17 + 18 + /* 19 + * Annotation for a "continued" line of log printout (only done after a 20 + * line that had no enclosing \n). Only to be used by core/arch code 21 + * during early bootup (a continued line is not SMP-safe otherwise). 22 + */ 23 + #define KERN_CONT "" 24 + 25 + #endif
+44
tools/lib/lockdep/uinclude/linux/kernel.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_KERNEL_H_ 2 + #define _LIBLOCKDEP_LINUX_KERNEL_H_ 3 + 4 + #include <linux/export.h> 5 + #include <linux/types.h> 6 + #include <linux/rcu.h> 7 + #include <linux/hardirq.h> 8 + #include <linux/kern_levels.h> 9 + 10 + #ifndef container_of 11 + #define container_of(ptr, type, member) ({ \ 12 + const typeof(((type *)0)->member) * __mptr = (ptr); \ 13 + (type *)((char *)__mptr - offsetof(type, member)); }) 14 + #endif 15 + 16 + #define max(x, y) ({ \ 17 + typeof(x) _max1 = (x); \ 18 + typeof(y) _max2 = (y); \ 19 + (void) (&_max1 == &_max2); \ 20 + _max1 > _max2 ? _max1 : _max2; }) 21 + 22 + #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 23 + #define WARN_ON(x) (x) 24 + #define WARN_ON_ONCE(x) (x) 25 + #define likely(x) (x) 26 + #define WARN(x, y, z) (x) 27 + #define uninitialized_var(x) x 28 + #define __init 29 + #define noinline 30 + #define list_add_tail_rcu list_add_tail 31 + 32 + #ifndef CALLER_ADDR0 33 + #define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0)) 34 + #endif 35 + 36 + #ifndef _RET_IP_ 37 + #define _RET_IP_ CALLER_ADDR0 38 + #endif 39 + 40 + #ifndef _THIS_IP_ 41 + #define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; }) 42 + #endif 43 + 44 + #endif
+8
tools/lib/lockdep/uinclude/linux/kmemcheck.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_KMEMCHECK_H_ 2 + #define _LIBLOCKDEP_LINUX_KMEMCHECK_H_ 3 + 4 + static inline void kmemcheck_mark_initialized(void *address, unsigned int n) 5 + { 6 + } 7 + 8 + #endif
+3
tools/lib/lockdep/uinclude/linux/linkage.h
··· 1 + 2 + /* empty file */ 3 +
+1
tools/lib/lockdep/uinclude/linux/list.h
··· 1 + #include "../../../include/linux/list.h"
+55
tools/lib/lockdep/uinclude/linux/lockdep.h
··· 1 + #ifndef _LIBLOCKDEP_LOCKDEP_H_ 2 + #define _LIBLOCKDEP_LOCKDEP_H_ 3 + 4 + #include <sys/prctl.h> 5 + #include <sys/syscall.h> 6 + #include <string.h> 7 + #include <limits.h> 8 + #include <linux/utsname.h> 9 + 10 + 11 + #define MAX_LOCK_DEPTH 2000UL 12 + 13 + #include "../../../include/linux/lockdep.h" 14 + 15 + struct task_struct { 16 + u64 curr_chain_key; 17 + int lockdep_depth; 18 + unsigned int lockdep_recursion; 19 + struct held_lock held_locks[MAX_LOCK_DEPTH]; 20 + gfp_t lockdep_reclaim_gfp; 21 + int pid; 22 + char comm[17]; 23 + }; 24 + 25 + extern struct task_struct *__curr(void); 26 + 27 + #define current (__curr()) 28 + 29 + #define debug_locks_off() 1 30 + #define task_pid_nr(tsk) ((tsk)->pid) 31 + 32 + #define KSYM_NAME_LEN 128 33 + #define printk printf 34 + 35 + #define list_del_rcu list_del 36 + 37 + #define atomic_t unsigned long 38 + #define atomic_inc(x) ((*(x))++) 39 + 40 + static struct new_utsname *init_utsname(void) 41 + { 42 + static struct new_utsname n = (struct new_utsname) { 43 + .release = "liblockdep", 44 + .version = LIBLOCKDEP_VERSION, 45 + }; 46 + 47 + return &n; 48 + } 49 + 50 + #define print_tainted() "" 51 + #define static_obj(x) 1 52 + 53 + #define debug_show_all_locks() 54 + 55 + #endif
+6
tools/lib/lockdep/uinclude/linux/module.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_MODULE_H_ 2 + #define _LIBLOCKDEP_LINUX_MODULE_H_ 3 + 4 + #define module_param(name, type, perm) 5 + 6 + #endif
+3
tools/lib/lockdep/uinclude/linux/mutex.h
··· 1 + 2 + /* empty file */ 3 +
+1
tools/lib/lockdep/uinclude/linux/poison.h
··· 1 + #include "../../../include/linux/poison.h"
+6
tools/lib/lockdep/uinclude/linux/prefetch.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_PREFETCH_H_ 2 + #define _LIBLOCKDEP_LINUX_PREFETCH_H 3 + 4 + static inline void prefetch(void *a __attribute__((unused))) { } 5 + 6 + #endif
+3
tools/lib/lockdep/uinclude/linux/proc_fs.h
··· 1 + 2 + /* empty file */ 3 +
+1
tools/lib/lockdep/uinclude/linux/rbtree.h
··· 1 + #include "../../../include/linux/rbtree.h"
+2
tools/lib/lockdep/uinclude/linux/rbtree_augmented.h
··· 1 + #define __always_inline 2 + #include "../../../include/linux/rbtree_augmented.h"
+16
tools/lib/lockdep/uinclude/linux/rcu.h
··· 1 + #ifndef _LIBLOCKDEP_RCU_H_ 2 + #define _LIBLOCKDEP_RCU_H_ 3 + 4 + int rcu_scheduler_active; 5 + 6 + static inline int rcu_lockdep_current_cpu_online(void) 7 + { 8 + return 1; 9 + } 10 + 11 + static inline int rcu_is_cpu_idle(void) 12 + { 13 + return 1; 14 + } 15 + 16 + #endif
+3
tools/lib/lockdep/uinclude/linux/seq_file.h
··· 1 + 2 + /* empty file */ 3 +
+25
tools/lib/lockdep/uinclude/linux/spinlock.h
··· 1 + #ifndef _LIBLOCKDEP_SPINLOCK_H_ 2 + #define _LIBLOCKDEP_SPINLOCK_H_ 3 + 4 + #include <pthread.h> 5 + #include <stdbool.h> 6 + 7 + #define arch_spinlock_t pthread_mutex_t 8 + #define __ARCH_SPIN_LOCK_UNLOCKED PTHREAD_MUTEX_INITIALIZER 9 + 10 + static inline void arch_spin_lock(arch_spinlock_t *mutex) 11 + { 12 + pthread_mutex_lock(mutex); 13 + } 14 + 15 + static inline void arch_spin_unlock(arch_spinlock_t *mutex) 16 + { 17 + pthread_mutex_unlock(mutex); 18 + } 19 + 20 + static inline bool arch_spin_is_locked(arch_spinlock_t *mutex) 21 + { 22 + return true; 23 + } 24 + 25 + #endif
+32
tools/lib/lockdep/uinclude/linux/stacktrace.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_STACKTRACE_H_ 2 + #define _LIBLOCKDEP_LINUX_STACKTRACE_H_ 3 + 4 + #include <execinfo.h> 5 + 6 + struct stack_trace { 7 + unsigned int nr_entries, max_entries; 8 + unsigned long *entries; 9 + int skip; 10 + }; 11 + 12 + static inline void print_stack_trace(struct stack_trace *trace, int spaces) 13 + { 14 + backtrace_symbols_fd((void **)trace->entries, trace->nr_entries, 1); 15 + } 16 + 17 + #define save_stack_trace(trace) \ 18 + ((trace)->nr_entries = \ 19 + backtrace((void **)(trace)->entries, (trace)->max_entries)) 20 + 21 + static inline int dump_stack(void) 22 + { 23 + void *array[64]; 24 + size_t size; 25 + 26 + size = backtrace(array, 64); 27 + backtrace_symbols_fd(array, size, 1); 28 + 29 + return 0; 30 + } 31 + 32 + #endif
+7
tools/lib/lockdep/uinclude/linux/stringify.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_STRINGIFY_H_ 2 + #define _LIBLOCKDEP_LINUX_STRINGIFY_H_ 3 + 4 + #define __stringify_1(x...) #x 5 + #define __stringify(x...) __stringify_1(x) 6 + 7 + #endif
+58
tools/lib/lockdep/uinclude/linux/types.h
··· 1 + #ifndef _LIBLOCKDEP_LINUX_TYPES_H_ 2 + #define _LIBLOCKDEP_LINUX_TYPES_H_ 3 + 4 + #include <stdbool.h> 5 + #include <stddef.h> 6 + 7 + #define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */ 8 + #include <asm/types.h> 9 + 10 + struct page; 11 + struct kmem_cache; 12 + 13 + typedef unsigned gfp_t; 14 + 15 + typedef __u64 u64; 16 + typedef __s64 s64; 17 + 18 + typedef __u32 u32; 19 + typedef __s32 s32; 20 + 21 + typedef __u16 u16; 22 + typedef __s16 s16; 23 + 24 + typedef __u8 u8; 25 + typedef __s8 s8; 26 + 27 + #ifdef __CHECKER__ 28 + #define __bitwise__ __attribute__((bitwise)) 29 + #else 30 + #define __bitwise__ 31 + #endif 32 + #ifdef __CHECK_ENDIAN__ 33 + #define __bitwise __bitwise__ 34 + #else 35 + #define __bitwise 36 + #endif 37 + 38 + 39 + typedef __u16 __bitwise __le16; 40 + typedef __u16 __bitwise __be16; 41 + typedef __u32 __bitwise __le32; 42 + typedef __u32 __bitwise __be32; 43 + typedef __u64 __bitwise __le64; 44 + typedef __u64 __bitwise __be64; 45 + 46 + struct list_head { 47 + struct list_head *next, *prev; 48 + }; 49 + 50 + struct hlist_head { 51 + struct hlist_node *first; 52 + }; 53 + 54 + struct hlist_node { 55 + struct hlist_node *next, **pprev; 56 + }; 57 + 58 + #endif
+3
tools/lib/lockdep/uinclude/trace/events/lock.h
··· 1 + 2 + /* empty file */ 3 +