powerpc/eeh: Clean up EEH PEs after recovery finishes
When the last device in an eeh_pe is removed the eeh_pe structure itself (and any empty parents) are freed since they are no longer needed. This results in a crash when a hotplug driver is involved since the following may occur: 1. Device is suprise removed. 2. Driver performs an MMIO, which fails and queues and eeh_event. 3. Hotplug driver receives a hotplug interrupt and removes any pci_devs that were under the slot. 4. pci_dev is torn down and the eeh_pe is freed. 5. The EEH event handler thread processes the eeh_event and crashes since the eeh_pe pointer in the eeh_event structure is no longer valid. Crashing is generally considered poor form. Instead of doing that use the fact PEs are marked as EEH_PE_INVALID to keep them around until the end of the recovery cycle, at which point we can safely prune any empty PEs. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20190903101605.2890-2-oohall@gmail.com
This commit is contained in:

کامیت شده توسط
Michael Ellerman

والد
9b123d1ea2
کامیت
799abe283e
@@ -121,6 +121,14 @@ int __eeh_send_failure_event(struct eeh_pe *pe)
|
||||
}
|
||||
event->pe = pe;
|
||||
|
||||
/*
|
||||
* Mark the PE as recovering before inserting it in the queue.
|
||||
* This prevents the PE from being free()ed by a hotplug driver
|
||||
* while the PE is sitting in the event queue.
|
||||
*/
|
||||
if (pe)
|
||||
eeh_pe_state_mark(pe, EEH_PE_RECOVERING);
|
||||
|
||||
/* We may or may not be called in an interrupt context */
|
||||
spin_lock_irqsave(&eeh_eventlist_lock, flags);
|
||||
list_add(&event->list, &eeh_eventlist);
|
||||
|
مرجع در شماره جدید
Block a user