From owner-svn-src-all@freebsd.org  Mon Jul  6 21:52:27 2015
Return-Path: <owner-svn-src-all@freebsd.org>
Delivered-To: svn-src-all@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 916259954EC;
 Mon,  6 Jul 2015 21:52:27 +0000 (UTC)
 (envelope-from jmg@gold.funkthat.com)
Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified))
 by mx1.freebsd.org (Postfix) with ESMTPS id 731C1100E;
 Mon,  6 Jul 2015 21:52:27 +0000 (UTC)
 (envelope-from jmg@gold.funkthat.com)
Received: from gold.funkthat.com (localhost [127.0.0.1])
 by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t66LqKJQ096516
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Mon, 6 Jul 2015 14:52:20 -0700 (PDT)
 (envelope-from jmg@gold.funkthat.com)
Received: (from jmg@localhost)
 by gold.funkthat.com (8.14.5/8.14.5/Submit) id t66LqKAw096515;
 Mon, 6 Jul 2015 14:52:20 -0700 (PDT) (envelope-from jmg)
Date: Mon, 6 Jul 2015 14:52:20 -0700
From: John-Mark Gurney <jmg@funkthat.com>
To: Ian Lepore <ian@freebsd.org>
Cc: Neel Natu <neel@freebsd.org>, src-committers@freebsd.org,
 svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject: Re: svn commit: r285217 - head/usr.sbin/bhyve
Message-ID: <20150706215220.GP8523@funkthat.com>
References: <201507061933.t66JXTtJ050058@repo.freebsd.org>
 <1436213492.1334.64.camel@freebsd.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1436213492.1334.64.camel@freebsd.org>
X-Operating-System: FreeBSD 9.1-PRERELEASE amd64
X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88  9322 9CB1 8F74 6D3F A396
X-Files: The truth is out there
X-URL: http://resnet.uoregon.edu/~gurney_j/
X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html
X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE
X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger?
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7
 (gold.funkthat.com [127.0.0.1]); Mon, 06 Jul 2015 14:52:21 -0700 (PDT)
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 06 Jul 2015 21:52:27 -0000

Ian Lepore wrote this message on Mon, Jul 06, 2015 at 14:11 -0600:
> On Mon, 2015-07-06 at 19:33 +0000, Neel Natu wrote:
> > Author: neel
> > Date: Mon Jul  6 19:33:29 2015
> > New Revision: 285217
> > URL: https://svnweb.freebsd.org/changeset/base/285217
> > 
> > Log:
> >   Always assert DCD and DSR in bhyve's uart emulation.
> >   
> >   The /etc/ttys entry for a serial console in FreeBSD/x86 is as follows:
> >   ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
> >   
> >   The initial terminal type passed to getty(8) is "3wire" which sets the
> >   CLOCAL flag. However reset(1) clears this flag and any programs that try
> >   to open the terminal will hang waiting for DCD to be asserted.
> >   
> >   Fix this by always asserting DCD and DSR in the emulated uart.
> >   
> >   The following discussion on virtualization@ has more details:
> >   https://lists.freebsd.org/pipermail/freebsd-virtualization/2015-June/003666.html
> >   
> >   Reported by: jmg
> >   Discussed with: grehan
> 
> This seems like a wrong fix.  A real 3-wire serial console doesn't have
> DCD and DSR wired on.  Why isn't the right fix here having the user with
> this problem to do "stty -f /dev/ttyu0.lock clocal", maybe in rc.local? 
> 
> Hmmm, or maybe it would be right for getty to do the equivelent when it
> sees a 3wire type?

This seems more sane to me...

Ok, so I just tested on real hardware, and something is wrong w/
FreeBSD's behavior...  Could this be a change between 10 and HEAD?

One a real machine (I manually added 3wire from HEAD so /etc/ttys is
exactly the same between the two):
# uname -a
FreeBSD  10.1-STABLE FreeBSD 10.1-STABLE #102: Mon Jun 22 18:28:28 PDT 2015     jmg@carbon.funkthat.com:/a/home/jmg/consulting/netflix/new_sys/amd64/compile/bhgdb  amd64
# echo $TERM
vt100
# stty -a | grep clocal
cflags: cread cs8 -parenb -parodd -hupcl clocal -cstopb -crtscts -dsrflow
# reset
Erase is backspace.
# stty -a | grep clocal
cflags: cread cs8 -parenb -parodd -hupcl clocal -cstopb -crtscts -dsrflow

and under bhyve:
# uname -a
FreeBSD  11.0-CURRENT FreeBSD 11.0-CURRENT #11 r284880M: Fri Jul  3 14:14:49 PDT 2015     jmg@carbon.funkthat.com:/a/obj/a/home/jmg/FreeBSD.svn/HEAD/sys/IPSEC  amd64
# echo $TERM
vt100
# stty -a | grep clocal
cflags: cread cs8 -parenb -parodd hupcl clocal -cstopb -crtscts -dsrflow
# reset
<screen clears here, unlike real hardware>
# stty -a | grep clocal                                                 
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow

I check and both .init and .lock have the same settings...  reset -S
both return the same termcap entry...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."