aboutsummaryrefslogtreecommitdiff
path: root/core/test
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-12-20 13:16:23 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-12-20 22:15:36 -0600
commit76d9bcdca58936d761458f8f05960239c4dd8dec (patch)
treec8377b11be33e62d312810645b8044d3a6f427aa /core/test
parentca612b802adac0c72cd0f10c51a51275e5914101 (diff)
downloadskiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.zip
skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.tar.gz
skiboot-76d9bcdca58936d761458f8f05960239c4dd8dec.tar.bz2
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.c3
-rw-r--r--core/test/run-malloc.c3
-rw-r--r--core/test/run-mem_range_is_reserved.c3
-rw-r--r--core/test/run-mem_region.c3
-rw-r--r--core/test/run-mem_region_init.c3
-rw-r--r--core/test/run-mem_region_next.c3
-rw-r--r--core/test/run-mem_region_release_unused.c3
-rw-r--r--core/test/run-mem_region_release_unused_noalloc.c3
-rw-r--r--core/test/run-mem_region_reservations.c3
-rw-r--r--core/test/run-msg.c3
-rw-r--r--core/test/run-timer.c6
-rw-r--r--core/test/run-trace.c3
12 files changed, 27 insertions, 12 deletions
diff --git a/core/test/run-malloc-speed.c b/core/test/run-malloc-speed.c
index 279216e..d842bd6 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 d79e6f9..2feaacb 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 95c790d..37f7db3 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 6b7f6fb..f2506d6 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 ee7e189..d4265af 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 7daa269..72d02a9 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 712f98a..4941453 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 a79485b..1ad4abb 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 584b7c3..f593d9a 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 2cee515..67418a9 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 0270cfe..e45cf63 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 c319c05..dd4cd45 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;
}