From owner-svn-src-head@freebsd.org Tue Dec 3 15:14:59 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 712541B21FB for ; Tue, 3 Dec 2019 15:14:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47S5BW0MZtz4VBM for ; Tue, 3 Dec 2019 15:14:58 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575386097; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=D1vZwWRJ2zqbQ2tR0ZVqHN8tjXselyMNEmr/lvFXiBqy1gLeQ7/7QbK5ZSz7s7R7YokI4k0DFKiUr um6aUvuwcGr1SaX7wSAGxvl8q497QFz9tOUSRmJ4bpWni11bolySqFqflXwyCUUv02ZPlABcoHUPlu wBHZNzmavmNsIfzeMQsAfyBhqZitVEg60Flrytu/lSVETmv2ycPW5NQwHmgps6CHXzHOZve8jfCig5 EXiKMsn3bE6ygfWv/gQAiXrdv8FwX4oV/Pve3TAvPdvjtoxYjxC8w87VX8Lnxz9M5sFUgXpmKdxMT+ iWkNemHIw/DYOhgGzighSJ4HpHFYUPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=wilq65cdtfA0ndTuNEHGHlj6daG7/wYlxbHaCpNXREg=; b=qHZNyPk4ILzOsCK78oaeJjUw+gWDYtoY4EgtYpnHWGRCTULuT2vR2Xu5D6qHbcvWZJUDVXUNzcSkk vSSYS6EbMe61rjcuT1o6sMEgo83cSaVwgQoA1nK8rSGvkGfD6gjxl6RofHOieeeF+OdTwEEFc0CHiT prVHZgyZKC8ifeIjaBKw7WBJC07EcfIHQj3ks840GvB3TyMJy+nGpaVgYOnoFjc8vom+tvwk7AGdWy cNyp+cDrlNaeQks4taodWEONFILCUAaIhCAywku11Ij1PDOGOIoaC9FjvH3o08JQXWxCV0WzaNsXU8 FA4Q/rApZpW/pcdNxLH2oIpC9HKwAVw== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=wilq65cdtfA0ndTuNEHGHlj6daG7/wYlxbHaCpNXREg=; b=QSJ2A2N9xOWi3RVr1hOYQNdeDs1V8zpZi4WG9WYAN0QHAGM3wrMAoWK8KDZqVwaTaKuozBXrY8xpq wO+A/V64iIJ8hNt4mso9usFSXsvd9u/FwnU3ej5Uh7cXQAMcwveTPY/Xz6hekVjuQGDTL+zubCZgUj C+Dl86qvGAh9TY7h8ojM8Kr1w/qbQPe5fQmskRP7MraoTUv448Ds45hO8opH31RzBWQUdnQJWIbi3J CEpf1SPN/P8N2LEJ5pAvaYrVnyl3T0iTuxN2pQi1SX140L+YwXSe0kITlZIgA8mtV1k8GPZ8d2Rqb9 73VgDyDE3OLzE9xCO9SEqZND9nqB0BA== X-MHO-RoutePath: aGlwcGll X-MHO-User: a90c9068-15df-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id a90c9068-15df-11ea-829e-79a40d15cccd; Tue, 03 Dec 2019 15:14:55 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3FEs8t099861; Tue, 3 Dec 2019 08:14:54 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve From: Ian Lepore To: rgrimes@freebsd.org Cc: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 03 Dec 2019 08:14:54 -0700 In-Reply-To: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> References: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S5BW0MZtz4VBM X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.96)[-0.965,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-0.93)[-0.934,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 15:14:59 -0000 On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > > Author: vmaffione > > > Date: Mon Dec 2 20:51:46 2019 > > > New Revision: 355301 > > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > > > Log: > > > bhyve: uniform printf format string newlines > > > > > > Some of the printf statements only use LF to get a newline. > > > However, a CR character is also required for the serial console to > > > print debug logs in a nice way. > > > Fix those code locations that only use LF, by adding a CR > > > character. > > > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > > MFC after: 1 week > > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > > > Modified: > > > head/usr.sbin/bhyve/audio.c > > > head/usr.sbin/bhyve/hda_codec.c > > > head/usr.sbin/bhyve/net_backends.c > > > head/usr.sbin/bhyve/pci_ahci.c > > > head/usr.sbin/bhyve/pci_e82545.c > > > head/usr.sbin/bhyve/pci_hda.c > > > head/usr.sbin/bhyve/pci_nvme.c > > > head/usr.sbin/bhyve/pci_virtio_block.c > > > head/usr.sbin/bhyve/pci_virtio_console.c > > > head/usr.sbin/bhyve/pci_virtio_net.c > > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > > head/usr.sbin/bhyve/pci_xhci.c > > > head/usr.sbin/bhyve/rfb.c > > > > > > > These changes seem wrong in a couple ways... > > > > - Lines are terminated by linefeeds in unix-like systems. If > > linefeeds need to be translated to include carriage returns, that's the > > responsibility of the terminal/line-discipline layer, not the source > > strings being printed. > > Fully agree, this change seems wrong to me for Ian's stated reason here. > > > > > - The sequence \n\r is very strange. For systems that do prefer > > carriage returns, the \r always comes before the \n (or stands alone on > > Mac systems), not after. > > > > I have a feeling that the root of this is something like "lots of > > people use bhyve for Windows, so they use Windows apps to look at logs, > > so the logs should be formatted for Windows." If that's the reasoning, > > then why shouldn't we convert EVERY printf in the source base to > > include carriage returns, just in case a windows user wants to browse a > > log file? > > This is not that issue, it is something going on with the line > discipline when using the bhyve console device. I believe the > line displine being different from what bhyve itself is expecting > so when console output is intermixed with output from bhyve itself > things go wrong. > > The printf's in this patch are coming from the bhyve process that > has a fd open to the launching tty, the line discipline on that tty > is changed to something different after you open the > console device from that same controlling tty, or that is my hypothosis > on what is going wrong. There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would definitely turn off nl->crnl translations. I think that is the other end of the bhyve console that I posted a patch for yesterday, and I think the console driver is probably still the right place to do that translation (because other console drivers do it that way). But I'm not set up to run bhyve here, so I can't test my theory. -- Ian