From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NT71z-0005zI-2O for qemu-devel@nongnu.org; Fri, 08 Jan 2010 00:05:03 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NT71u-0005w6-AG for qemu-devel@nongnu.org; Fri, 08 Jan 2010 00:05:02 -0500 Received: from [199.232.76.173] (port=34079 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NT71t-0005vv-Ng for qemu-devel@nongnu.org; Fri, 08 Jan 2010 00:04:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:20475) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NT71t-0004Pt-4p for qemu-devel@nongnu.org; Fri, 08 Jan 2010 00:04:57 -0500 Date: Fri, 8 Jan 2010 10:33:51 +0530 From: Amit Shah Subject: Re: [Qemu-devel] [PATCH 5/8] virtio-serial-bus: Add support for buffering guest output, throttling guests Message-ID: <20100108050351.GB8999@amit-x200.redhat.com> References: <1262849506-27132-6-git-send-email-amit.shah@redhat.com> <20100108011231.GA5011@shareable.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100108011231.GA5011@shareable.org> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: qemu-devel@nongnu.org On (Fri) Jan 08 2010 [01:12:31], Jamie Lokier wrote: > Amit Shah wrote: > > Guests send us one buffer at a time. Current guests send buffers sized > > 4K bytes. If guest userspace applications sent out > 4K bytes in one > > write() syscall, the write request actually sends out multiple buffers, > > each of 4K in size. > > > > This usually isn't a problem but for some apps, like VNC, the entire > > data has to be sent in one go to make copy/paste work fine. So if an app > > on the guest sends out guest clipboard contents, it has to be sent to > > the vnc server in one go as the guest app sent it. > > > > For this to be done, we need the guest to send us START and END markers > > for each write request so that we can find out complete buffers and send > > them off to ports. > > That looks very dubious. TCP/IP doesn't maintain write boundaries; > neither do pipes, unix domain sockets, pseudo-terminals, and almost > every other modern byte-oriented transport. > > So how does VNC transmit the clipboard over TCP/IP to a VNC client, > without those boundaries, and why is it different with virtserialport? TCP does this in its stack: it waits for the number of bytes written to be received and then notifies userspace of data availibility. In this case, consider the case where the guest writes 10k of data. The guest gives us those 10k in 3 chunks: the first containing 4k (- header size), the 2nd containing the next 4k (- header size) and the 3rd chunk the remaining data. I want to flush out this data only when I get all 10k. Amit