NetBSD Problem Report #54531

From  Sat Sep  7 18:50:16 2019
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 94A5A7A18D
	for <>; Sat,  7 Sep 2019 18:50:16 +0000 (UTC)
Message-Id: <>
Date: Sat,  7 Sep 2019 18:50:15 +0000 (UTC)
Subject: com(4) PPS API support doesn't work correctly
X-Send-Pr-Version: www-1.0

>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;

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.