aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Shan <gwshan@linux.vnet.ibm.com>2016-06-16 23:05:11 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-06-17 05:51:47 -0400
commita3aa256b7258b3d19f8b44557cc64525a993b941 (patch)
treee4041e60841311d7f5a5a3ac7d9fac34e1bc5080
parentb23d9c5b9c83c05e013aa52460f12a8365062cf4 (diff)
powerpc/eeh: Fix invalid cached PE primary bus
The PE primary bus cannot be got from its child devices when having full hotplug in error recovery. The PE primary bus is cached, which is done in commit <05ba75f84864> ("powerpc/eeh: Fix stale cached primary bus"). In eeh_reset_device(), the flag (EEH_PE_PRI_BUS) is cleared before the PCI hot remove. eeh_pe_bus_get() then returns NULL as the PE primary bus in pnv_eeh_reset() and it crashes the kernel eventually. This fixes the issue by clearing the flag (EEH_PE_PRI_BUS) before the PCI hot add. With it, the PowerNV EEH reset backend (pnv_eeh_reset()) can get valid PE primary bus through eeh_pe_bus_get(). Fixes: 67086e32b564 ("powerpc/eeh: powerpc/eeh: Support error recovery for VF PE") Reported-by: Pridhiviraj Paidipeddi <ppaiddipe@in.ibm.com> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/kernel/eeh_driver.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c
index 2714a3b81d24..b5f73cb5eeb6 100644
--- a/arch/powerpc/kernel/eeh_driver.c
+++ b/arch/powerpc/kernel/eeh_driver.c
@@ -642,7 +642,6 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
642 if (pe->type & EEH_PE_VF) { 642 if (pe->type & EEH_PE_VF) {
643 eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL); 643 eeh_pe_dev_traverse(pe, eeh_rmv_device, NULL);
644 } else { 644 } else {
645 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS);
646 pci_lock_rescan_remove(); 645 pci_lock_rescan_remove();
647 pci_hp_remove_devices(bus); 646 pci_hp_remove_devices(bus);
648 pci_unlock_rescan_remove(); 647 pci_unlock_rescan_remove();
@@ -692,10 +691,12 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus,
692 */ 691 */
693 edev = list_first_entry(&pe->edevs, struct eeh_dev, list); 692 edev = list_first_entry(&pe->edevs, struct eeh_dev, list);
694 eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL); 693 eeh_pe_traverse(pe, eeh_pe_detach_dev, NULL);
695 if (pe->type & EEH_PE_VF) 694 if (pe->type & EEH_PE_VF) {
696 eeh_add_virt_device(edev, NULL); 695 eeh_add_virt_device(edev, NULL);
697 else 696 } else {
697 eeh_pe_state_clear(pe, EEH_PE_PRI_BUS);
698 pci_hp_add_devices(bus); 698 pci_hp_add_devices(bus);
699 }
699 } else if (frozen_bus && rmv_data->removed) { 700 } else if (frozen_bus && rmv_data->removed) {
700 pr_info("EEH: Sleep 5s ahead of partial hotplug\n"); 701 pr_info("EEH: Sleep 5s ahead of partial hotplug\n");
701 ssleep(5); 702 ssleep(5);