[Spice-commits] Changes to 'chardev-flowcontrol'
Hans de Goede
jwrdegoede at kemper.freedesktop.org
Tue May 3 06:55:44 PDT 2011
New branch 'chardev-flowcontrol' available with the following commits:
commit d7e027f9e37a50db1c737ebbfc1b5c9bd75229b6
Author: Alon Levy <alevy at redhat.com>
Date: Tue Mar 22 12:28:00 2011 +0200
spice-qemu-char.c: remove intermediate buffer
BZ: 672191
upstream: not submitted (explained below)
virtio-serial's buffer is valid when it calls us, and we don't
access it otherwise: vmc_read is only called in response to wakeup,
or else we set datalen=0 and throttle. Then vmc_read is called back,
we return 0 (not accessing the buffer) and set the timer to unthrottle.
Also make datalen int and not ssize_t (to fit spice_chr_write signature).
This relied on the previous patch that introduces throttling, which
can't go upstream right now as explained in that patch.
commit 4e2395eeaf627edbb12aa0d46f8cf50f8c029d1f
Author: Alon Levy <alevy at redhat.com>
Date: Tue Mar 22 12:27:59 2011 +0200
spice-qemu-char.c: add throttling
BZ: 672191
upstream: not submitted (explained below)
Adds throttling support to spicevmc chardev. Uses a timer to avoid recursing:
1. spice-server: reds.c: read_from_vdi_port
2. qemu: spice-qemu-char.c: vmc_read
3. chr_write_unblocked
(calls virtio_serial_throttle_port(port, false))
4. qemu: virtio ...
5. qemu: spice-qemu-char.c: spice_chr_write
6. qemu: spice-qemu-char.c: wakeup (calls into spice-server)
7. spice-server: ...
8. qemu: spice-qemu-char.c: vmc_read
Instead, in vmc_read if we were throttled and we are just about to return
all the bytes we will set a timer to be triggered immediately to call
chr_write_unblocked. Then we return after 2 above, and 3 is called from the
timer callback. This also means we can later remove some ugly recursion protection
from spice-server.
The other tricky point in this patch is not returning the leftover chunk twice.
When we throttle, by definition we have data that spice server didn't consume.
It is being kept by virtio-serial, and by us. The next vmc_read callback needs
to not return it, but just do unthrottling. Then virtio will give us the remaining
chunk as usual in spice_chr_write, and we will pass it to spice server in the
next vmc_read.
This patch relies on Amit's series to expose throttling to chardev's, which
was not accepted upstream, and will not be accepted upstream until the mainloop
is reworked to use glib.
commit 176ff5d6ce9b457b052618ce825c7ef392de6cff
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 22:06:41 2011 +0100
virtio-console: Enable port throttling when chardev is slow to consume data
When a chardev indicates it can't accept more data, we tell the
virtio-serial code to stop sending us any more data till we tell
otherwise. This helps in guests continuing to run normally while the vq
keeps getting full and eventually the guest stops queueing more data.
As soon as the chardev indicates it can accept more data, start pushing!
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit 3e2ac29f3ea82c9825644ae4cc89f349bbcce07b
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 22:05:10 2011 +0100
char: Throttle when host connection is down#
When the host-side connection goes down, throttle the virtio-serial bus
and later unthrottle when a connection gets established. This helps
prevent any lost IO (guest->host) while the host connection was down.
Bugzilla: 621484
This commit actually helps the bug mentioned above as no writes will now
get lost because of the throttling done here. With just the patches
sent earlier for that bug, one write will end up getting lost in the
worst case (host d/c, guest write, host connect).
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit 973044704f0514c0b612df3ee1aa78a5246da161
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 22:02:47 2011 +0100
char: Equip the unix/tcp backend to handle nonblocking writes#
Now that the infrastructure is in place to return -EAGAIN to callers,
individual char drivers can set their update_fd_handlers() function to
set or remove an fd's write handler. This handler checks if the driver
became writable.
A generic callback routine is used for unblocking writes and letting
users of chardevs know that a driver became writable again.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit b8e8cb96a04153c35fdd6764bd87807e14c51476
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 22:00:27 2011 +0100
char: Update send_all() to handle nonblocking chardev write requests
The send_all function is modified to return to the caller in case the
driver cannot handle any more data. It returns -EAGAIN or
WSAEWOULDBLOCK on non-Windows and Windows platforms respectively. This
is only done when the caller sets a callback function handler indicating
it's not interested in blocking till the driver has written out all the
data.
Currently there's no driver or caller that supports this. Future
commits will add such capability.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit 60d7d45181ade9e236db3c8fc34b1cbd3db619b3
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 21:41:42 2011 +0100
char: Add framework for a 'write unblocked' callback
The char layer can let users know that the driver will block on further
input. For users interested in not blocking, they can assign a function
pointer that will be called back when the driver becomes writable. This
patch just adds the function pointers to the CharDriverState structure,
future patches will enable the nonblocking and callback functionality.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit 96767b60680f9bcee25c8da321108086afd4901a
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 20:32:58 2011 +0100
iohandlers: Add enable/disable_write_fd_handler() functions
These will be used to provide a cleaner API for the nonblocking case.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit b407f594f2e11b36ce67ffbf0280fae4e561c6d3
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 20:31:45 2011 +0100
char: Add a QemuChrHandlers struct to initialise chardev handlers
Instead of passing each handler in the qemu_add_handlers() function,
create a struct of handlers that can be passed to the function instead.
Signed-off-by: Amit Shah <amit.shah at redhat.com>
commit 24b597d262333e47f46ce3d75355ca59107b0153
Author: Amit Shah <amit.shah at redhat.com>
Date: Mon Mar 21 21:57:47 2011 +0100
char: Split out tcp socket close code in a separate function
Signed-off-by: Amit Shah <amit.shah at redhat.com>
More information about the Spice-commits
mailing list