Skip to content

Commit

Permalink
tools/lib/lockdep: Remove private kernel headers
Browse files Browse the repository at this point in the history
Move to using tools/include/ instead.

Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@redhat.com
Link: http://lkml.kernel.org/r/20170531003747.10557-2-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Levin, Alexander (Sasha Levin) authored and Ingo Molnar committed Jun 5, 2017
1 parent 4ea4b3c commit e58e871
Show file tree
Hide file tree
Showing 49 changed files with 103 additions and 158 deletions.
4 changes: 4 additions & 0 deletions tools/include/asm/sections.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef __TOOLS_INCLUDE_LINUX_ASM_SECTIONS_H
#define __TOOLS_INCLUDE_LINUX_ASM_SECTIONS_H

#endif /* __TOOLS_INCLUDE_LINUX_ASM_SECTIONS_H */
12 changes: 12 additions & 0 deletions tools/include/linux/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
# define __maybe_unused __attribute__((unused))
#endif

#ifndef __used
# define __used __attribute__((__unused__))
#endif

#ifndef __packed
# define __packed __attribute__((__packed__))
#endif
Expand All @@ -65,6 +69,14 @@
# define unlikely(x) __builtin_expect(!!(x), 0)
#endif

#ifndef __init
# define __init
#endif

#ifndef noinline
# define noinline
#endif

#define uninitialized_var(x) x = *(&(x))

#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <stddef.h>
#include <linux/compiler.h>
#include <asm/bug.h>

#define DEBUG_LOCKS_WARN_ON(x) WARN_ON(x)

Expand Down
4 changes: 4 additions & 0 deletions tools/include/linux/delay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_DELAY_H
#define _TOOLS_INCLUDE_LINUX_DELAY_H

#endif /* _TOOLS_INCLUDE_LINUX_DELAY_H */
4 changes: 4 additions & 0 deletions tools/include/linux/ftrace.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_FTRACE_H
#define _TOOLS_INCLUDE_LINUX_FTRACE_H

#endif /* _TOOLS_INCLUDE_LINUX_FTRACE_H */
4 changes: 4 additions & 0 deletions tools/include/linux/gfp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_GFP_H
#define _TOOLS_INCLUDE_LINUX_GFP_H

#endif /* _TOOLS_INCLUDE_LINUX_GFP_H */
File renamed without changes.
4 changes: 4 additions & 0 deletions tools/include/linux/interrupt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_INTERRUPT_H
#define _TOOLS_INCLUDE_LINUX_INTERRUPT_H

#endif /* _TOOLS_INCLUDE_LINUX_INTERRUPT_H */
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tools/include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
(type *)((char *)__mptr - offsetof(type, member)); })
#endif

#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))

#ifndef max
Expand Down Expand Up @@ -89,4 +90,7 @@ int scnprintf(char * buf, size_t size, const char * fmt, ...);
#define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1)
#define round_down(x, y) ((x) & ~__round_mask(x, y))

#define current_gfp_context(k) 0
#define synchronize_sched()

#endif
File renamed without changes.
4 changes: 4 additions & 0 deletions tools/include/linux/linkage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_LINKAGE_H
#define _TOOLS_INCLUDE_LINUX_LINKAGE_H

#endif /* _TOOLS_INCLUDE_LINUX_LINKAGE_H */
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
#include <limits.h>
#include <linux/utsname.h>
#include <linux/compiler.h>
#include <linux/export.h>
#include <linux/kern_levels.h>
#include <linux/err.h>
#include <linux/rcu.h>
#include <linux/list.h>
#include <linux/hardirq.h>
#include <unistd.h>

#define MAX_LOCK_DEPTH 63UL
Expand Down Expand Up @@ -39,6 +45,8 @@ static inline int debug_locks_off(void)

#define KSYM_NAME_LEN 128
#define printk(...) dprintf(STDOUT_FILENO, __VA_ARGS__)
#define pr_err(format, ...) fprintf (stderr, format, ## __VA_ARGS__)
#define pr_warn pr_err

#define list_del_rcu list_del

Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions tools/include/linux/mutex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_MUTEX_H
#define _TOOLS_INCLUDE_LINUX_MUTEX_H

#endif /* _TOOLS_INCLUDE_LINUX_MUTEX_H */
4 changes: 4 additions & 0 deletions tools/include/linux/proc_fs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_PROC_FS_H
#define _TOOLS_INCLUDE_LINUX_PROC_FS_H

#endif /* _TOOLS_INCLUDE_LINUX_PROC_FS_H */
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ static inline bool rcu_is_watching(void)
}

#define rcu_assign_pointer(p, v) ((p) = (v))
#define RCU_INIT_POINTER(p, v) p=(v)

#endif
4 changes: 4 additions & 0 deletions tools/include/linux/sched/clock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_PERF_LINUX_SCHED_CLOCK_H
#define _TOOLS_PERF_LINUX_SCHED_CLOCK_H

#endif /* _TOOLS_PERF_LINUX_SCHED_CLOCK_H */
4 changes: 4 additions & 0 deletions tools/include/linux/sched/task.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_PERF_LINUX_SCHED_TASK_H
#define _TOOLS_PERF_LINUX_SCHED_TASK_H

#endif /* _TOOLS_PERF_LINUX_SCHED_TASK_H */
4 changes: 4 additions & 0 deletions tools/include/linux/seq_file.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_LINUX_SEQ_FILE_H
#define _TOOLS_INCLUDE_LINUX_SEQ_FILE_H

#endif /* _TOOLS_INCLUDE_LINUX_SEQ_FILE_H */
26 changes: 26 additions & 0 deletions tools/include/linux/spinlock.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
#ifndef __LINUX_SPINLOCK_H_
#define __LINUX_SPINLOCK_H_

#include <pthread.h>
#include <stdbool.h>

#define spinlock_t pthread_mutex_t
#define DEFINE_SPINLOCK(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;

#define spin_lock_irqsave(x, f) (void)f, pthread_mutex_lock(x)
#define spin_unlock_irqrestore(x, f) (void)f, pthread_mutex_unlock(x)

#define arch_spinlock_t pthread_mutex_t
#define __ARCH_SPIN_LOCK_UNLOCKED PTHREAD_MUTEX_INITIALIZER

static inline void arch_spin_lock(arch_spinlock_t *mutex)
{
pthread_mutex_lock(mutex);
}

static inline void arch_spin_unlock(arch_spinlock_t *mutex)
{
pthread_mutex_unlock(mutex);
}

static inline bool arch_spin_is_locked(arch_spinlock_t *mutex)
{
return true;
}

#endif
File renamed without changes.
4 changes: 4 additions & 0 deletions tools/include/trace/events/lock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#ifndef _TOOLS_INCLUDE_TRACE_EVENTS_LOCK_H
#define _TOOLS_INCLUDE_TRACE_EVENTS_LOCK_H

#endif /* _TOOLS_INCLUDE_TRACE_EVENTS_LOCK_H */
2 changes: 2 additions & 0 deletions tools/lib/lockdep/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#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 list_for_each_entry_rcu list_for_each_entry
#define list_add_tail_rcu list_add_tail

u32 prandom_u32(void)
{
Expand Down
2 changes: 0 additions & 2 deletions tools/lib/lockdep/preload.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ static struct rb_node **__get_lock_node(void *lock, struct rb_node **parent)
#define LIBLOCKDEP_STATIC_ENTRIES 1024
#endif

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

static struct lock_lookup __locks[LIBLOCKDEP_STATIC_ENTRIES];
static int __locks_nr;

Expand Down
2 changes: 1 addition & 1 deletion tools/lib/lockdep/rbtree.c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#include "../../../lib/rbtree.c"
#include "../../lib/rbtree.c"
6 changes: 0 additions & 6 deletions tools/lib/lockdep/uinclude/asm/hash.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/asm/hweight.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/asm/sections.h

This file was deleted.

12 changes: 0 additions & 12 deletions tools/lib/lockdep/uinclude/linux/compiler.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/delay.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/ftrace.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/gfp.h

This file was deleted.

1 change: 0 additions & 1 deletion tools/lib/lockdep/uinclude/linux/hash.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/interrupt.h

This file was deleted.

61 changes: 0 additions & 61 deletions tools/lib/lockdep/uinclude/linux/kernel.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/linkage.h

This file was deleted.

1 change: 0 additions & 1 deletion tools/lib/lockdep/uinclude/linux/list.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/mutex.h

This file was deleted.

1 change: 0 additions & 1 deletion tools/lib/lockdep/uinclude/linux/poison.h

This file was deleted.

6 changes: 0 additions & 6 deletions tools/lib/lockdep/uinclude/linux/prefetch.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/proc_fs.h

This file was deleted.

2 changes: 0 additions & 2 deletions tools/lib/lockdep/uinclude/linux/rbtree_augmented.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/linux/seq_file.h

This file was deleted.

25 changes: 0 additions & 25 deletions tools/lib/lockdep/uinclude/linux/spinlock.h

This file was deleted.

7 changes: 0 additions & 7 deletions tools/lib/lockdep/uinclude/linux/stringify.h

This file was deleted.

3 changes: 0 additions & 3 deletions tools/lib/lockdep/uinclude/trace/events/lock.h

This file was deleted.

0 comments on commit e58e871

Please sign in to comment.