From: Nigel Cunningham <ncunningham@cyclades.com>
To: Linux PM <linux-pm@osdl.org>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Complain if driver reenables interrupts during drivers_[suspend|resume] & re-disable
Date: Tue, 7 Feb 2006 19:06:48 +1000 [thread overview]
Message-ID: <200602071906.55281.ncunningham@cyclades.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 4687 bytes --]
Hi all.
This patch is designed to help with diagnosing and fixing the cause of
problems in suspending/resuming, due to drivers wrongly re-enabling
interrupts in their .suspend or .resume methods.
I nearly forgot about it in sending patches in suspend2 that might help
where swsusp fails.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
power/resume.c | 5 +++++
power/suspend.c | 5 +++++
sys.c | 37 +++++++++++++++++++++++++++++++++++--
3 files changed, 45 insertions(+), 2 deletions(-)
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/power/resume.c
8010-driver-model-debug.patch-new/drivers/base/power/resume.c
--- 8010-driver-model-debug.patch-old/drivers/base/power/resume.c
2006-01-19 21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/power/resume.c
2006-01-31 19:54:52.000000000 +1000
@@ -35,6 +35,11 @@ int resume_device(struct device * dev)
if (dev->bus && dev->bus->resume) {
dev_dbg(dev,"resuming\n");
error = dev->bus->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming device
%s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
}
up(&dev->sem);
return error;
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/power/suspend.c
8010-driver-model-debug.patch-new/drivers/base/power/suspend.c
--- 8010-driver-model-debug.patch-old/drivers/base/power/suspend.c
2006-01-19 21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/power/suspend.c
2006-01-31 19:54:44.000000000 +1000
@@ -58,6 +58,11 @@ int suspend_device(struct device * dev,
if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
dev_dbg(dev, "suspending\n");
error = dev->bus->suspend(dev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
device %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
}
up(&dev->sem);
return error;
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/sys.c
8010-driver-model-debug.patch-new/drivers/base/sys.c
--- 8010-driver-model-debug.patch-old/drivers/base/sys.c 2006-01-19
21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/sys.c 2006-01-31
19:54:09.000000000 +1000
@@ -298,16 +298,34 @@ static void __sysdev_resume(struct sys_d
if (cls->resume)
cls->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
class specific driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+
/* Call auxillary drivers next. */
list_for_each_entry(drv, &cls->drivers, entry) {
- if (drv->resume)
+ if (drv->resume) {
drv->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
class driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+ }
}
/* Call global drivers. */
list_for_each_entry(drv, &sysdev_drivers, entry) {
- if (drv->resume)
+ if (drv->resume) {
drv->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+ }
}
}
@@ -346,6 +364,11 @@ int sysdev_suspend(pm_message_t state)
list_for_each_entry(drv, &sysdev_drivers, entry) {
if (drv->suspend) {
ret = drv->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
sysdev driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto gbl_driver;
}
@@ -355,6 +378,11 @@ int sysdev_suspend(pm_message_t state)
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->suspend) {
ret = drv->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
sysdev class driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto aux_driver;
}
@@ -363,6 +391,11 @@ int sysdev_suspend(pm_message_t state)
/* Now call the generic one */
if (cls->suspend) {
ret = cls->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
class driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto cls_driver;
}
[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Nigel Cunningham <ncunningham@cyclades.com>
To: Linux PM <linux-pm@osdl.org>,
linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] Complain if driver reenables interrupts during drivers_[suspend|resume] & re-disable
Date: Tue, 7 Feb 2006 19:06:48 +1000 [thread overview]
Message-ID: <200602071906.55281.ncunningham@cyclades.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4687 bytes --]
Hi all.
This patch is designed to help with diagnosing and fixing the cause of
problems in suspending/resuming, due to drivers wrongly re-enabling
interrupts in their .suspend or .resume methods.
I nearly forgot about it in sending patches in suspend2 that might help
where swsusp fails.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
power/resume.c | 5 +++++
power/suspend.c | 5 +++++
sys.c | 37 +++++++++++++++++++++++++++++++++++--
3 files changed, 45 insertions(+), 2 deletions(-)
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/power/resume.c
8010-driver-model-debug.patch-new/drivers/base/power/resume.c
--- 8010-driver-model-debug.patch-old/drivers/base/power/resume.c
2006-01-19 21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/power/resume.c
2006-01-31 19:54:52.000000000 +1000
@@ -35,6 +35,11 @@ int resume_device(struct device * dev)
if (dev->bus && dev->bus->resume) {
dev_dbg(dev,"resuming\n");
error = dev->bus->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming device
%s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
}
up(&dev->sem);
return error;
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/power/suspend.c
8010-driver-model-debug.patch-new/drivers/base/power/suspend.c
--- 8010-driver-model-debug.patch-old/drivers/base/power/suspend.c
2006-01-19 21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/power/suspend.c
2006-01-31 19:54:44.000000000 +1000
@@ -58,6 +58,11 @@ int suspend_device(struct device * dev,
if (dev->bus && dev->bus->suspend && !dev->power.power_state.event) {
dev_dbg(dev, "suspending\n");
error = dev->bus->suspend(dev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
device %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
}
up(&dev->sem);
return error;
diff -ruNp 8010-driver-model-debug.patch-old/drivers/base/sys.c
8010-driver-model-debug.patch-new/drivers/base/sys.c
--- 8010-driver-model-debug.patch-old/drivers/base/sys.c 2006-01-19
21:27:39.000000000 +1000
+++ 8010-driver-model-debug.patch-new/drivers/base/sys.c 2006-01-31
19:54:09.000000000 +1000
@@ -298,16 +298,34 @@ static void __sysdev_resume(struct sys_d
if (cls->resume)
cls->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
class specific driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+
/* Call auxillary drivers next. */
list_for_each_entry(drv, &cls->drivers, entry) {
- if (drv->resume)
+ if (drv->resume) {
drv->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
class driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+ }
}
/* Call global drivers. */
list_for_each_entry(drv, &sysdev_drivers, entry) {
- if (drv->resume)
+ if (drv->resume) {
drv->resume(dev);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while resuming sysdev
driver %s.\n",
+ kobject_name(&dev->kobj));
+ local_irq_disable();
+ }
+ }
}
}
@@ -346,6 +364,11 @@ int sysdev_suspend(pm_message_t state)
list_for_each_entry(drv, &sysdev_drivers, entry) {
if (drv->suspend) {
ret = drv->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
sysdev driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto gbl_driver;
}
@@ -355,6 +378,11 @@ int sysdev_suspend(pm_message_t state)
list_for_each_entry(drv, &cls->drivers, entry) {
if (drv->suspend) {
ret = drv->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
sysdev class driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto aux_driver;
}
@@ -363,6 +391,11 @@ int sysdev_suspend(pm_message_t state)
/* Now call the generic one */
if (cls->suspend) {
ret = cls->suspend(sysdev, state);
+ if (!irqs_disabled()) {
+ printk(KERN_EMERG "WARNING: Interrupts reenabled while suspending
class driver %s.\n",
+ kobject_name(&sysdev->kobj));
+ local_irq_disable();
+ }
if (ret)
goto cls_driver;
}
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next reply other threads:[~2006-02-07 9:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-07 9:06 Nigel Cunningham [this message]
2006-02-07 9:06 ` [PATCH] Complain if driver reenables interrupts during drivers_[suspend|resume] & re-disable Nigel Cunningham
2006-02-07 23:59 ` Russell King
2006-02-07 23:59 ` Russell King
2006-02-08 3:47 ` Benjamin Herrenschmidt
2006-02-08 3:47 ` Benjamin Herrenschmidt
2006-02-08 5:40 ` Dmitry Torokhov
2006-02-08 5:40 ` Dmitry Torokhov
2006-02-08 6:46 ` Rafael J. Wysocki
2006-02-08 6:46 ` Rafael J. Wysocki
2006-02-08 23:58 ` Nigel Cunningham
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=200602071906.55281.ncunningham@cyclades.com \
--to=ncunningham@cyclades.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@osdl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.