Rev 2093 | Rev 2462 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2093 | Rev 2183 | ||
---|---|---|---|
Line 99... | Line 99... | ||
99 | 99 | ||
100 | atomic_set(&sl->val, 0); |
100 | atomic_set(&sl->val, 0); |
101 | preemption_enable(); |
101 | preemption_enable(); |
102 | } |
102 | } |
103 | 103 | ||
- | 104 | #ifdef CONFIG_DEBUG_SPINLOCK |
|
- | 105 | ||
- | 106 | extern int printf(const char *, ...); |
|
- | 107 | ||
- | 108 | #define DEADLOCK_THRESHOLD 100000000 |
|
- | 109 | #define DEADLOCK_PROBE_INIT(pname) count_t pname = 0 |
|
- | 110 | #define DEADLOCK_PROBE(pname, value) \ |
|
- | 111 | if ((pname)++ > (value)) { \ |
|
- | 112 | (pname) = 0; \ |
|
- | 113 | printf("Deadlock probe %s: exceeded threshold %d\n", \ |
|
- | 114 | "cpu%d: function=%s, line=%d\n", \ |
|
- | 115 | #pname, (value), CPU->id, __FUNCTION__, __LINE__); \ |
|
- | 116 | } |
|
- | 117 | #else |
|
- | 118 | #define DEADLOCK_PROBE_INIT(pname) |
|
- | 119 | #define DEADLOCK_PROBE(pname, value) |
|
- | 120 | #endif |
|
- | 121 | ||
104 | #else |
122 | #else |
105 | 123 | ||
106 | /* On UP systems, spinlocks are effectively left out. */ |
124 | /* On UP systems, spinlocks are effectively left out. */ |
107 | #define SPINLOCK_DECLARE(name) |
125 | #define SPINLOCK_DECLARE(name) |
108 | #define SPINLOCK_EXTERN(name) |
126 | #define SPINLOCK_EXTERN(name) |
Line 111... | Line 129... | ||
111 | #define spinlock_initialize(x, name) |
129 | #define spinlock_initialize(x, name) |
112 | #define spinlock_lock(x) preemption_disable() |
130 | #define spinlock_lock(x) preemption_disable() |
113 | #define spinlock_trylock(x) (preemption_disable(), 1) |
131 | #define spinlock_trylock(x) (preemption_disable(), 1) |
114 | #define spinlock_unlock(x) preemption_enable() |
132 | #define spinlock_unlock(x) preemption_enable() |
115 | 133 | ||
- | 134 | #define DEADLOCK_PROBE_INIT(pname) |
|
- | 135 | #define DEADLOCK_PROBE(pname, value) |
|
- | 136 | ||
116 | #endif |
137 | #endif |
117 | 138 | ||
118 | #endif |
139 | #endif |
119 | 140 | ||
120 | /** @} |
141 | /** @} |