From: Gerd Hoffmann <kraxel@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>,
qemu list <qemu-devel@nongnu.org>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 15/17] virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse
Date: Wed, 31 Mar 2010 15:53:59 +0200 [thread overview]
Message-ID: <4BB353F7.10207@redhat.com> (raw)
In-Reply-To: <1270020848-15526-16-git-send-email-amit.shah@redhat.com>
> /* Callback function that's called when the guest sends us data */
> -static size_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
> +static void flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
> {
> VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
> - ssize_t ret;
>
> - ret = qemu_chr_write(vcon->chr, buf, len);
> -
> - return ret< 0 ? 0 : ret;
> + qemu_chr_write(vcon->chr, buf, len);
> }
Ok, so we loose data in case qemu_chr_write wasn't able to write out all
data? Nice opportunity to show flow control in action here ;)
On failed+partial writes just put the remaining data into a buffer and
throttle the port until all buffered data has been successfully written
to the chardev.
Incremental patch is fine to avoid the chicken-egg issue (throttling is
added by patch #17).
cheers,
Gerd
next prev parent reply other threads:[~2010-03-31 13:54 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 7:33 [Qemu-devel] [PATCH 00/17] v4: virtio-serial fixes, new abi for port discovery Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 01/17] virtio-serial: save/load: Ensure target has enough ports Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 02/17] virtio-serial: save/load: Ensure nr_ports on src and dest are same Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 03/17] virtio-serial: save/load: Ensure we have hot-plugged ports instantiated Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 04/17] virtio-serial: save/load: Send target host connection status if different Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 05/17] virtio-serial: Use control messages to notify guest of new ports Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 06/17] virtio-serial: whitespace: match surrounding code Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 07/17] virtio-serial: Remove redundant check for 0-sized write request Amit Shah
2010-03-31 7:33 ` [Qemu-devel] [PATCH 08/17] virtio-serial: Update copyright year to 2010 Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 09/17] virtio-serial: Propagate errors in initialising ports / devices in guest Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 10/17] virtio-serial: Send out guest data to ports only if port is opened Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 11/17] iov: Introduce a new file for helpers around iovs, add iov_from_buf() Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 12/17] iov: Add iov_to_buf and iov_size helpers Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 13/17] virtio-serial: Handle scatter-gather buffers for control messages Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 14/17] virtio-serial: Handle scatter/gather input from the guest Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 15/17] virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 16/17] virtio-serial: Discard data that guest sends us when ports aren't connected Amit Shah
2010-03-31 7:34 ` [Qemu-devel] [PATCH 17/17] virtio-serial: Implement flow control for individual ports Amit Shah
2010-03-31 11:07 ` [Qemu-devel] Re: [PATCH 16/17] virtio-serial: Discard data that guest sends us when ports aren't connected Juan Quintela
2010-03-31 13:53 ` Gerd Hoffmann [this message]
2010-03-31 14:06 ` [Qemu-devel] [PATCH 15/17] virtio-serial: Apps should consume all data that guest sends out / Fix virtio api abuse Amit Shah
2010-03-31 11:38 ` [Qemu-devel] Re: [PATCH 00/17] v4: virtio-serial fixes, new abi for port discovery Juan Quintela
2010-04-01 7:10 ` [Qemu-devel] " Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BB353F7.10207@redhat.com \
--to=kraxel@redhat.com \
--cc=amit.shah@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.