From: "Denis V. Lunev" <den@openvz.org>
To: dev@openvz.org, gregkh@suse.de, akpm@linux-foundation.org
Cc: devel@openvz.org, linux-kernel@vger.kernel.org
Subject: [PATCH] pci_get_device call from interrupt in reboot fixups
Date: Fri, 3 Aug 2007 14:39:24 +0400 [thread overview]
Message-ID: <20070803103924.GA23786@iris.sw.ru> (raw)
The following calltrace is possible now:
handle_sysrq
machine_emergency_restart
mach_reboot_fixups
pci_get_device
pci_get_subsys
down_read
The patch obtains PCI device during initialization to avoid bothering PCI
search engine in interrupt. Devices used in this code are not supposed to
be pluggable, so it looks safe to keep them.
Signed-off-by: Denis V. Lunev <den@openvz.org>
---
diff --git a/arch/i386/kernel/reboot_fixups.c b/arch/i386/kernel/reboot_fixups.c
index 03e1cce..873ad55 100644
--- a/arch/i386/kernel/reboot_fixups.c
+++ b/arch/i386/kernel/reboot_fixups.c
@@ -37,6 +37,7 @@ struct device_fixup {
unsigned int vendor;
unsigned int device;
void (*reboot_fixup)(struct pci_dev *);
+ struct pci_dev *dev;
};
static struct device_fixup fixups_table[] = {
@@ -49,20 +50,35 @@ static struct device_fixup fixups_table[] = {
* is a fixup, we call it and we expect to never return from it. if we
* do return, we keep looking and then eventually fall back to the
* standard mach_reboot on return.
+ *
+ * Unfortunately, this code can be called from an interrupt and it is
+ * impossible to get PCI device directly. So, lets prepare the list
+ * beforehand.
*/
void mach_reboot_fixups(void)
{
struct device_fixup *cur;
- struct pci_dev *dev;
int i;
for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
cur = &(fixups_table[i]);
- dev = pci_get_device(cur->vendor, cur->device, NULL);
- if (!dev)
+ if (cur->dev == NULL)
continue;
- cur->reboot_fixup(dev);
+ cur->reboot_fixup(cur->dev);
+ }
+}
+
+int mach_fixup_init(void)
+{
+ struct device_fixup *cur;
+ int i;
+
+ for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
+ cur = &(fixups_table[i]);
+ cur->dev = pci_get_device(cur->vendor, cur->device, NULL);
}
+ return 0;
}
+module_init(mach_fixup_init);
next reply other threads:[~2007-08-03 11:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 10:39 Denis V. Lunev [this message]
2007-08-04 4:08 ` [PATCH] pci_get_device call from interrupt in reboot fixups Greg KH
2007-08-06 7:16 ` Denis V. Lunev
2007-08-07 2:49 ` Greg KH
2007-08-07 7:24 ` Andrew Morton
2007-08-07 7:44 ` Andrew Morton
2007-08-07 7:42 ` Greg KH
2007-08-07 7:50 ` Denis V. Lunev
2007-08-07 7:48 ` Denis V. Lunev
2007-08-06 20:03 ` Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2007-08-07 9:04 Denis V. Lunev
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=20070803103924.GA23786@iris.sw.ru \
--to=den@openvz.org \
--cc=akpm@linux-foundation.org \
--cc=dev@openvz.org \
--cc=devel@openvz.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.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