Hi. A noticed a very strange thing. A few weeks ago I installed WindowsXP under qemu. I have serial device attached to COM1 port and comunication works. Basicaly I have to download a few hundred bytes from that serial device to computer. Every time comunication stops at 83% (5/6). The weird thing is, that when I use Xen, I can see exactly same thing. Stops at 83%. Is this related or just coincidence? Is it my hardware? Windows on "real" hardware doesn''t have this problem. Aleš _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Henning Sprang
2007-Feb-08 13:05 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
On 2/8/07, Aleš Rom <ales.rom@kabelnet.net> wrote:> Hi. > > A noticed a very strange thing. A few weeks ago I installed WindowsXP > under qemu. I have serial device attached to COM1 port and comunication > works. > Basicaly I have to download a few hundred bytes from that serial device > to computer. Every time comunication stops at 83% (5/6). > > The weird thing is, that when I use Xen, I can see exactly same thing. > Stops at 83%. Is this related or just coincidence? Is it my hardware? > Windows on "real" hardware doesn''t have this problem.I don''t too much about the details of serial consoles in Xen and Qemu, but I know that Xen uses qemu code to emulate the parts that currently aren''t included in hardware supported virtualization - which is everything but memory(right?) and CPU. As long as you don''t install paravirtual IO drivers in windows (which AFAIK you get with XenEnterprise products), you use qemu-derived IO emulation. Likely that this is also valid for serial ports, and so you see the same problems. Henning _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Aleš Rom
2007-Feb-08 14:32 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
Petersson, Mats pravi:> > > >> -----Original Message----- >> From: xen-users-bounces@lists.xensource.com >> [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of Aleš Rom >> Sent: 08 February 2007 12:55 >> To: xen-users@lists.xensource.com >> Subject: [Xen-users] Is Xen and Qemu serial driver code related ? >> >> Hi. >> >> A noticed a very strange thing. A few weeks ago I installed WindowsXP >> under qemu. I have serial device attached to COM1 port and >> comunication >> works. >> Basicaly I have to download a few hundred bytes from that >> serial device >> to computer. Every time comunication stops at 83% (5/6). >> >> The weird thing is, that when I use Xen, I can see exactly >> same thing. >> Stops at 83%. Is this related or just coincidence? Is it my >> hardware? >> Windows on "real" hardware doesn''t have this problem. >> > > Sounds like it could be the same problem - Xen in HVM mode uses QEMU (a slightly modified source that builds the binary called qemu-dm, which lives in /usr/lib{64}/xen/bin or some such) to emulate the hardware in the guest. Serial port(s) is part of this emulated hardware. > > However, it could be "just about anything". If it''s caused by the software, it would probably help to "log" the serial comms somehow (I''ve successfully written code to take two serial ports on a machine and "copy" the data from one port to the other, making it a "logging station", but there may be other ways to do it, for example let qemu dump the serial port data onto a file - probably requires a little bit of hacking in qemu, but not terribly hard work, if you know a bit about programming). A good place to start this would be in ".../tools/ioemu/hw/serial.c" - the functons serial_ioport_write() and serial_ioport_read(), particularly "addr 0", which is the "data" address. Here''s what I would add: > New variable around the beginning of serial.c (after the #include statements): > FILE *serial_log; > In serial_init() add: > serial_log = fopen("/tmp/serial.log", "w"); > if (serial_log == NULL) { > fprintf(logfile, "Failed to open /tmp/serial.log"); > exit(1); > } > > In serial_ioport_write(): > At "case 0", just before the "break" add: > fprintf(serial_log, "TX: %02x\n", val); > > In serial_ioport_read(): > At "case 0", just before the "break" add: > fprintf(serial_log, "RX: %02x\n", ret); > > -- > Mats > > > -- > Mats > >> Aleš >> >> _______________________________________________ >> Xen-users mailing list >> Xen-users@lists.xensource.com >> http://lists.xensource.com/xen-users >> >> >> >> > > > >Thanks for your help. I''m running Xen on FC6, and xen was installed from rpm package. If I understand correctly I have to install xen source, modify serial.c, rebuild xen (hopefully just qemu-dm) and run serial connection again. I''m NOT a programmer, but with a little help can do that. :) I''m really interested to debug this issue. Aleš _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Petersson, Mats
2007-Feb-08 14:44 UTC
RE: [Xen-users] Is Xen and Qemu serial driver code related ?
> Thanks for your help. I''m running Xen on FC6, and xen was > installed from > rpm package. > If I understand correctly I have to install xen source, modify > serial.c, rebuild xen (hopefully just qemu-dm) and run serial > connection > again. I''m NOT a programmer, but with a little help can do that. :) > I''m really interested to debug this issue.Yes, you''ll need to get the sources (if you installed Xen as a package with FC6, then I suggest you get the sources from the SRPM of FC6 too - in which case you only need to rebuild qemu-dm - perhaps some other bits are needed to build qemu-dm, but that should be fairly minimal). -- Mats> > Aleš > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ulrich Windl
2007-Feb-09 07:20 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
Have you tried good old kermit (to transfer files via the serial port)? Generally I''d say that your communication protocol isn''t fault-tolerant, unless you have a complete lock up of the serial driver. Without knowing the details, there''s little one can say. Ulrich On 8 Feb 2007 at 13:54, Ales Rom wrote:> Hi. > > A noticed a very strange thing. A few weeks ago I installed WindowsXP > under qemu. I have serial device attached to COM1 port and comunication > works. > Basicaly I have to download a few hundred bytes from that serial device > to computer. Every time comunication stops at 83% (5/6). > > The weird thing is, that when I use Xen, I can see exactly same thing. > Stops at 83%. Is this related or just coincidence? Is it my hardware? > Windows on "real" hardware doesn''t have this problem. > > Ales > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
ales.rom@kabelnet.net
2007-Feb-09 09:14 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
Aleš Rom
2007-Feb-10 09:13 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
It looks like protocol related problem. I have some additional info if someone is interested. I hooked up two boxes with serial cable. First one is WinXP on real hardware, second one virtualized WinXP on FC6. I started Hyper Terminal on both sides. Console communication is OK. Then I tried file transfer. 1. Real to virtual file transfer is good, other way not possible - using Zmodem protocol 2. Both ways file transfer is good - using Kermit protocol If I try same thing on non virtual boxes, I don''t have this problem no matter what protocol I use. The problem is that I can''t change protocol when using proprietary application (for Win only) and this special device on COM port. http://www2.sma.de/en/solar-technology/products/communication/communication-products-software/sunny-boy-control-plus/overview/index.html On the other way, emulated serial port is not acting the same as real one. Is this question for xen developers? Can I try anything else? Thank you. Aleš Ulrich Windl pravi:> Have you tried good old kermit (to transfer files via the serial port)? Generally > I''d say that your communication protocol isn''t fault-tolerant, unless you have a > complete lock up of the serial driver. Without knowing the details, there''s little > one can say. > > Ulrich > > On 8 Feb 2007 at 13:54, Ales Rom wrote: > > >> Hi. >> >> A noticed a very strange thing. A few weeks ago I installed WindowsXP >> under qemu. I have serial device attached to COM1 port and comunication >> works. >> Basicaly I have to download a few hundred bytes from that serial device >> to computer. Every time comunication stops at 83% (5/6). >> >> The weird thing is, that when I use Xen, I can see exactly same thing. >> Stops at 83%. Is this related or just coincidence? Is it my hardware? >> Windows on "real" hardware doesn''t have this problem. >> >> Ales >> >> >>_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Otavio Salvador
2007-Feb-10 19:15 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
Aleš Rom <ales.rom@kabelnet.net> writes:> The problem is that I can''t change protocol when using proprietary > application (for Win only) and this special device on COM port. > http://www2.sma.de/en/solar-technology/products/communication/communication-products-software/sunny-boy-control-plus/overview/index.html > On the other way, emulated serial port is not acting the same as real > one. Is this question for xen developers? Can I try anything else?Maybe you could install a Windows in a pure qemu system and do a try to check where the problem lives ;-) -- Otavio Salvador O.S. Systems E-mail: otavio@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ulrich Windl
2007-Feb-12 08:17 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
On 10 Feb 2007 at 10:13, Ales Rom wrote:> On the other way, emulated serial port is not acting the same as real > one. Is this question for xen developers? Can I try anything else? >The timing for the serial port at high baud rates can be critical (that is, you may miss received characters, or you may not fill the UART''s transmit buffer in time). That''s why I suggested to try a fault-tolerant transfer protocol like kermit: Youz can disconnect the cable, then reconnect it, and the transfer will continue (much like TCP). I know that there are "industry style" protocols around that are not fault tolerant like that. I had real trouble upgrading the firmware of a GPS unit via serial cable, completely without XEN: One bad character, and the unit had to be powered off and on again. That bad thing was that exactly that power cycle placed on invalid character in the PC''s receive buffer, and the protocol failed. Hard life, this life ;-) Ulrich _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Aleš Rom
2007-Feb-19 20:20 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
Petersson, Mats pravi:> > > >> -----Original Message----- >> From: xen-users-bounces@lists.xensource.com >> [mailto:xen-users-bounces@lists.xensource.com] On Behalf Of Aleš Rom >> Sent: 08 February 2007 12:55 >> To: xen-users@lists.xensource.com >> Subject: [Xen-users] Is Xen and Qemu serial driver code related ? >> >> Hi. >> >> A noticed a very strange thing. A few weeks ago I installed WindowsXP >> under qemu. I have serial device attached to COM1 port and >> comunication >> works. >> Basicaly I have to download a few hundred bytes from that >> serial device >> to computer. Every time comunication stops at 83% (5/6). >> >> The weird thing is, that when I use Xen, I can see exactly >> same thing. >> Stops at 83%. Is this related or just coincidence? Is it my >> hardware? >> Windows on "real" hardware doesn''t have this problem. >> > > Sounds like it could be the same problem - Xen in HVM mode uses QEMU (a slightly modified source that builds the binary called qemu-dm, which lives in /usr/lib{64}/xen/bin or some such) to emulate the hardware in the guest. Serial port(s) is part of this emulated hardware. > > However, it could be "just about anything". If it''s caused by the software, it would probably help to "log" the serial comms somehow (I''ve successfully written code to take two serial ports on a machine and "copy" the data from one port to the other, making it a "logging station", but there may be other ways to do it, for example let qemu dump the serial port data onto a file - probably requires a little bit of hacking in qemu, but not terribly hard work, if you know a bit about programming). A good place to start this would be in ".../tools/ioemu/hw/serial.c" - the functons serial_ioport_write() and serial_ioport_read(), particularly "addr 0", which is the "data" address. Here''s what I would add: > New variable around the beginning of serial.c (after the #include statements): > FILE *serial_log; > In serial_init() add: > serial_log = fopen("/tmp/serial.log", "w"); > if (serial_log == NULL) { > fprintf(logfile, "Failed to open /tmp/serial.log"); > exit(1); > } > > In serial_ioport_write(): > At "case 0", just before the "break" add: > fprintf(serial_log, "TX: %02x\n", val); > > In serial_ioport_read(): > At "case 0", just before the "break" add: > fprintf(serial_log, "RX: %02x\n", ret); > > -- > Mats >Thanks Mats. I added these few lines in qemu source (xen was too much for me - sorry), rebuild and serial.log produced by qemu is here: http://www.p-rom.si/serial.log The last few lines before data download stops are: ... ... RX: 6f RX: 6e RX: 36 RX: 20 RX: 20 RX: 20 RX: 20 RX: It looks that the communication stops because there is no data from serial device? Aleš _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
ales.rom@kabelnet.net
2007-Feb-21 14:37 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
>>> >> Thanks Mats. I added these few lines in qemu source (xen was too much >> for me - sorry), rebuild and serial.log produced by qemu is here: >> http://www.p-rom.si/serial.log >> The last few lines before data download stops are: >> >> ... >> ... >> RX: 6f >> RX: 6e >> RX: 36 >> RX: 20 >> RX: 20 >> RX: 20 >> RX: 20 >> RX: > > Ah, you may want to add "fflush(serial_log);" at each instance of fprintf that you added, just to make sure the last bit of data is sent to the log-file! > > -- > MatsYes. The the new complete log is http://www.p-rom.si/serial_flush.log Basically we have to DL 60 packeges. (3C-00 hex) The PC sends 30 byte request with package number, and then data is received. But when the package 09 is requested, no data is received and communication stops. Aleš _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Trolle Selander
2007-Mar-01 13:59 UTC
Re: [Xen-users] Is Xen and Qemu serial driver code related ?
The serial emulation definitely seems to be broken at the moment, at least when the guest''s serial ports are tied to physical ones. Output from the guest -> phys port seems to work fine, but phys -> guest works in "spurts". A bunch of data will get through, then a very long stall, then another burst. Nothing''s getting lost, as far as I can see, however, so the recieved data is getting buffered somewhere, presumably inside qemu. I''ve seen this problem in both the latest xen-unstable code, and in the latest (0.9.0) release of standalone qemu. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users