PERFORCE change 94252 for review
Marcel Moolenaar
marcel at FreeBSD.org
Wed Mar 29 18:28:05 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=94252
Change 94252 by marcel at marcel_nfs on 2006/03/29 18:27:21
Remove sc_schedih. It was used to limit calling
swi_sched(), but introduced a race. Instead call
swi_sched() on the 0 to !0 transition of the TTY
pending interrupt status. Do this atomically.
Affected files ...
.. //depot/projects/uart/dev/uart/uart_bus.h#42 edit
.. //depot/projects/uart/dev/uart/uart_core.c#49 edit
.. //depot/projects/uart/dev/uart/uart_kbd_sun.c#8 edit
.. //depot/projects/uart/dev/uart/uart_tty.c#26 edit
Differences ...
==== //depot/projects/uart/dev/uart/uart_bus.h#42 (text+ko) ====
@@ -100,7 +100,6 @@
int sc_opened:1; /* This UART is open for business. */
int sc_polled:1; /* This UART has no interrupts. */
int sc_txbusy:1; /* This UART is transmitting. */
- int sc_schedih:1; /* The softih needs (re)scheduling. */
struct uart_devinfo *sc_sysdev; /* System device (or NULL). */
==== //depot/projects/uart/dev/uart/uart_core.c#49 (text+ko) ====
@@ -71,17 +71,21 @@
}
/*
- * Schedule a soft interrupt.
+ * Schedule a soft interrupt. We do this on the 0 to !0 transition
+ * of the TTY pending interrupt status.
*/
-static __inline void
+static void
uart_sched_softih(struct uart_softc *sc, uint32_t ipend)
{
+ uint32_t new, old;
+
+ do {
+ old = sc->sc_ttypend;
+ new = old | ipend;
+ } while (!atomic_cmpset_32(&sc->sc_ttypend, old, new));
- atomic_set_32(&sc->sc_ttypend, ipend);
- if (sc->sc_schedih) {
+ if (old == 0)
swi_sched(sc->sc_softih, 0);
- sc->sc_schedih = 0;
- }
}
/*
==== //depot/projects/uart/dev/uart/uart_kbd_sun.c#8 (text+ko) ====
@@ -258,7 +258,6 @@
&sunkbd_softc, SWI_TTY, INTR_TYPE_TTY, &sc->sc_softih);
sc->sc_opened = 1;
- sc->sc_schedih = 1;
KBD_INIT_DONE(&sunkbd_softc.sc_kbd);
}
@@ -274,7 +273,6 @@
if (sc->sc_uart->sc_leaving)
return;
- sc->sc_uart->sc_schedih = 1;
pend = atomic_readandclear_32(&sc->sc_uart->sc_ttypend);
if (!(pend & SER_INT_MASK))
return;
==== //depot/projects/uart/dev/uart/uart_tty.c#26 (text+ko) ====
@@ -306,7 +306,6 @@
if (sc->sc_leaving)
return;
- sc->sc_schedih = 1;
pend = atomic_readandclear_32(&sc->sc_ttypend);
if (!(pend & SER_INT_MASK))
return;
@@ -380,7 +379,6 @@
swi_add(&tty_intr_event, uart_driver_name, uart_tty_intr, sc, SWI_TTY,
INTR_TYPE_TTY, &sc->sc_softih);
- sc->sc_schedih = 1;
ttycreate(tp, TS_CALLOUT, "u%r", unit);
More information about the p4-projects
mailing list