"-serial unix:" option of qemu-system-arm is broken in qemu 2.6.0
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Daniel Berrange |
Bug Description
I found a bug of "-serial unix:PATH_
Occasionally, a part of the output of qemu disappears in the bug.
It looks like following commit is the cause:
char: ensure all clients are in non-blocking mode (Author: Daniel P. Berrange <email address hidden>)
http://
In this commit, UNIX socket is set to non-blocking mode, but qemu_chr_fe_write function doesn't handle EAGAIN.
You should fix code like that:
---
diff --git a/qemu-char.c b/qemu-char.c
index b597ee1..0361d78 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -270,6 +270,7 @@ static int qemu_chr_
int qemu_chr_
{
int ret;
+ int offset = 0;
if (s->replay && replay_mode == REPLAY_MODE_PLAY) {
int offset;
@@ -280,7 +281,21 @@ int qemu_chr_
}
qemu_
- ret = s->chr_write(s, buf, len);
+
+ while (offset < len) {
+ retry:
+ ret = s->chr_write(s, buf, len);
+ if (ret < 0 && errno == EAGAIN) {
+ g_usleep(100);
+ goto retry;
+ }
+
+ if (ret <= 0) {
+ break;
+ }
+
+ offset += ret;
+ }
if (ret > 0) {
---
Or please do "git revert 64c800f80874852
Changed in qemu: | |
assignee: | nobody → Daniel Berrange (berrange) |
summary: |
- "-serial unix:" option of qemu-system-* is broken in qemu 2.6.0 + "-serial unix:" option of qemu-system-arm is broken in qemu 2.6.0 |
I'm unable to reproduce the problem mentioned myself, and code inspection shows no problem for x86_64 at least.
Specifically hw/char/serial.c has a serial_xmit() method which calls qemu_chr_ fe_write( ), and if it sees EAGAIN, it sets up a event notification to re-try the write later.
Can you provide the full QEMU command line you are using, include the emulator binary.