public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Katz <katzj-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Oops after resume from suspend
Date: Thu, 25 Jan 2007 15:09:05 -0500	[thread overview]
Message-ID: <45B90E61.2090304@redhat.com> (raw)
In-Reply-To: <45B86338.8050306-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1082 bytes --]

Avi Kivity wrote:
> Jeremy Katz wrote:
>> When using kvm on my laptop, I get the following oops if I try using kvm
>> after a suspend (ACPI S3)/resume cycle.  At first I thought it went away
>> if I unloaded the module before suspending and then reloading it
>> afterwards, but I can't reproduce that working now, so I might have just
>> been hallucinating.  Thoughts of things to try?
> 
> Module unload/reload should work.  Can you try adding printks in 
> hardware_disable() and hardware_enable()?

Okay, what was going wrong with reloading was the difference between - 
and _ with module naming :-/  *sigh*  Actually getting the module 
unloaded then makes things work fine.

> For real suspend support, we need to flush any cached state on Intel 
> cpus (vmcs_clear), and to do the hardware_disable()/hardware_enable() 
> cycle.  Should be easy.

The obvious approach (attached) fails to resume -- there may be console 
output, but hard to tell on my laptop.  I'll dig up a box with a serial 
port to try there and see if I get something across serial console with it.

Jeremy

[-- Attachment #2: kvm-suspend.patch --]
[-- Type: text/x-patch, Size: 1646 bytes --]

Index: kvm_main.c
===================================================================
--- kvm_main.c	(revision 4328)
+++ kvm_main.c	(working copy)
@@ -26,6 +26,7 @@
 #include <asm/msr.h>
 #include <linux/mm.h>
 #include <linux/miscdevice.h>
+#include <linux/sysdev.h>
 #include <linux/vmalloc.h>
 #include <asm/uaccess.h>
 #include <linux/reboot.h>
@@ -2052,6 +2053,29 @@
 	.priority = 0,
 };
 
+static int kvm_suspend(struct sys_device *dev, pm_message_t state)
+{
+    on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1);
+    return 0;
+}
+
+static int kvm_resume(struct sys_device *dev)
+{
+    on_each_cpu(kvm_arch_ops->hardware_enable, 0, 0, 1);
+    return 0;
+}
+
+static struct sysdev_class kvm_sysclass = {
+	.resume = kvm_resume,
+	.suspend = kvm_suspend,
+	set_kset_name("kvm"),
+};
+
+static struct sys_device kvm_sysdevice = {
+        .id = 0,
+        .cls = &kvm_sysclass,
+};
+
 static __init void kvm_init_debug(void)
 {
 	struct kvm_stats_debugfs_item *p;
@@ -2100,6 +2124,13 @@
 	on_each_cpu(kvm_arch_ops->hardware_enable, 0, 0, 1);
 	register_reboot_notifier(&kvm_reboot_notifier);
 
+        r = sysdev_class_register(&kvm_sysclass);
+        if (r)
+            return r;
+        r = sysdev_register(&kvm_sysdevice);
+        if (r)
+            return r;
+
 	kvm_chardev_ops.owner = module;
 
 	r = misc_register(&kvm_dev);
@@ -2121,6 +2152,9 @@
 {
 	misc_deregister(&kvm_dev);
 
+        sysdev_unregister(&kvm_sysdevice);
+        sysdev_class_unregister(&kvm_sysclass);
+
 	unregister_reboot_notifier(&kvm_reboot_notifier);
 	on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1);
 	kvm_arch_ops->hardware_unsetup();

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- 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

  parent reply	other threads:[~2007-01-25 20:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-24 22:01 Oops after resume from suspend Jeremy Katz
     [not found] ` <1169676112.10817.13.camel-T9xAYgMuJli44ywRPIzf9A@public.gmane.org>
2007-01-24 22:14   ` Dor Laor
2007-01-24 22:22   ` Anthony Liguori
2007-01-25  1:43   ` dormando
2007-01-25  7:58   ` Avi Kivity
     [not found]     ` <45B86338.8050306-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-01-25 20:09       ` Jeremy Katz [this message]
     [not found]         ` <45B90E61.2090304-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-01-26 18:12           ` 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=45B90E61.2090304@redhat.com \
    --to=katzj-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@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