qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Serial telnet console drops incoming characters on git master
@ 2016-02-07 18:38 Mark Cave-Ayland
  2016-02-08 12:11 ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Cave-Ayland @ 2016-02-07 18:38 UTC (permalink / raw)
  To: qemu-devel

Hi Daniel,

I found another issue where the latest set of console updates appear to
break -serial telnet on qemu-system-sparc. What I see is that while
incoming serial telnet appears fine, outgoing serial telnet traffic
caused by typing over the serial connection results in every other
character being dropped.

A quick session with git bisect points to the following commit:

commit f2001a7e0555b66d6db25a3ff1801540814045bb
Author: Daniel P. Berrange <berrange@redhat.com>
Date:   Tue Jan 19 11:14:30 2016 +0000

    char: don't assume telnet initialization will not block

    The current code for doing telnet initialization is writing to
    a socket without checking the return status. While it is highly
    unlikely to be a problem when writing to a bare socket, as the
    buffers are large enough to prevent blocking, this cannot be
    assumed safe with TLS sockets. So write the telnet initialization
    code into a memory buffer and then use an I/O watch to fully
    send the data.

    Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
    Message-Id: <1453202071-10289-4-git-send-email-berrange@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

I can reproduce this with git master as follows (built on Debian Wheezy
x86-64):

'./configure' '--target-list=sparc-softmmu' --enable-trace-backends=stderr
make install

Next download a copy of the SS-20 PROM from
http://home.earthlink.net/~reif/ss20_v2.25_rom and then start QEMU with
the command line below:

./qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 -nographic -boot c
-serial telnet:0.0.0.0:3000,server -cpu "TI SuperSparc 60" -m 64

Now telnet to port 3000 and wait for the PROM to boot all the way to the
"ok" prompt. At this point if you type over the telnet connection, you
should see that every alternate character typed is being lost.


ATB,

Mark.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Serial telnet console drops incoming characters on git master
  2016-02-07 18:38 [Qemu-devel] Serial telnet console drops incoming characters on git master Mark Cave-Ayland
@ 2016-02-08 12:11 ` Daniel P. Berrange
  2016-02-08 13:56   ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2016-02-08 12:11 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: qemu-devel

On Sun, Feb 07, 2016 at 06:38:56PM +0000, Mark Cave-Ayland wrote:
> Hi Daniel,
> 
> I found another issue where the latest set of console updates appear to
> break -serial telnet on qemu-system-sparc. What I see is that while
> incoming serial telnet appears fine, outgoing serial telnet traffic
> caused by typing over the serial connection results in every other
> character being dropped.
> 
> A quick session with git bisect points to the following commit:
> 
> commit f2001a7e0555b66d6db25a3ff1801540814045bb
> Author: Daniel P. Berrange <berrange@redhat.com>
> Date:   Tue Jan 19 11:14:30 2016 +0000
> 
>     char: don't assume telnet initialization will not block
> 
>     The current code for doing telnet initialization is writing to
>     a socket without checking the return status. While it is highly
>     unlikely to be a problem when writing to a bare socket, as the
>     buffers are large enough to prevent blocking, this cannot be
>     assumed safe with TLS sockets. So write the telnet initialization
>     code into a memory buffer and then use an I/O watch to fully
>     send the data.
> 
>     Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
>     Message-Id: <1453202071-10289-4-git-send-email-berrange@redhat.com>
>     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> I can reproduce this with git master as follows (built on Debian Wheezy
> x86-64):
> 
> './configure' '--target-list=sparc-softmmu' --enable-trace-backends=stderr
> make install
> 
> Next download a copy of the SS-20 PROM from
> http://home.earthlink.net/~reif/ss20_v2.25_rom and then start QEMU with
> the command line below:
> 
> ./qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 -nographic -boot c
> -serial telnet:0.0.0.0:3000,server -cpu "TI SuperSparc 60" -m 64
> 
> Now telnet to port 3000 and wait for the PROM to boot all the way to the
> "ok" prompt. At this point if you type over the telnet connection, you
> should see that every alternate character typed is being lost.

Thanks for the instructions to reproduce - I can reproduce it myself too

This is a bit of a strange bug - it only happens when QEMU is told to block
at startup. If you add 'nowait' to the -serial arg then everything appears
to work fine. The data sent over the wire to initialize telnet is identical
in both cases, and data forwarded to the hardware backend is the same.

It is something todo with the fact that when we initialize the chardev in
blocking mode with telnet, the 'tcp_chr_connect' call now happens from the
main loop, since of from main initialization. I'm still investigating why
this would make any difference...

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] Serial telnet console drops incoming characters on git master
  2016-02-08 12:11 ` Daniel P. Berrange
@ 2016-02-08 13:56   ` Daniel P. Berrange
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2016-02-08 13:56 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: qemu-devel

On Mon, Feb 08, 2016 at 12:11:53PM +0000, Daniel P. Berrange wrote:
> On Sun, Feb 07, 2016 at 06:38:56PM +0000, Mark Cave-Ayland wrote:
> > Hi Daniel,
> > 
> > I found another issue where the latest set of console updates appear to
> > break -serial telnet on qemu-system-sparc. What I see is that while
> > incoming serial telnet appears fine, outgoing serial telnet traffic
> > caused by typing over the serial connection results in every other
> > character being dropped.
> > 
> > A quick session with git bisect points to the following commit:
> > 
> > commit f2001a7e0555b66d6db25a3ff1801540814045bb
> > Author: Daniel P. Berrange <berrange@redhat.com>
> > Date:   Tue Jan 19 11:14:30 2016 +0000
> > 
> >     char: don't assume telnet initialization will not block
> > 
> >     The current code for doing telnet initialization is writing to
> >     a socket without checking the return status. While it is highly
> >     unlikely to be a problem when writing to a bare socket, as the
> >     buffers are large enough to prevent blocking, this cannot be
> >     assumed safe with TLS sockets. So write the telnet initialization
> >     code into a memory buffer and then use an I/O watch to fully
> >     send the data.
> > 
> >     Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> >     Message-Id: <1453202071-10289-4-git-send-email-berrange@redhat.com>
> >     Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > I can reproduce this with git master as follows (built on Debian Wheezy
> > x86-64):
> > 
> > './configure' '--target-list=sparc-softmmu' --enable-trace-backends=stderr
> > make install
> > 
> > Next download a copy of the SS-20 PROM from
> > http://home.earthlink.net/~reif/ss20_v2.25_rom and then start QEMU with
> > the command line below:
> > 
> > ./qemu-system-sparc -bios ./ss20_v2.25_rom -M SS-20 -nographic -boot c
> > -serial telnet:0.0.0.0:3000,server -cpu "TI SuperSparc 60" -m 64
> > 
> > Now telnet to port 3000 and wait for the PROM to boot all the way to the
> > "ok" prompt. At this point if you type over the telnet connection, you
> > should see that every alternate character typed is being lost.
> 
> Thanks for the instructions to reproduce - I can reproduce it myself too
> 
> This is a bit of a strange bug - it only happens when QEMU is told to block
> at startup. If you add 'nowait' to the -serial arg then everything appears
> to work fine. The data sent over the wire to initialize telnet is identical
> in both cases, and data forwarded to the hardware backend is the same.
> 
> It is something todo with the fact that when we initialize the chardev in
> blocking mode with telnet, the 'tcp_chr_connect' call now happens from the
> main loop, since of from main initialization. I'm still investigating why
> this would make any difference...

Finally found out the problem - we ended up registering I/O watches
twice, so 1/2 the characters ended up in a blackhole. I've just copied
you on a suitable patch.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-08 13:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-07 18:38 [Qemu-devel] Serial telnet console drops incoming characters on git master Mark Cave-Ayland
2016-02-08 12:11 ` Daniel P. Berrange
2016-02-08 13:56   ` Daniel P. Berrange

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).