Received: from eggs.gnu.org ([2001:4830:134:3::10]:58528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bV078-0004MS-N9 for qemu-devel@nongnu.org; Wed, 03 Aug 2016 13:37:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bV073-0001Wn-3B for qemu-devel@nongnu.org; Wed, 03 Aug 2016 13:37:53 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:9030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bV072-0001WW-Qs for qemu-devel@nongnu.org; Wed, 03 Aug 2016 13:37:49 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u73HTNcB050650 for ; Wed, 3 Aug 2016 13:37:48 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 24kkah57py-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 03 Aug 2016 13:37:47 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 3 Aug 2016 18:37:45 +0100 Date: Wed, 3 Aug 2016 19:37:40 +0200 From: Cornelia Huck In-Reply-To: <1470241360-3574-2-git-send-email-berrange@redhat.com> References: <1470241360-3574-1-git-send-email-berrange@redhat.com> <1470241360-3574-2-git-send-email-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Message-Id: <20160803193740.08c3a365.cornelia.huck@de.ibm.com> Subject: Re: [Qemu-devel] [PATCH 1/5] virtio-console: set frontend open permanently for console devs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Paolo Bonzini , Amit Shah , Gerd Hoffmann On Wed, 3 Aug 2016 17:22:36 +0100 "Daniel P. Berrange" wrote: > The virtio-console.c file handles both serial consoles > and interactive consoles, since they're backed by the > same device model. >=20 > Since serial devices are expected to be reliable and > need to notify the guest when the backend is opened > or closed, the virtio-console.c file wires up support > for chardev events. This affects both serial consoles > and interactive consoles, using a network connection > based chardev backend such as 'socket', but not when > using a PTY based backend or plain 'file' backends. >=20 > When the host side is not connected the handle_output() > method in virtio-serial-bus.c will drop any data sent > by the guest, before it even reaches the virtio-console.c > code. This means that if the chardev has a logfile > configured, the data will never get logged. >=20 > Consider for example, configuring a x86_64 guest with a > plain UART serial port >=20 > -chardev socket,id=3Dcharserial1,host=3D127.0.0.1,port=3D9001,server,no= wait,logfile=3Dconsole1.log,logappend=3Don > -device isa-serial,chardev=3Dcharserial1,id=3Dserial1 >=20 > vs a s390 guest which has to use the virtio-console port >=20 > -chardev socket,id=3Dcharconsole1,host=3D127.0.0.1,port=3D9000,server,n= owait,logfile=3Dconsole2.log,logappend=3Don > -device virtconsole,chardev=3Dcharconsole1,id=3Dconsole1 >=20 > The isa-serial one gets data written to the log regardless > of whether a client is connected, while the virtioconsole > one only gets data written to the log when a client is > connected. >=20 > There is no need for virtio-serial-bus.c to aggressively > drop the data for console devices, as the chardev code is > prefectly capable of discarding the data itself. >=20 > So this patch changes virtconsole devices so that they > are always marked as having the host side open. This > ensures that the guest OS will always send any data it > has (Linux virtio-console hvc driver actually ignores > the host open state and sends data regardless, but we > should not rely on that), and also prevents the > virtio-serial-bus code prematurely discarding data. >=20 > The behaviour of virtserialport devices is *not* changed, > only virtconsole, because for the former, it is important > that the guest OSknow exactly when the host side is opened > / closed so it can do any protocol re-negotiation that may > be required. >=20 > Fixes bug: https://bugs.launchpad.net/qemu/+bug/1599214 >=20 > Signed-off-by: Daniel P. Berrange > --- > hw/char/virtio-console.c | 25 +++++++++++++++++++++---- > 1 file changed, 21 insertions(+), 4 deletions(-) =46rom my limited understanding of the character layer this sounds reasonable, and I agree that this is 2.7 material. Acked-by: Cornelia Huck