linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kuppuswamy, Sathyanarayanan"  <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Sinan Kaya <okaya@kernel.org>, Bjorn Helgaas <helgaas@kernel.org>
Cc: bhelgaas@google.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, ashok.raj@intel.com,
	Jay Vosburgh <jay.vosburgh@canonical.com>
Subject: Re: [PATCH v3 1/1] PCI/ERR: Fix reset logic in pcie_do_recovery() call
Date: Mon, 28 Sep 2020 10:15:44 -0700	[thread overview]
Message-ID: <8a3aeb3c-83c4-8626-601d-360946d55dd8@linux.intel.com> (raw)
In-Reply-To: <a2bbdfed-fb17-51dc-8ae4-55d924c13211@kernel.org>



On 9/28/20 4:17 AM, Sinan Kaya wrote:
> On 9/27/2020 10:43 PM, Kuppuswamy, Sathyanarayanan wrote:
>> FATAL + no-hotplug - In this case, link will still be reseted. But
>> currently driver state is not properly restored. So I attempted
>> to restore it using pci_reset_bus().
>>
>>           status = reset_link(dev);
>> -        if (status != PCI_ERS_RESULT_RECOVERED) {
>> +        if (status == PCI_ERS_RESULT_RECOVERED) {
>> +            status = PCI_ERS_RESULT_NEED_RESET;
>>
>> ...
>>
>>       if (status == PCI_ERS_RESULT_NEED_RESET) {
>>           /*
>> -         * TODO: Should call platform-specific
>> -         * functions to reset slot before calling
>> -         * drivers' slot_reset callbacks?
>> +         * TODO: Optimize the call to pci_reset_bus()
>> +         *
>> +         * There are two components to pci_reset_bus().
>> +         *
>> +         * 1. Do platform specific slot/bus reset.
>> +         * 2. Save/Restore all devices in the bus.
>> +         *
>> +         * For hotplug capable devices and fatal errors,
>> +         * device is already in reset state due to link
>> +         * reset. So repeating platform specific slot/bus
>> +         * reset via pci_reset_bus() call is redundant. So
>> +         * can optimize this logic and conditionally call
>> +         * pci_reset_bus().
>>            */
>> +        pci_reset_bus(dev);
> 
> I think we have to go to remove/rescan for this case as you also
> mentioned above. There is no state to save. All BAR assignments
> are gone. Entire device programming is also lost.
> 
> I don't think pci_reset_bus() can recover from this situation safely.
> It will make things worse by saving/restoring the hardware default
> state.
> 
> This should remove/rescan logic should be inside DPC's slot_reset()
> function BTW. Not here.
Since there is no state restoration for FATAL errors, I am wondering whether
calls to ->error_detected(), ->mmio_enabled() and ->slot_reset() are
required?

Let me know your comments about following pseudo code.

if (fatal error & hotplug_supported)
    do nothing // if fatal triggered by DPC, clear DPC state.

if (fatal error & no-hotplug)
   perform slot_reset and renumerate affected devices.

> 

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer

  parent reply	other threads:[~2020-09-28 17:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3cad1a07-509b-ef51-f635-71def2ff8293@linux.intel.com>
2020-09-22 23:33 ` [PATCH v3 1/1] PCI/ERR: Fix reset logic in pcie_do_recovery() call Bjorn Helgaas
2020-09-22 23:44   ` Kuppuswamy, Sathyanarayanan
2020-09-24  1:15     ` Sinan Kaya
2020-09-24  2:04       ` Kuppuswamy, Sathyanarayanan
2020-09-24  2:16         ` Sinan Kaya
2020-09-24  2:51           ` Kuppuswamy, Sathyanarayanan
2020-09-24  3:13             ` Sinan Kaya
2020-09-24  4:06               ` Kuppuswamy, Sathyanarayanan
2020-09-24 20:52                 ` Sinan Kaya
2020-09-25  5:11                   ` Kuppuswamy, Sathyanarayanan
2020-09-25 16:55                     ` Sinan Kaya
2020-09-25 17:11                       ` Kuppuswamy, Sathyanarayanan
2020-09-25 17:47                         ` Sinan Kaya
2020-09-25 18:16                           ` Kuppuswamy, Sathyanarayanan
2020-09-25 18:30                             ` Sinan Kaya
2020-09-28  2:43                               ` Kuppuswamy, Sathyanarayanan
2020-09-28  8:41                                 ` Ethan Zhao
2020-09-28 11:17                                 ` Sinan Kaya
2020-09-28 12:16                                   ` Sinan Kaya
2020-09-28 17:15                                   ` Kuppuswamy, Sathyanarayanan [this message]
2020-09-28 18:02                                     ` Sinan Kaya
2020-09-28 18:25                                       ` Sinan Kaya
2020-09-28 18:32                                         ` Kuppuswamy, Sathyanarayanan
2020-10-12  5:13                                           ` Kuppuswamy, Sathyanarayanan
2020-10-12 14:51                                             ` Sinan Kaya
2020-09-28 12:11                                 ` Sinan Kaya
2020-09-25 23:50                             ` Sinan Kaya
2020-07-24 19:07 sathyanarayanan.kuppuswamy
2020-09-01  5:41 ` Kuppuswamy, Sathyanarayanan
2020-09-22 18:52 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8a3aeb3c-83c4-8626-601d-360946d55dd8@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=jay.vosburgh@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).