Rev 3424 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3424 | Rev 4377 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | * @{ |
30 | * @{ |
31 | */ |
31 | */ |
32 | 32 | ||
33 | /** |
33 | /** |
34 | * @file |
34 | * @file |
35 | * @brief Spinlocks. |
35 | * @brief Spinlocks. |
36 | */ |
36 | */ |
37 | 37 | ||
38 | #include <synch/spinlock.h> |
38 | #include <synch/spinlock.h> |
39 | #include <atomic.h> |
39 | #include <atomic.h> |
40 | #include <arch/barrier.h> |
40 | #include <arch/barrier.h> |
41 | #include <arch.h> |
41 | #include <arch.h> |
42 | #include <preemption.h> |
42 | #include <preemption.h> |
Line 74... | Line 74... | ||
74 | */ |
74 | */ |
75 | #ifdef CONFIG_DEBUG_SPINLOCK |
75 | #ifdef CONFIG_DEBUG_SPINLOCK |
76 | void spinlock_lock_debug(spinlock_t *sl) |
76 | void spinlock_lock_debug(spinlock_t *sl) |
77 | { |
77 | { |
78 | count_t i = 0; |
78 | count_t i = 0; |
79 | char *symbol; |
- | |
80 | bool deadlock_reported = false; |
79 | bool deadlock_reported = false; |
81 | 80 | ||
82 | preemption_disable(); |
81 | preemption_disable(); |
83 | while (test_and_set(&sl->val)) { |
82 | while (test_and_set(&sl->val)) { |
84 | 83 | ||
Line 104... | Line 103... | ||
104 | #ifdef CONFIG_FB |
103 | #ifdef CONFIG_FB |
105 | if (sl == &fb_lock) |
104 | if (sl == &fb_lock) |
106 | continue; |
105 | continue; |
107 | #endif |
106 | #endif |
108 | if (i++ > DEADLOCK_THRESHOLD) { |
107 | if (i++ > DEADLOCK_THRESHOLD) { |
109 | printf("cpu%u: looping on spinlock %" PRIp ":%s, caller=%" PRIp, |
108 | printf("cpu%u: looping on spinlock %" PRIp ":%s, " |
110 | CPU->id, sl, sl->name, CALLER); |
109 | "caller=%" PRIp "(%s)\n", CPU->id, sl, sl->name, |
111 | symbol = get_symtab_entry(CALLER); |
110 | CALLER, symtab_fmt_name_lookup(CALLER)); |
112 | if (symbol) |
111 | |
113 | printf("(%s)", symbol); |
- | |
114 | printf("\n"); |
- | |
115 | i = 0; |
112 | i = 0; |
116 | deadlock_reported = true; |
113 | deadlock_reported = true; |
117 | } |
114 | } |
118 | } |
115 | } |
119 | 116 |