Rev 2109 | Rev 2909 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2109 | Rev 2183 | ||
---|---|---|---|
Line 84... | Line 84... | ||
84 | void waitq_timeouted_sleep(void *data) |
84 | void waitq_timeouted_sleep(void *data) |
85 | { |
85 | { |
86 | thread_t *t = (thread_t *) data; |
86 | thread_t *t = (thread_t *) data; |
87 | waitq_t *wq; |
87 | waitq_t *wq; |
88 | bool do_wakeup = false; |
88 | bool do_wakeup = false; |
- | 89 | DEADLOCK_PROBE_INIT(p_wqlock); |
|
89 | 90 | ||
90 | spinlock_lock(&threads_lock); |
91 | spinlock_lock(&threads_lock); |
91 | if (!thread_exists(t)) |
92 | if (!thread_exists(t)) |
92 | goto out; |
93 | goto out; |
93 | 94 | ||
94 | grab_locks: |
95 | grab_locks: |
95 | spinlock_lock(&t->lock); |
96 | spinlock_lock(&t->lock); |
96 | if ((wq = t->sleep_queue)) { /* assignment */ |
97 | if ((wq = t->sleep_queue)) { /* assignment */ |
97 | if (!spinlock_trylock(&wq->lock)) { |
98 | if (!spinlock_trylock(&wq->lock)) { |
98 | spinlock_unlock(&t->lock); |
99 | spinlock_unlock(&t->lock); |
- | 100 | DEADLOCK_PROBE(p_wqlock, DEADLOCK_THRESHOLD); |
|
99 | goto grab_locks; /* avoid deadlock */ |
101 | goto grab_locks; /* avoid deadlock */ |
100 | } |
102 | } |
101 | 103 | ||
102 | list_remove(&t->wq_link); |
104 | list_remove(&t->wq_link); |
103 | t->saved_context = t->sleep_timeout_context; |
105 | t->saved_context = t->sleep_timeout_context; |
Line 126... | Line 128... | ||
126 | void waitq_interrupt_sleep(thread_t *t) |
128 | void waitq_interrupt_sleep(thread_t *t) |
127 | { |
129 | { |
128 | waitq_t *wq; |
130 | waitq_t *wq; |
129 | bool do_wakeup = false; |
131 | bool do_wakeup = false; |
130 | ipl_t ipl; |
132 | ipl_t ipl; |
- | 133 | DEADLOCK_PROBE_INIT(p_wqlock); |
|
131 | 134 | ||
132 | ipl = interrupts_disable(); |
135 | ipl = interrupts_disable(); |
133 | spinlock_lock(&threads_lock); |
136 | spinlock_lock(&threads_lock); |
134 | if (!thread_exists(t)) |
137 | if (!thread_exists(t)) |
135 | goto out; |
138 | goto out; |
Line 145... | Line 148... | ||
145 | goto out; |
148 | goto out; |
146 | } |
149 | } |
147 | 150 | ||
148 | if (!spinlock_trylock(&wq->lock)) { |
151 | if (!spinlock_trylock(&wq->lock)) { |
149 | spinlock_unlock(&t->lock); |
152 | spinlock_unlock(&t->lock); |
- | 153 | DEADLOCK_PROBE(p_wqlock, DEADLOCK_THRESHOLD); |
|
150 | goto grab_locks; /* avoid deadlock */ |
154 | goto grab_locks; /* avoid deadlock */ |
151 | } |
155 | } |
152 | 156 | ||
153 | if (t->timeout_pending && timeout_unregister(&t->sleep_timeout)) |
157 | if (t->timeout_pending && timeout_unregister(&t->sleep_timeout)) |
154 | t->timeout_pending = false; |
158 | t->timeout_pending = false; |