| 1172 | } |
| 1173 | |
| 1174 | static void |
| 1175 | ithread_execute_handlers(struct proc *p, struct intr_event *ie) |
| 1176 | { |
| 1177 | |
| 1178 | /* Interrupt handlers should not sleep. */ |
| 1179 | if (!(ie->ie_flags & IE_SOFT)) |
| 1180 | THREAD_NO_SLEEPING(); |
| 1181 | intr_event_execute_handlers(p, ie); |
| 1182 | if (!(ie->ie_flags & IE_SOFT)) |
| 1183 | THREAD_SLEEPING_OK(); |
| 1184 | |
| 1185 | /* |
| 1186 | * Interrupt storm handling: |
| 1187 | * |
| 1188 | * If this interrupt source is currently storming, then throttle |
| 1189 | * it to only fire the handler once per clock tick. |
| 1190 | * |
| 1191 | * If this interrupt source is not currently storming, but the |
| 1192 | * number of back to back interrupts exceeds the storm threshold, |
| 1193 | * then enter storming mode. |
| 1194 | */ |
| 1195 | if (intr_storm_threshold != 0 && ie->ie_count >= intr_storm_threshold && |
| 1196 | !(ie->ie_flags & IE_SOFT)) { |
| 1197 | /* Report the message only once every second. */ |
| 1198 | if (ppsratecheck(&ie->ie_warntm, &ie->ie_warncnt, 1)) { |
| 1199 | printf( |
| 1200 | "interrupt storm detected on \"%s\"; throttling interrupt source\n", |
| 1201 | ie->ie_name); |
| 1202 | } |
| 1203 | pause("istorm", 1); |
| 1204 | } else |
| 1205 | ie->ie_count++; |
| 1206 | |
| 1207 | /* |
| 1208 | * Now that all the handlers have had a chance to run, reenable |
| 1209 | * the interrupt source. |
| 1210 | */ |
| 1211 | if (ie->ie_post_ithread != NULL) |
| 1212 | ie->ie_post_ithread(ie->ie_source); |
| 1213 | } |
| 1214 | |
| 1215 | /* |
| 1216 | * This is the main code for interrupt threads. |
no test coverage detected