Can't call pci_get_domain_bus_and_slot() from interupt context

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRp5IvAAoJEKurIx+X31iBGqMP/2aXdk0hBXKM76uCyYt1cn/X
 MibhCgX17L65BOvL19CB0Ylj+uAlgAw/0qzwMqP8eKgt1Unx0vzY5Pf0B1nOsHeF
 YQU2RAhu5Xw23sTSf3b9tRADki4n14pzhwfTzOSqY/a9JxeatoFElCyMjcXL5UaY
 hL96Ke1pvWZrAI3VT9tneH4AV0qfMajd7xSdCyS22+IdzcxEw/xln/SCXZieeFxE
 WQpNGGB/pSwJYnTU8nNJQdFLggO19Sa0v+rOZJzQ08BuKL1nJ6rlEZejk6T668So
 RJNlGTBTHdwMiH7HctUb9iYcTfyhGlZ+kxdq7puRtgKABbjMnzlSWpbJzIv/LSsm
 M0atocT9Se82V9g6g4lizEeBuwUjfv94GXrWlAtVgpi8KKpF0LOwMeeFvciFp96k
 p6hILjqiYVF+G9lP0Vkh1DPp9a2MfROLX0+GKZtuLjloZ0WJbqdOY8wHvFApsltL
 B5szN4TLLutQfHkfqH27MIDtFQmJe+tieMJ0EyfAJan4eigrlZu0iqw4tJkZWiHj
 yWIIgwaxFvZA639yWObVfk52nesjNuWNtVfKM+OjcUsR0O7UO9ZhcoI9Oew7lxqD
 XoEv4FgtPBFDz7Q659auUMrHx4cZ/STkxikUrLwQmR0QeR9nVW9OnGBGTsR8EKm+
 tymC0x7AYmnDJUPoZHqM
 =ToBG
 -----END PGP SIGNATURE-----

Merge tag 'please-pull-aertracefix' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras

Pull aer error logging fix from Tony Luck:
 "Can't call pci_get_domain_bus_and_slot() from interupt context"

* tag 'please-pull-aertracefix' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
  aerdrv: Move cper_print_aer() call out of interrupt context
This commit is contained in:
Linus Torvalds 2013-06-01 06:47:04 +09:00
commit 977b55cf98
5 changed files with 12 additions and 24 deletions

View file

@ -250,10 +250,6 @@ static const char *cper_pcie_port_type_strs[] = {
static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie, static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
const struct acpi_hest_generic_data *gdata) const struct acpi_hest_generic_data *gdata)
{ {
#ifdef CONFIG_ACPI_APEI_PCIEAER
struct pci_dev *dev;
#endif
if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE) if (pcie->validation_bits & CPER_PCIE_VALID_PORT_TYPE)
printk("%s""port_type: %d, %s\n", pfx, pcie->port_type, printk("%s""port_type: %d, %s\n", pfx, pcie->port_type,
pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ? pcie->port_type < ARRAY_SIZE(cper_pcie_port_type_strs) ?
@ -285,20 +281,6 @@ static void cper_print_pcie(const char *pfx, const struct cper_sec_pcie *pcie,
printk( printk(
"%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n", "%s""bridge: secondary_status: 0x%04x, control: 0x%04x\n",
pfx, pcie->bridge.secondary_status, pcie->bridge.control); pfx, pcie->bridge.secondary_status, pcie->bridge.control);
#ifdef CONFIG_ACPI_APEI_PCIEAER
dev = pci_get_domain_bus_and_slot(pcie->device_id.segment,
pcie->device_id.bus, pcie->device_id.function);
if (!dev) {
pr_err("PCI AER Cannot get PCI device %04x:%02x:%02x.%d\n",
pcie->device_id.segment, pcie->device_id.bus,
pcie->device_id.slot, pcie->device_id.function);
return;
}
if (pcie->validation_bits & CPER_PCIE_VALID_AER_INFO)
cper_print_aer(pfx, dev, gdata->error_severity,
(struct aer_capability_regs *) pcie->aer_info);
pci_dev_put(dev);
#endif
} }
static const char *apei_estatus_section_flag_strs[] = { static const char *apei_estatus_section_flag_strs[] = {

View file

@ -454,7 +454,9 @@ static void ghes_do_proc(struct ghes *ghes,
aer_severity = cper_severity_to_aer(sev); aer_severity = cper_severity_to_aer(sev);
aer_recover_queue(pcie_err->device_id.segment, aer_recover_queue(pcie_err->device_id.segment,
pcie_err->device_id.bus, pcie_err->device_id.bus,
devfn, aer_severity); devfn, aer_severity,
(struct aer_capability_regs *)
pcie_err->aer_info);
} }
} }

View file

@ -580,6 +580,7 @@ struct aer_recover_entry
u8 devfn; u8 devfn;
u16 domain; u16 domain;
int severity; int severity;
struct aer_capability_regs *regs;
}; };
static DEFINE_KFIFO(aer_recover_ring, struct aer_recover_entry, static DEFINE_KFIFO(aer_recover_ring, struct aer_recover_entry,
@ -593,7 +594,7 @@ static DEFINE_SPINLOCK(aer_recover_ring_lock);
static DECLARE_WORK(aer_recover_work, aer_recover_work_func); static DECLARE_WORK(aer_recover_work, aer_recover_work_func);
void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
int severity) int severity, struct aer_capability_regs *aer_regs)
{ {
unsigned long flags; unsigned long flags;
struct aer_recover_entry entry = { struct aer_recover_entry entry = {
@ -601,6 +602,7 @@ void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
.devfn = devfn, .devfn = devfn,
.domain = domain, .domain = domain,
.severity = severity, .severity = severity,
.regs = aer_regs,
}; };
spin_lock_irqsave(&aer_recover_ring_lock, flags); spin_lock_irqsave(&aer_recover_ring_lock, flags);
@ -627,6 +629,7 @@ static void aer_recover_work_func(struct work_struct *work)
PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn));
continue; continue;
} }
cper_print_aer(pdev, entry.severity, entry.regs);
do_recovery(pdev, entry.severity); do_recovery(pdev, entry.severity);
pci_dev_put(pdev); pci_dev_put(pdev);
} }

View file

@ -220,7 +220,7 @@ int cper_severity_to_aer(int cper_severity)
} }
EXPORT_SYMBOL_GPL(cper_severity_to_aer); EXPORT_SYMBOL_GPL(cper_severity_to_aer);
void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, void cper_print_aer(struct pci_dev *dev, int cper_severity,
struct aer_capability_regs *aer) struct aer_capability_regs *aer)
{ {
int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0; int aer_severity, layer, agent, status_strs_size, tlp_header_valid = 0;
@ -244,7 +244,7 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity,
agent = AER_GET_AGENT(aer_severity, status); agent = AER_GET_AGENT(aer_severity, status);
dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n", dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
status, mask); status, mask);
cper_print_bits(prefix, status, status_strs, status_strs_size); cper_print_bits("", status, status_strs, status_strs_size);
dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n", dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n",
aer_error_layer[layer], aer_agent_string[agent]); aer_error_layer[layer], aer_agent_string[agent]);
if (aer_severity != AER_CORRECTABLE) if (aer_severity != AER_CORRECTABLE)

View file

@ -49,10 +49,11 @@ static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
} }
#endif #endif
extern void cper_print_aer(const char *prefix, struct pci_dev *dev, extern void cper_print_aer(struct pci_dev *dev,
int cper_severity, struct aer_capability_regs *aer); int cper_severity, struct aer_capability_regs *aer);
extern int cper_severity_to_aer(int cper_severity); extern int cper_severity_to_aer(int cper_severity);
extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, extern void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
int severity); int severity,
struct aer_capability_regs *aer_regs);
#endif //_AER_H_ #endif //_AER_H_