NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/54531: com(4) PPS API support doesn't work correctly

>Number:         54531
>Category:       kern
>Synopsis:       com(4) PPS API support doesn't work correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 07 18:55:00 +0000 2019
>Originator:     Steve Woodford
>Release:        8.1
NetBSD/i386 8.1_STABLE
Revision 1.301 of sys/dev/ic/com.c introduced a bug where the modem status interrupt is not enabled on first open if the associated tty(4) has CLOCAL unset.

Since the tty's t_cflag field persists across open/close, if CLOCAL was cleared by an earlier user of the tty(4) device, then a subsequent user will not see synchronous changes to the modem status signals. They will only be noticed when comintr() services a Tx/Rx interrupt. Even in that case, the handler will likely read stale signal status from COM_MSR.

The result is that consumers of the PPS API (<sys/timepps.h>) can fail to work as expected.
Configure an NTP reference clock (such as GPS NMEA) with PPS enabled.
Observe that PPS works when ntpd(8) is the first user of the relevant tty(4) device.
Restart ntpd(8) and observe that PPS is no longer functional.
Index: com.c
RCS file: /cvsroot/src/sys/dev/ic/com.c,v
retrieving revision 1.355
diff -u -r1.355 com.c
--- com.c	11 Jan 2019 23:10:40 -0000	1.355
+++ com.c	7 Sep 2019 18:47:53 -0000
@@ -964,9 +964,7 @@

 		/* Turn on interrupts. */
-		sc->sc_ier = IER_ERXRDY | IER_ERLS;
-		if (!ISSET(tp->t_cflag, CLOCAL))
-			sc->sc_ier |= IER_EMSC;
+		sc->sc_ier = IER_ERXRDY | IER_ERLS | IER_EMSC;

 		if (sc->sc_type == COM_TYPE_PXA2x0)
 			sc->sc_ier |= IER_EUART | IER_ERXTOUT;

Home | Main Index | Thread Index | Old Index