diff options
| author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2017-12-20 13:16:23 +1100 |
|---|---|---|
| committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-12-20 22:15:36 -0600 |
| commit | 76d9bcdca58936d761458f8f05960239c4dd8dec (patch) | |
| tree | c8377b11be33e62d312810645b8044d3a6f427aa /core/test | |
| parent | ca612b802adac0c72cd0f10c51a51275e5914101 (diff) | |
| download | talos-skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.tar.gz talos-skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.zip | |
lock: Add additional lock auditing code
Keep track of lock owner name and replace lock_depth counter
with a per-cpu list of locks held by the cpu.
This allows us to print the actual locks held in case we hit
the (in)famous message about opal_pollers being run with a
lock held.
It also allows us to warn (and drop them) if locks are still
held when returning to the OS or completing a scheduled job.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
[stewart: fix unit tests]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/test')
| -rw-r--r-- | core/test/run-malloc-speed.c | 3 | ||||
| -rw-r--r-- | core/test/run-malloc.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_range_is_reserved.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region_init.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region_next.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region_release_unused.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region_release_unused_noalloc.c | 3 | ||||
| -rw-r--r-- | core/test/run-mem_region_reservations.c | 3 | ||||
| -rw-r--r-- | core/test/run-msg.c | 3 | ||||
| -rw-r--r-- | core/test/run-timer.c | 6 | ||||
| -rw-r--r-- | core/test/run-trace.c | 3 |
12 files changed, 27 insertions, 12 deletions
diff --git a/core/test/run-malloc-speed.c b/core/test/run-malloc-speed.c index 279216e6..d842bd64 100644 --- a/core/test/run-malloc-speed.c +++ b/core/test/run-malloc-speed.c @@ -55,8 +55,9 @@ static inline void real_free(void *p) char __rodata_start[1], __rodata_end[1]; struct dt_node *dt_root; -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val = 1; } diff --git a/core/test/run-malloc.c b/core/test/run-malloc.c index d79e6f94..2feaacb9 100644 --- a/core/test/run-malloc.c +++ b/core/test/run-malloc.c @@ -57,8 +57,9 @@ static inline void real_free(void *p) struct dt_node *dt_root; -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val = 1; } diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c index 95c790dc..37f7db3f 100644 --- a/core/test/run-mem_range_is_reserved.c +++ b/core/test/run-mem_range_is_reserved.c @@ -57,8 +57,9 @@ static void real_free(void *p) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val++; } diff --git a/core/test/run-mem_region.c b/core/test/run-mem_region.c index 6b7f6fb7..f2506d65 100644 --- a/core/test/run-mem_region.c +++ b/core/test/run-mem_region.c @@ -55,8 +55,9 @@ static inline void real_free(void *p) struct dt_node *dt_root; -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val++; } diff --git a/core/test/run-mem_region_init.c b/core/test/run-mem_region_init.c index ee7e189c..d4265af7 100644 --- a/core/test/run-mem_region_init.c +++ b/core/test/run-mem_region_init.c @@ -63,8 +63,9 @@ static inline char *skiboot_strdup(const char *str) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val = 1; } diff --git a/core/test/run-mem_region_next.c b/core/test/run-mem_region_next.c index 7daa269d..72d02a98 100644 --- a/core/test/run-mem_region_next.c +++ b/core/test/run-mem_region_next.c @@ -52,8 +52,9 @@ static void real_free(void *p) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val++; } diff --git a/core/test/run-mem_region_release_unused.c b/core/test/run-mem_region_release_unused.c index 712f98ab..4941453e 100644 --- a/core/test/run-mem_region_release_unused.c +++ b/core/test/run-mem_region_release_unused.c @@ -60,8 +60,9 @@ static inline void __free(void *p, const char *location __attribute__((unused))) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; l->lock_val++; } diff --git a/core/test/run-mem_region_release_unused_noalloc.c b/core/test/run-mem_region_release_unused_noalloc.c index a79485b1..1ad4abb0 100644 --- a/core/test/run-mem_region_release_unused_noalloc.c +++ b/core/test/run-mem_region_release_unused_noalloc.c @@ -60,8 +60,9 @@ static inline void __free(void *p, const char *location __attribute__((unused))) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; l->lock_val++; } diff --git a/core/test/run-mem_region_reservations.c b/core/test/run-mem_region_reservations.c index 584b7c34..f593d9ad 100644 --- a/core/test/run-mem_region_reservations.c +++ b/core/test/run-mem_region_reservations.c @@ -57,8 +57,9 @@ static void real_free(void *p) #include <assert.h> #include <stdio.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val++; } diff --git a/core/test/run-msg.c b/core/test/run-msg.c index 2cee5155..67418a91 100644 --- a/core/test/run-msg.c +++ b/core/test/run-msg.c @@ -41,8 +41,9 @@ static void *zalloc(size_t size) #include "../opal-msg.c" #include <skiboot.h> -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val = 1; } diff --git a/core/test/run-timer.c b/core/test/run-timer.c index 0270cfee..e45cf639 100644 --- a/core/test/run-timer.c +++ b/core/test/run-timer.c @@ -12,7 +12,11 @@ static uint64_t stamp, last; struct lock; -static inline void lock(struct lock *l) { (void)l; } +static inline void lock_caller(struct lock *l, const char *caller) +{ + (void)caller; + (void)l; +} static inline void unlock(struct lock *l) { (void)l; } unsigned long tb_hz = 512000000; diff --git a/core/test/run-trace.c b/core/test/run-trace.c index c319c05a..dd4cd450 100644 --- a/core/test/run-trace.c +++ b/core/test/run-trace.c @@ -113,8 +113,9 @@ struct debug_descriptor debug_descriptor = { .trace_mask = -1 }; -void lock(struct lock *l) +void lock_caller(struct lock *l, const char *caller) { + (void)caller; assert(!l->lock_val); l->lock_val = 1; } |

