On Thu, May 14, 2015 at 05:35:31PM +0800, Wei Yang wrote: >On Wed, May 13, 2015 at 11:16:30AM +1000, Gavin Shan wrote: >>On Mon, May 04, 2015 at 03:07:38PM +0800, Wei Yang wrote: >> >> if (!edev->physfn) { >> pr_warn("%s: EEH dev %04x:%02x:%02x:%01x not for VF\n", >> edev->phb->global_number, pdn->busno, >> PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); >> return NULL; >> } >> >>>+ >>>+ driver = eeh_pcid_get(dev); >>>+ if (driver) { >>>+ eeh_pcid_put(dev); >>>+ if (driver->err_handler) >>>+ return NULL; >>>+ } >> >>dev and driver are NULL for those VFs that have been unplugged. For those >>VFs weren't unplugged, driver and err_handler should be valid. The code >>looks correct. However, for consistence, please use EEH_DEV_DISCONNECTED >>that has been marked to those EEH devices which were unplugged. Do you >>think it would be better? >> >> if (!(dev->flags & EEH_DEV_DISCONNECTED)) >> return NULL; >> > > >I think this is a nice idea, while this may not work. > >We mark the DISCONNECTED flag when remove a PCI device, while before we do the >hot plug we will detach it from the tree and remove this flag in >eeh_pe_detach_dev(). > >This will leads to the VF not be hot plugged. > Ok, the following way, with the original idea improved for a bit, would work for you: - Don't clear DISCONNECTED flag in eeh_pe_detach_dev(). - Use the flag for your case. - Clear DISCONNECTED flag after the hogplug is done, right before eeh_pe_state_clear(pe, EEH_PE_KEEP) in eeh_reset_device(). Thanks, Gavin -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html