From: Uri Lublin <uril-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: Shahar Livne <shahar-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: frozen winXP on kvm after savevm
Date: Sun, 19 Aug 2007 13:55:59 +0300 [thread overview]
Message-ID: <46C821BF.3030906@qumranet.com> (raw)
In-Reply-To: <46C7E3EC.3010406-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 4759 bytes --]
The attached patch should help.
Shahar Livne wrote:
> Hello list,
>
> I am running winXP English on the kvm, and sometimes after savevm when
> starting with loadvm - it starts frozen (the process takes 100% CPU and
> the target OS is not responsive).
>
> The command line to run qemu (while kvm-intel is loaded) that I use is:
>
> /usr/local/kvm/bin/qemu-system-x86_64 -hda winxp.qcow2 -L
> /usr/local/kvm/share/qemu/ -usbdevice tablet -no-rtc -m 256 -localtime
> -net none -vnc :0 -serial /dev/null -parallel /dev/null -monitor
> unix:/tmp/monitor-qemu.sock,server,nowait -S
>
> Then I send commands to the monitor, the moment it is available:
> loadvm 1
> cont
>
> And after few mouse moves and clicks (using vncviewer) I save the vm:
> stop
> delvm 1
> savevm 1
> quit
>
> After 1-3 iterations of the above procedure, the system starts frozen.
>
>
>
> Remarks:
>
> 1. I currently use kvm-35
>
> 2. The symptom is the same when I start already with -loadvm 1 and
> without -S
>
> 3. I have tried to run it with -no-kvm and it seems _not_ to freeze (few
> tens of experiments).
>
> 4. I have tried with kvm, but without -usbdevice tablet and it seems
> _not_ to freeze.
>
> 5. The presence of this problem has been verified on kvm-28,32,33,35.
>
> 6. Once a qcow2 image gets frozen, running it again and again doesn't
> 'fix' the problem.
>
> 7. I had a workaround, that often worked - run loadvm 1 again. Then the
> system gets again operational. This method does not always work though.
>
> 8. Same problem happened with other windows OS (2000, and other
> languages) as well.
>
> 9. Nothing relevant in dmesg
>
>
> While frozen, I ran 'info cpus' few times on the monitor:
> info cpus
> (qemu) info cpus
> * CPU #0: pc=0x00000000806d5cbc
> * CPU #0: pc=0x00000000806d5cec
> * CPU #0: pc=0x00000000806d563c
> * CPU #0: pc=0x00000000806d57f9
> * CPU #0: pc=0x00000000806d5cec
> * CPU #0: pc=0x00000000f9c89f55
> * CPU #0: pc=0x00000000806d57f4
> * CPU #0: pc=0x0000000081719a54
> * CPU #0: pc=0x00000000806d57f4
> * CPU #0: pc=0x00000000806d5caa
> * CPU #0: pc=0x00000000806d5caa
> * CPU #0: pc=0x00000000806d5cf0
> * CPU #0: pc=0x00000000806d5cec
> * CPU #0: pc=0x00000000806d5caa
> * CPU #0: pc=0x00000000806d563c
> * CPU #0: pc=0x00000000806d563c
> * CPU #0: pc=0x00000000806d57f4
>
> I can see that some addresses repeat and it is kind of a loop, but I
> have no idea what part of winXP is running then. I could only guess that
> it has to do with usb, since the presence of -usbdevice tablet makes a
> difference.
> The whole problem is probably some race condition caused during savevm
> (qcow2) while kvm and usb devices are present.
>
> Running 'info registers' on the monitor few times gives a constant result:
>
> info registers
> EAX=00000062 EBX=00002002 ECX=00000012 EDX=80548dd8
> ESI=80551920 EDI=81719a18 EBP=80548de0 ESP=80548dc8
> EIP=806d5cf0 EFL=00000002 [-------] CPL=0 II=0 A20=1 SMM=0 HLT=0
> ES =0023 00000000 ffffffff 00c0f300
> CS =0008 00000000 ffffffff 00c09b00
> SS =0010 00000000 ffffffff 00c09300
> DS =0023 00000000 ffffffff 00c0f300
> FS =0030 ffdff000 00001fff 00c09300
> GS =0000 00000000 ffffffff 00000000
> LDT=0000 00000000 ffffffff 00000000
> TR =0028 80042000 000020ab 00008b00
> GDT= 8003f000 000003ff
> IDT= 8003f400 000007ff
> CR0=e001003b CR2=e10e8000 CR3=007db000 CR4=000006f8
> FCW=027f FSW=0120 [ST=0] FTW=00 MXCSR=00000000
> FPR0=0007502c00000000 0000 FPR1=00003d640000050b a3ae
> FPR2=00004ea90006c4ff c1a0 FPR3=0000000000005c11 519a
> FPR4=0007f86c00000ebe 0000 FPR5=0000000000000000 0000
> FPR6=ff7d000000000000 400e FPR7=ccc999999999a000 4019
> XMM00=607a604000000000000000007c9106eb
> XMM01=000000000000010f0000087100000f31
> XMM02=000000000000000000000000000003ad
> XMM03=00000000000000000000000000000000
> XMM04=00000c0a000002ff0000000000003911
> XMM05=0000012f00000000000001a400000000
> XMM06=000001620000000c000005180000000d
> XMM07=00000000000000000000000000000000
>
>
> Hardware:
> Intel(R) Xeon(R) CPU E5310 @ 1.60GHz (2*quad)
>
> Software:
> RedHat Enterprise 5
> Linux 2.6.18-8.1.6.el5 #1 SMP Fri Jun 1 18:52:13 EDT 2007 x86_64 x86_64
> x86_64 GNU/Linux
>
> Any idea of why it happens or how to avoid it?
>
> Regards,
>
> Shahar Livne
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>
[-- Attachment #2: usb_save_load.diff --]
[-- Type: text/x-patch, Size: 4539 bytes --]
commit 93f590514fa96dedc02274183fd1c57fcbba6fdc
Author: Uri Lublin <uril-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Date: Mon Jul 23 11:57:33 2007 +0300
migration: save/load usb devices (specifically mouse/tablet)
Taken (slightly modified) from xen (hg 14366:2955b0677310 Tim Deegan)
Signed-off-by: Uri Lublin <uril-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
diff --git a/qemu/hw/usb-hid.c b/qemu/hw/usb-hid.c
index bde3a7c..d24a959 100644
--- a/qemu/hw/usb-hid.c
+++ b/qemu/hw/usb-hid.c
@@ -510,6 +510,45 @@ static void usb_mouse_handle_destroy(USBDevice *dev)
qemu_free(s);
}
+void usb_mouse_save(QEMUFile *f, void *opaque)
+{
+ USBMouseState *s = (USBMouseState*)opaque;
+
+ qemu_put_be32s(f, &s->dx);
+ qemu_put_be32s(f, &s->dy);
+ qemu_put_be32s(f, &s->dz);
+ qemu_put_be32s(f, &s->buttons_state);
+ qemu_put_be32s(f, &s->x);
+ qemu_put_be32s(f, &s->y);
+ qemu_put_be32s(f, &s->kind);
+ qemu_put_be32s(f, &s->mouse_grabbed);
+
+}
+
+int usb_mouse_load(QEMUFile *f, void *opaque, int version_id)
+{
+ USBMouseState *s = (USBMouseState*)opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ qemu_get_be32s(f, &s->dx);
+ qemu_get_be32s(f, &s->dy);
+ qemu_get_be32s(f, &s->dz);
+ qemu_get_be32s(f, &s->buttons_state);
+ qemu_get_be32s(f, &s->x);
+ qemu_get_be32s(f, &s->y);
+ qemu_get_be32s(f, &s->kind);
+ qemu_get_be32s(f, &s->mouse_grabbed);
+
+ if ( s->kind == USB_TABLET)
+ qemu_add_mouse_event_handler(usb_tablet_event, s, 1, "QEMU USB Tablet");
+ else if ( s->kind == USB_MOUSE)
+ qemu_add_mouse_event_handler(usb_mouse_event, s, 0, "QEMU USB Mouse");
+ return 0;
+}
+
+
USBDevice *usb_tablet_init(void)
{
USBMouseState *s;
@@ -528,6 +567,8 @@ USBDevice *usb_tablet_init(void)
pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Tablet");
+ register_savevm("USB tablet dev", 0, 1, usb_mouse_save, usb_mouse_load, s);
+
return (USBDevice *)s;
}
@@ -549,5 +590,7 @@ USBDevice *usb_mouse_init(void)
pstrcpy(s->dev.devname, sizeof(s->dev.devname), "QEMU USB Mouse");
+ register_savevm("USB mouse dev", 0, 1, usb_mouse_save, usb_mouse_load, s);
+
return (USBDevice *)s;
}
diff --git a/qemu/hw/usb.c b/qemu/hw/usb.c
index efbc6db..04d9233 100644
--- a/qemu/hw/usb.c
+++ b/qemu/hw/usb.c
@@ -201,3 +201,43 @@ void usb_send_msg(USBDevice *dev, int msg)
dev->handle_packet(dev, &p);
}
+void generic_usb_save(QEMUFile* f, void *opaque)
+{
+ USBDevice *s = (USBDevice*)opaque;
+
+ qemu_put_be32s(f, &s->speed);
+ qemu_put_8s(f, &s->addr);
+ qemu_put_be32s(f, &s->state);
+
+ qemu_put_buffer(f, s->setup_buf, 8);
+ qemu_put_buffer(f, s->data_buf, 1024);
+
+ qemu_put_be32s(f, &s->remote_wakeup);
+ qemu_put_be32s(f, &s->setup_state);
+ qemu_put_be32s(f, &s->setup_len);
+ qemu_put_be32s(f, &s->setup_index);
+
+}
+
+int generic_usb_load(QEMUFile* f, void *opaque, int version_id)
+{
+ USBDevice *s = (USBDevice*)opaque;
+
+ if (version_id != 1)
+ return -EINVAL;
+
+ qemu_get_be32s(f, &s->speed);
+ qemu_get_8s(f, &s->addr);
+ qemu_get_be32s(f, &s->state);
+
+ qemu_get_buffer(f, s->setup_buf, 8);
+ qemu_get_buffer(f, s->data_buf, 1024);
+
+ qemu_get_be32s(f, &s->remote_wakeup);
+ qemu_get_be32s(f, &s->setup_state);
+ qemu_get_be32s(f, &s->setup_len);
+ qemu_get_be32s(f, &s->setup_index);
+
+ return 0;
+}
+
diff --git a/qemu/hw/usb.h b/qemu/hw/usb.h
index ed8890e..f2e6d3f 100644
--- a/qemu/hw/usb.h
+++ b/qemu/hw/usb.h
@@ -218,3 +218,8 @@ USBDevice *usb_tablet_init(void);
/* usb-msd.c */
USBDevice *usb_msd_init(const char *filename);
+
+/* usb.c */
+void generic_usb_save(QEMUFile* f, void *opaque);
+int generic_usb_load(QEMUFile* f, void *opaque, int version_id);
+
diff --git a/qemu/vl.c b/qemu/vl.c
index c795af2..f166b92 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -4023,6 +4023,7 @@ static int usb_device_add(const char *devname)
const char *p;
USBDevice *dev;
USBPort *port;
+ char usb_name[256] = "USB ";
if (!free_usb_ports)
return -1;
@@ -4059,6 +4060,12 @@ static int usb_device_add(const char *devname)
free_usb_ports = port->next;
port->next = used_usb_ports;
used_usb_ports = port;
+
+ pstrcpy(usb_name + strlen(usb_name),
+ sizeof(usb_name) - strlen(usb_name),
+ devname);
+ register_savevm(usb_name, 0, 1, generic_usb_save, generic_usb_load, dev);
+
usb_attach(port, dev);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 315 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
[-- Attachment #4: Type: text/plain, Size: 186 bytes --]
_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel
next prev parent reply other threads:[~2007-08-19 10:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-19 6:32 frozen winXP on kvm after savevm Shahar Livne
[not found] ` <46C7E3EC.3010406-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org>
2007-08-19 10:55 ` Uri Lublin [this message]
[not found] ` <46C821BF.3030906-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-19 11:30 ` Shahar Livne
-- strict thread matches above, loose matches on Subject: below --
2007-08-19 9:45 Shahar Livne
[not found] ` <46C81144.7080108-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org>
2007-08-19 9:55 ` Avi Kivity
[not found] ` <46C81397.6000508-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-19 10:14 ` Shahar Livne
[not found] ` <46C817F7.4010508-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org>
2007-08-19 10:22 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46C821BF.3030906@qumranet.com \
--to=uril-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=shahar-f4XOiQkOAtcdH0auuBZGHA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox