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

2012-01-03 Thread Amit Shah
On (Mon) 02 Jan 2012 [17:55:06], Alexander Graf wrote: > > On 02.01.2012, at 16:41, Christian Borntraeger wrote: > > > On 02/01/12 16:34, Alexander Graf wrote: > if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { > virtio_serial_throttle_port(port, true); > >>

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

2012-01-02 Thread Alexander Graf
On 02.01.2012, at 16:41, Christian Borntraeger wrote: > On 02/01/12 16:34, Alexander Graf wrote: if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { virtio_serial_throttle_port(port, true); >>> >>> Ah; I see what's happening. pty_chr_write() returns 0 if a cl

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

2012-01-02 Thread Christian Borntraeger
On 02/01/12 16:34, Alexander Graf wrote: >>>if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { >>>virtio_serial_throttle_port(port, true); >> >> Ah; I see what's happening. pty_chr_write() returns 0 if a client >> isn't yet connected. >> >> This is different from the

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

2012-01-02 Thread Alexander Graf
On 29.12.2011, at 16:14, Amit Shah wrote: > On (Thu) 29 Dec 2011 [15:32:14], Christian Borntraeger wrote: >>> port->throttled never becomes true for qemu. >> >> Huh? What did I miss below? >> >>if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { >>virtio_serial_t

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

2011-12-29 Thread Christian Borntraeger
On 29/12/11 15:56, Amit Shah wrote: > On (Thu) 29 Dec 2011 [15:32:14], Christian Borntraeger wrote: >>> port->throttled never becomes true for qemu. >> >> Huh? What did I miss below? >> >> if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { >> virtio_serial_throttle_

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

2011-12-29 Thread Amit Shah
On (Thu) 29 Dec 2011 [15:32:14], Christian Borntraeger wrote: > > port->throttled never becomes true for qemu. > > Huh? What did I miss below? > > if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { > virtio_serial_throttle_port(port, true); Ah; I see what's happe

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

2011-12-29 Thread Amit Shah
On (Thu) 29 Dec 2011 [15:32:14], Christian Borntraeger wrote: > > port->throttled never becomes true for qemu. > > Huh? What did I miss below? > > if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { > virtio_serial_throttle_port(port, true); 'ret' here is the retu

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

2011-12-29 Thread Christian Borntraeger
> port->throttled never becomes true for qemu. Huh? What did I miss below? if (ret == -EAGAIN || (ret >= 0 && ret < buf_size)) { virtio_serial_throttle_port(port, true); |

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

2011-12-29 Thread Amit Shah
On (Thu) 29 Dec 2011 [15:16:55], Christian Borntraeger wrote: > >> +++ 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)) { > >> -

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

2011-12-29 Thread Christian Borntraeger
>> 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? > > I think > static void handle_output(VirtIODevice *vdev, VirtQueue *vq) > [] > if (!port->throttled

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

2011-12-29 Thread Christian Borntraeger
>> +++ 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

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

2011-12-29 Thread Amit Shah
On (Thu) 29 Dec 2011 [13:47:43], Christian Borntraeger wrote: > From: Christian Borntraeger > > when I tried qemu with -virtio-console pty the guest hangs and attaching on > /dev/pts/ does > not return anything if the attachement is too late. > Turns out that the console is already throttled

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

2011-12-29 Thread Andreas Färber
Am 29.12.2011 14:27, schrieb Amit Shah: > On (Thu) 29 Dec 2011 [13:47:43], Christian Borntraeger wrote: >> From: Christian Borntraeger >> >> when I tried qemu with -virtio-console pty the guest hangs and attaching on >> /dev/pts/ does >> not return anything if the attachement is too late. "

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

2011-12-29 Thread Amit Shah
On (Thu) 29 Dec 2011 [13:47:43], Christian Borntraeger wrote: > From: Christian Borntraeger > > when I tried qemu with -virtio-console pty the guest hangs and attaching on > /dev/pts/ does > not return anything if the attachement is too late. > Turns out that the console is already throttled

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

2011-12-29 Thread Christian Borntraeger
From: Christian Borntraeger when I tried qemu with -virtio-console pty the guest hangs and attaching on /dev/pts/ 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.