qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCHv2] Fix virtio-console failure on unconnected pty


From: Amit Shah
Subject: Re: [Qemu-devel] [PATCHv2] Fix virtio-console failure on unconnected pty
Date: Thu, 29 Dec 2011 19:34:07 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

On (Thu) 29 Dec 2011 [13:47:43], Christian Borntraeger wrote:
> From: Christian Borntraeger <address@hidden>
>     
> when I tried qemu with -virtio-console pty the guest hangs and attaching on 
> /dev/pts/<x> does
> not return anything if the attachement is too late.
> Turns out that the console is already throttled and the guest is heavily 
> spinning but get_buf
> never returns the buffer. There seems to be no way for the console to 
> unthrottle the port.
>     
> For the virtio-serial use case we dont want to loose data but for the console 
> case we better
> drop  data instead of "killing" the guest console. If we get 
> chardev->frontend notification
> and a better behaving virtio-console we can revert this fix.
>     
> Signed-off-by: Christian Borntraeger <address@hidden>
> 
> ---
>  hw/virtio-serial-bus.c |   14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> Index: b/hw/virtio-serial-bus.c
> ===================================================================
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -163,7 +163,19 @@ static void do_flush_queued_data(VirtIOS
>                  abort();
>              }
>              if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) {
> -                virtio_serial_throttle_port(port, true);

I'm surprised: did you test this with upstream qemu?  That codebase
doesn't yet throttle writes, and this code path won't execute.  Does
it really not reproduce with this patch?

> +             /*
> +                 * this is a temporary check until chardevs can signal to
> +                 * frontends that they are writable again. This prevents
> +                 * the console from going into throttled mode (forever)
> +                 * if virtio-console is connected to a pty without a
> +                 * listener. Otherwise the guest spins forever.
> +                 * We can revert this if
> +                 * 1: chardevs can notify frondends
> +                 * 2: the guest driver does not spin in these cases
> +                 */
> +                if (!info->is_console) {
> +                    virtio_serial_throttle_port(port, true);
> +                }
>                  port->iov_idx = i;
>                  if (ret > 0) {
>                      port->iov_offset += ret;
> 

                Amit



reply via email to

[Prev in Thread] Current Thread [Next in Thread]