Rev 581 | Rev 625 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 581 | Rev 622 | ||
|---|---|---|---|
| Line 61... | Line 61... | ||
| 61 | * @param sl Pointer to spinlock_t structure. |
61 | * @param sl Pointer to spinlock_t structure. |
| 62 | */ |
62 | */ |
| 63 | void spinlock_lock(spinlock_t *sl) |
63 | void spinlock_lock(spinlock_t *sl) |
| 64 | { |
64 | { |
| 65 | count_t i = 0; |
65 | count_t i = 0; |
| 66 | __address caller = CALLER(sl); |
- | |
| 67 | char *symbol; |
66 | char *symbol; |
| 68 | bool deadlock_reported = false; |
67 | bool deadlock_reported = false; |
| 69 | 68 | ||
| 70 | preemption_disable(); |
69 | preemption_disable(); |
| 71 | while (test_and_set(&sl->val)) { |
70 | while (test_and_set(&sl->val)) { |
| 72 | if (i++ > 300000) { |
71 | if (i++ > 300000) { |
| 73 | printf("cpu%d: looping on spinlock %p:%s, caller=%p", |
72 | printf("cpu%d: looping on spinlock %p:%s, caller=%p", |
| 74 | CPU->id, sl, sl->name, caller); |
73 | CPU->id, sl, sl->name, CALLER); |
| 75 | symbol = get_symtab_entry(caller); |
74 | symbol = get_symtab_entry(CALLER); |
| 76 | if (symbol) |
75 | if (symbol) |
| 77 | printf("(%s)", symbol); |
76 | printf("(%s)", symbol); |
| 78 | printf("\n"); |
77 | printf("\n"); |
| 79 | i = 0; |
78 | i = 0; |
| 80 | deadlock_reported = true; |
79 | deadlock_reported = true; |