Re: Machine crashes right *after* ~successful resume

From: Yinghai Lu
Date: Thu Oct 30 2014 - 12:57:46 EST


On Thu, Oct 30, 2014 at 3:36 AM, Wilmer van der Gaast <wilmer@xxxxxxxxx> wrote:

> Sadly, with that patch (applied against a vanilla 3.17 tree like all the> others) the second resume fails already. :-(

oh, no. Really want to know which bit causes the problem.

Please check debug patch...that will print out pci conf space before
...and after...
Subject: [PATCH] pci: print out about pci=dump

debug print out before later driver hang

Signed-off-by: Yinghai Lu <yinghai@xxxxxxxxxx>

---
drivers/pci/pci.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -3858,6 +3858,54 @@ void __weak pci_fixup_cardbus(struct pci
}
EXPORT_SYMBOL(pci_fixup_cardbus);

+static void dump_pci_device_range(struct pci_dev *dev, unsigned start_reg,
+ unsigned size)
+{
+ int i;
+ int j;
+ u32 val;
+ int end = start_reg + size;
+
+ printk(KERN_DEBUG "PCI: %s", pci_name(dev));
+
+ for (i = start_reg; i < end; i += 4) {
+ if (!(i & 0x0f))
+ printk("\n%04x:", i);
+
+ pci_read_config_dword(dev, i, &val);
+ for (j = 0; j < 4; j++) {
+ printk(" %02x", val & 0xff);
+ val >>= 8;
+ }
+ }
+ printk("\n");
+}
+
+static int dump_pci_devices(void)
+{
+ struct pci_dev *dev = NULL;
+
+ while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
+ dump_pci_device_range(dev, 0, dev->cfg_size);
+
+ return 0;
+}
+
+static int pci_dump_regs;
+static void pci_dump(void)
+{
+ pci_dump_regs = 1;
+}
+
+static int pci_init(void)
+{
+ if (pci_dump_regs)
+ dump_pci_devices();
+
+ return 0;
+}
+device_initcall(pci_init);
+
static int __init pci_setup(char *str)
{
while (str) {
@@ -3865,7 +3913,9 @@ static int __init pci_setup(char *str)
if (k)
*k++ = 0;
if (*str && (str = pcibios_setup(str)) && *str) {
- if (!strcmp(str, "nomsi")) {
+ if (!strcmp(str, "dump")) {
+ pci_dump();
+ } else if (!strcmp(str, "nomsi")) {
pci_no_msi();
} else if (!strcmp(str, "noaer")) {
pci_no_aer();
---
drivers/pci/pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Index: linux-2.6/drivers/pci/pci.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci.c
+++ linux-2.6/drivers/pci/pci.c
@@ -1265,6 +1265,20 @@ static void pci_enable_bridge(struct pci
pci_set_master(dev);
}

+static int dump_pci_devices(void);
+
+static void pci_enable_ite(struct pci_dev *dev)
+{
+ pr_info("before...\n");
+ dump_pci_devices();
+
+ pci_enable_bridge(dev);
+
+ pr_info("after...\n");
+ dump_pci_devices();
+}
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ITE, 0x8892, pci_enable_ite);
+
static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
{
struct pci_dev *bridge;