From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64ED0C433DF for ; Wed, 27 May 2020 03:06:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E33220704 for ; Wed, 27 May 2020 03:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387445AbgE0DGC (ORCPT ); Tue, 26 May 2020 23:06:02 -0400 Received: from mga07.intel.com ([134.134.136.100]:29330 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387412AbgE0DGC (ORCPT ); Tue, 26 May 2020 23:06:02 -0400 IronPort-SDR: QNB2Hc1LbhEqd06LcAQinYI7mj9YDKju6B8oPphCkTPQQ5V3gNw3jAed3Iv1BxTElJ7P4H2m7l A6Vr2ShiRq6g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2020 20:06:02 -0700 IronPort-SDR: udG/k5eKyhqnYaLObyUiCt5BjJmK5ygdvlGvYHJTa9RB/w+qpuZOdmfgFJauU/Rfkbpbl98rSy ENEKzTgE9ulw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,439,1583222400"; d="scan'208";a="270305926" Received: from zalvear-mobl.amr.corp.intel.com (HELO [10.254.67.58]) ([10.254.67.58]) by orsmga006.jf.intel.com with ESMTP; 26 May 2020 20:06:01 -0700 Subject: Re: [PATCH v1 1/1] PCI/ERR: Handle fatal error recovery for non-hotplug capable devices To: Oliver O'Halloran Cc: Yicong Yang , Bjorn Helgaas , jay.vosburgh@canonical.com, linux-pci@vger.kernel.org, Linux Kernel Mailing List , ashok.raj@intel.com References: <18609.1588812972@famine> <2569c75c-41a6-d0f3-ee34-0d288c4e0b61@linux.intel.com> <8dd2233c-a636-59fa-4c6e-5da08556d09e@hisilicon.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <55b3a469-c306-acf1-f97e-f07f40054974@linux.intel.com> Date: Tue, 26 May 2020 20:06:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Hi, On 5/26/20 8:00 PM, Oliver O'Halloran wrote: > On Wed, May 27, 2020 at 12:00 PM Kuppuswamy, Sathyanarayanan > wrote: >> >> Hi, >> >> On 5/21/20 7:56 PM, Yicong Yang wrote: >>> >>> >>> On 2020/5/22 3:31, Kuppuswamy, Sathyanarayanan wrote: >>>> >>> Not exactly. In pci_bus_error_reset(), we call pci_slot_reset() only if it's >>> hotpluggable. But we always call pci_bus_reset() to perform a secondary bus >>> reset for the bridge. That's what I think is unnecessary for a normal link, >>> and that's what reset link indicates us to do. The slot reset is introduced >>> in the process only to solve side effects. (c4eed62a2143, PCI/ERR: Use slot reset if available) >> >> IIUC, pci_bus_reset() will do slot reset if its supported (hot-plug >> capable slots). If its not supported then it will attempt secondary >> bus reset. So secondary bus reset will be attempted only if slot >> reset is not supported. >> >> Since reported_error_detected() requests us to do reset, we will have >> to attempt some kind of reset before we call ->slot_reset() right? > > Yes, the driver returns PCI_ERS_RESULT_NEED_RESET from > ->error_detected() to indicate that it doesn't know how to recover > from the error. How that reset is performed doesn't really matter, but > it does need to happen. > > >>> PCI_ERS_RESULT_NEED_RESET indicates that the driver >>> wants a platform-dependent slot reset and its ->slot_reset() method to be called then. >>> I don't think it's same as slot reset mentioned above, which is only for hotpluggable >>> ones. >> What you think is the correct reset implementation ? Is it something >> like this? >> >> if (hotplug capable) >> try_slot_reset() >> else >> do_nothing() > > Looks broken to me, but all the reset handling is a rat's nest so > maybe I'm missing something. In the case of a DPC trip the link is > disabled which has the side-effect of hot-resetting the downstream > device. Maybe it's fine? Yes, in case of DPC (Fatal errors) link is already reset. So we don't need any special handling. This reset logic is mainly for non-fatal errors. > > As an aside, why do we have both ->slot_reset() and ->reset_done() in > the error handling callbacks? Seems like their roles are almost > identical. Not sure.I think reset_done() is final cleanup. > > Oliver >