Changeset 2845930 in mainline for kernel/generic/src/ipc/irq.c
- Timestamp:
- 2009-04-06T22:05:15Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- 6071a8f
- Parents:
- 3636964
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/irq.c
r3636964 r2845930 143 143 irq_code_t *code; 144 144 irq_t *irq; 145 link_t *hlp; 145 146 unative_t key[] = { 146 147 (unative_t) inr, … … 177 178 ipl = interrupts_disable(); 178 179 spinlock_lock(&irq_uspace_hash_table_lock); 179 spinlock_lock(&irq->lock); 180 spinlock_lock(&box->irq_lock); 181 if (hash_table_find(&irq_uspace_hash_table, key)) { 180 hlp = hash_table_find(&irq_uspace_hash_table, key); 181 if (hlp) { 182 irq_t *hirq = hash_table_get_instance(hlp, irq_t, link); 183 /* hirq is locked */ 184 spinlock_unlock(&hirq->lock); 182 185 code_free(code); 183 spinlock_unlock(&box->irq_lock);184 spinlock_unlock(&irq->lock);185 186 spinlock_unlock(&irq_uspace_hash_table_lock); 186 187 free(irq); … … 188 189 return EEXISTS; 189 190 } 191 spinlock_lock(&irq->lock); /* not really necessary, but paranoid */ 192 spinlock_lock(&box->irq_lock); 190 193 hash_table_insert(&irq_uspace_hash_table, key, &irq->link); 191 194 list_append(&irq->notif_cfg.link, &box->irq_head); … … 223 226 } 224 227 irq = hash_table_get_instance(lnk, irq_t, link); 225 spinlock_lock(&irq->lock);228 /* irq is locked */ 226 229 spinlock_lock(&box->irq_lock); 227 230 … … 234 237 list_remove(&irq->notif_cfg.link); 235 238 239 /* 240 * We need to drop the IRQ lock now because hash_table_remove() will try 241 * to reacquire it. That basically violates the natural locking order, 242 * but a deadlock in hash_table_remove() is prevented by the fact that 243 * we already held the IRQ lock and didn't drop the hash table lock in 244 * the meantime. 245 */ 246 spinlock_unlock(&irq->lock); 247 236 248 /* Remove the IRQ from the uspace IRQ hash table. */ 237 249 hash_table_remove(&irq_uspace_hash_table, key, 2); 238 250 239 251 spinlock_unlock(&irq_uspace_hash_table_lock); 240 spinlock_unlock(&irq->lock);241 252 spinlock_unlock(&box->irq_lock); 242 253 … … 295 306 code_free(irq->notif_cfg.code); 296 307 308 /* 309 * We need to drop the IRQ lock now because hash_table_remove() 310 * will try to reacquire it. That basically violates the natural 311 * locking order, but a deadlock in hash_table_remove() is 312 * prevented by the fact that we already held the IRQ lock and 313 * didn't drop the hash table lock in the meantime. 314 */ 297 315 spinlock_unlock(&irq->lock); 298 316
Note:
See TracChangeset
for help on using the changeset viewer.