NetBSD Problem Report #54531

From www@netbsd.org  Sat Sep  7 18:50:16 2019
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 94A5A7A18D
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  7 Sep 2019 18:50:16 +0000 (UTC)
Message-Id: <20190907185015.60DE87A1DB@mollari.NetBSD.org>
Date: Sat,  7 Sep 2019 18:50:15 +0000 (UTC)
From: steve@mctavish.co.uk
Reply-To: steve@mctavish.co.uk
To: gnats-bugs@NetBSD.org
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
>Organization:
>Environment:
NetBSD/i386 8.1_STABLE
>Description:
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.
>How-To-Repeat:
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.
>Fix:
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: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.