kern_intr.c (bb141be10a022f0467bc37c038f3fcccac244909) kern_intr.c (0f180a7cce5bed801060557dd5bdbad64318d3c6)
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 359 unchanged lines hidden (view full) ---

368 TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next);
369 else
370 TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next);
371 intr_event_update(ie);
372
373 /* Create a thread if we need one. */
374 while (ie->ie_thread == NULL && !(flags & INTR_FAST)) {
375 if (ie->ie_flags & IE_ADDING_THREAD)
1/*-
2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 359 unchanged lines hidden (view full) ---

368 TAILQ_INSERT_TAIL(&ie->ie_handlers, ih, ih_next);
369 else
370 TAILQ_INSERT_BEFORE(temp_ih, ih, ih_next);
371 intr_event_update(ie);
372
373 /* Create a thread if we need one. */
374 while (ie->ie_thread == NULL && !(flags & INTR_FAST)) {
375 if (ie->ie_flags & IE_ADDING_THREAD)
376 msleep(ie, &ie->ie_lock, curthread->td_priority,
377 "ithread", 0);
376 msleep(ie, &ie->ie_lock, 0, "ithread", 0);
378 else {
379 ie->ie_flags |= IE_ADDING_THREAD;
380 mtx_unlock(&ie->ie_lock);
381 it = ithread_create("intr: newborn");
382 mtx_lock(&ie->ie_lock);
383 ie->ie_flags &= ~IE_ADDING_THREAD;
384 ie->ie_thread = it;
385 it->it_event = ie;

--- 69 unchanged lines hidden (view full) ---

455 * again and remove this handler if it has already passed
456 * it on the list.
457 */
458 ie->ie_thread->it_need = 1;
459 } else
460 TAILQ_REMOVE(&ie->ie_handlers, handler, ih_next);
461 mtx_unlock_spin(&sched_lock);
462 while (handler->ih_flags & IH_DEAD)
377 else {
378 ie->ie_flags |= IE_ADDING_THREAD;
379 mtx_unlock(&ie->ie_lock);
380 it = ithread_create("intr: newborn");
381 mtx_lock(&ie->ie_lock);
382 ie->ie_flags &= ~IE_ADDING_THREAD;
383 ie->ie_thread = it;
384 it->it_event = ie;

--- 69 unchanged lines hidden (view full) ---

454 * again and remove this handler if it has already passed
455 * it on the list.
456 */
457 ie->ie_thread->it_need = 1;
458 } else
459 TAILQ_REMOVE(&ie->ie_handlers, handler, ih_next);
460 mtx_unlock_spin(&sched_lock);
461 while (handler->ih_flags & IH_DEAD)
463 msleep(handler, &ie->ie_lock, curthread->td_priority, "iev_rmh",
464 0);
462 msleep(handler, &ie->ie_lock, 0, "iev_rmh", 0);
465 intr_event_update(ie);
466#ifdef notyet
467 /*
468 * XXX: This could be bad in the case of ppbus(8). Also, I think
469 * this could lead to races of stale data when servicing an
470 * interrupt.
471 */
472 dead = 1;

--- 207 unchanged lines hidden (view full) ---

680 */
681 if (intr_storm_threshold != 0 && ie->ie_count >= intr_storm_threshold) {
682 if (ie->ie_warned == 0) {
683 printf(
684 "Interrupt storm detected on \"%s\"; throttling interrupt source\n",
685 ie->ie_name);
686 ie->ie_warned = 1;
687 }
463 intr_event_update(ie);
464#ifdef notyet
465 /*
466 * XXX: This could be bad in the case of ppbus(8). Also, I think
467 * this could lead to races of stale data when servicing an
468 * interrupt.
469 */
470 dead = 1;

--- 207 unchanged lines hidden (view full) ---

678 */
679 if (intr_storm_threshold != 0 && ie->ie_count >= intr_storm_threshold) {
680 if (ie->ie_warned == 0) {
681 printf(
682 "Interrupt storm detected on \"%s\"; throttling interrupt source\n",
683 ie->ie_name);
684 ie->ie_warned = 1;
685 }
688 tsleep(&ie->ie_count, curthread->td_priority, "istorm", 1);
686 tsleep(&ie->ie_count, 0, "istorm", 1);
689 } else
690 ie->ie_count++;
691
692 /*
693 * Now that all the handlers have had a chance to run, reenable
694 * the interrupt source.
695 */
696 if (ie->ie_enable != NULL)

--- 297 unchanged lines hidden ---
687 } else
688 ie->ie_count++;
689
690 /*
691 * Now that all the handlers have had a chance to run, reenable
692 * the interrupt source.
693 */
694 if (ie->ie_enable != NULL)

--- 297 unchanged lines hidden ---