Re: [PATCH v13 6/6] PCI/DPC: Do not do recovery for hotplug enabled system
From: Sinan Kaya
Date: Thu Apr 12 2018 - 13:41:36 EST
On 4/12/2018 1:09 PM, Keith Busch wrote:
> On Thu, Apr 12, 2018 at 12:27:20PM -0400, Sinan Kaya wrote:
>> On 4/12/2018 11:02 AM, Keith Busch wrote:
>>>
>>> Also, I thought the plan was to keep hotplug and non-hotplug the same,
>>> except for the very end: if not a hotplug bridge, initiate the rescan
>>> automatically after releasing from containment, otherwise let pciehp
>>> handle it when the link reactivates.
>>>
>>
>> Hmm...
>>
>> AER driver doesn't do stop and rescan approach for fatal errors. AER driver
>> makes an error callback followed by secondary bus reset and finally driver
>> the resume callback on the endpoint only if link recovery is successful.
>> Otherwise, AER driver bails out with recovery unsuccessful message.
>
> I'm not sure if that's necessarily true. People have reported AER
> handling triggers PCIe hotplug events, and creates some interesting race
> conditions:
By reading the code, I don't see a stop and rescan in the AER error recovery
path.
As both logs indicate, stop and rescan is initiated in response to link down
and link up interrupts triggered by the secondary bus reset.
The SW entity handling these is not AER driver. It is the hotplug driver
running asynchronous to the AER driver.
AER driver should have tried a slot reset before attempting to do a secondary
bus reset.
/**
* pci_reset_slot - reset a PCI slot
* @slot: PCI slot to reset
*
* A PCI bus may host multiple slots, each slot may support a reset mechanism
* independent of other slots. For instance, some slots may support slot power
* control. In the case of a 1:1 bus to slot architecture, this function may
* wrap the bus reset to avoid spurious slot related events such as hotplug.
* Generally a slot reset should be attempted before a bus reset. All of the
* function of the slot and any subordinate buses behind the slot are reset
* through this function. PCI config space of all devices in the slot and
* behind the slot is saved before and restored after reset.
*
* Return 0 on success, non-zero on error.
*/
int pci_reset_slot(struct pci_slot *slot)
Slot reset is there to mask hotplug interrupts before the reset and unmask them
after reset.
>
> https://marc.info/?l=linux-pci&m=152336615707640&w=2
>
> https://www.spinics.net/lists/linux-pci/msg70614.html
>
>> Why do we need an additional rescan in the DPC driver if the link is up
>> and driver resumes operation?
>
> I thought the plan was to have DPC always go through the removal path
> to ensure all devices are properly configured when containment is
> released. In order to reconfigure those, you'll need to initiate the
> rescan from somewhere.
>
This is where the contradiction is.
Bjorn is asking for a unified error handling for both AER and DPC.
Current AER error recovery framework is error callback + secondary
bus reset + resume callback.
How does this stop + rescan model fit?
Do we want to change the error recovery framework? I suppose this will
become a bigger conversation as there are more customers of this.
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.