Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/971353/?format=api
{ "id": 971353, "url": "http://patchwork.ozlabs.org/api/patches/971353/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180918235702.26573-7-keith.busch@intel.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20180918235702.26573-7-keith.busch@intel.com>", "list_archive_url": null, "date": "2018-09-18T23:56:58", "name": "[PATCHv3,06/10] PCI/ERR: Always use the first downstream port", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "643c140e3d491683ed2a7a1adf90695fab6c2488", "submitter": { "id": 19950, "url": "http://patchwork.ozlabs.org/api/people/19950/?format=api", "name": "Keith Busch", "email": "keith.busch@intel.com" }, "delegate": { "id": 6763, "url": "http://patchwork.ozlabs.org/api/users/6763/?format=api", "username": "bhelgaas", "first_name": "Bjorn", "last_name": "Helgaas", "email": "bhelgaas@google.com" }, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180918235702.26573-7-keith.busch@intel.com/mbox/", "series": [ { "id": 66288, "url": "http://patchwork.ozlabs.org/api/series/66288/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=66288", "date": "2018-09-18T23:56:52", "name": "PCI error handling", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/66288/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/971353/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/971353/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pci-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 42FKcl421xz9sCR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 19 Sep 2018 09:55:35 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1730676AbeISFae (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 19 Sep 2018 01:30:34 -0400", "from mga02.intel.com ([134.134.136.20]:47633 \"EHLO mga02.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1730670AbeISFad (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tWed, 19 Sep 2018 01:30:33 -0400", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t18 Sep 2018 16:55:32 -0700", "from unknown (HELO localhost.lm.intel.com) ([10.232.112.44])\n\tby orsmga008.jf.intel.com with ESMTP; 18 Sep 2018 16:55:32 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.53,391,1531810800\"; d=\"scan'208\";a=\"74357531\"", "From": "Keith Busch <keith.busch@intel.com>", "To": "Linux PCI <linux-pci@vger.kernel.org>,\n\tBjorn Helgaas <bhelgaas@google.com>", "Cc": "Benjamin Herrenschmidt <benh@kernel.crashing.org>,\n\tSinan Kaya <okaya@kernel.org>,\n\tThomas Tai <thomas.tai@oracle.com>, poza@codeaurora.org,\n\tLukas Wunner <lukas@wunner.de>, Christoph Hellwig <hch@lst.de>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tKeith Busch <keith.busch@intel.com>", "Subject": "[PATCHv3 06/10] PCI/ERR: Always use the first downstream port", "Date": "Tue, 18 Sep 2018 17:56:58 -0600", "Message-Id": "<20180918235702.26573-7-keith.busch@intel.com>", "X-Mailer": "git-send-email 2.13.6", "In-Reply-To": "<20180918235702.26573-1-keith.busch@intel.com>", "References": "<20180918235702.26573-1-keith.busch@intel.com>", "Sender": "linux-pci-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pci.vger.kernel.org>", "X-Mailing-List": "linux-pci@vger.kernel.org" }, "content": "The link reset always used the first bridge device, but AER broadcast\nerror handling may have reported an end device. This means the reset may\nhit devices that were never notified of the impending error recovery.\n\nThis patch uses the first downstream port in the hierarchy considered\nreliable. An error detected by a switch upstream port should mean it\noccurred on its upstream link, so the patch selects the parent device\nif the error is not a root or downstream port.\n\nThis allows two other clean-ups. First, error handling can only run\non bridges so this patch removes checks for end devices. Second, the\nfirst accessible port does not inherit the channel error state since we\ncan access it, so the special cases for error detect and resume are no\nlonger necessary.\n\nSigned-off-by: Keith Busch <keith.busch@intel.com>\n---\n drivers/pci/pcie/err.c | 85 +++++++++++++-------------------------------------\n 1 file changed, 21 insertions(+), 64 deletions(-)", "diff": "diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c\nindex 644f3f725ef0..0fa5e1417a4a 100644\n--- a/drivers/pci/pcie/err.c\n+++ b/drivers/pci/pcie/err.c\n@@ -63,30 +63,12 @@ static int report_error_detected(struct pci_dev *dev, void *data)\n \tif (!dev->driver ||\n \t\t!dev->driver->err_handler ||\n \t\t!dev->driver->err_handler->error_detected) {\n-\t\tif (result_data->state == pci_channel_io_frozen &&\n-\t\t\tdev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {\n-\t\t\t/*\n-\t\t\t * In case of fatal recovery, if one of down-\n-\t\t\t * stream device has no driver. We might be\n-\t\t\t * unable to recover because a later insmod\n-\t\t\t * of a driver for this device is unaware of\n-\t\t\t * its hw state.\n-\t\t\t */\n-\t\t\tpci_printk(KERN_DEBUG, dev, \"device has %s\\n\",\n-\t\t\t\t dev->driver ?\n-\t\t\t\t \"no AER-aware driver\" : \"no driver\");\n-\t\t}\n-\n \t\t/*\n-\t\t * If there's any device in the subtree that does not\n-\t\t * have an error_detected callback, returning\n-\t\t * PCI_ERS_RESULT_NO_AER_DRIVER prevents calling of\n-\t\t * the subsequent mmio_enabled/slot_reset/resume\n-\t\t * callbacks of \"any\" device in the subtree. All the\n-\t\t * devices in the subtree are left in the error state\n-\t\t * without recovery.\n+\t\t * If any device in the subtree does not have an error_detected\n+\t\t * callback, PCI_ERS_RESULT_NO_AER_DRIVER prevents subsequent\n+\t\t * error callbacks of \"any\" device in the subtree, and will\n+\t\t * exit in the disconnected error state.\n \t\t */\n-\n \t\tif (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE)\n \t\t\tvote = PCI_ERS_RESULT_NO_AER_DRIVER;\n \t\telse\n@@ -184,34 +166,23 @@ static pci_ers_result_t default_reset_link(struct pci_dev *dev)\n \n static pci_ers_result_t reset_link(struct pci_dev *dev, u32 service)\n {\n-\tstruct pci_dev *udev;\n \tpci_ers_result_t status;\n \tstruct pcie_port_service_driver *driver = NULL;\n \n-\tif (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {\n-\t\t/* Reset this port for all subordinates */\n-\t\tudev = dev;\n-\t} else {\n-\t\t/* Reset the upstream component (likely downstream port) */\n-\t\tudev = dev->bus->self;\n-\t}\n-\n-\t/* Use the aer driver of the component firstly */\n-\tdriver = pcie_port_find_service(udev, service);\n-\n+\tdriver = pcie_port_find_service(dev, service);\n \tif (driver && driver->reset_link) {\n-\t\tstatus = driver->reset_link(udev);\n-\t} else if (udev->has_secondary_link) {\n-\t\tstatus = default_reset_link(udev);\n+\t\tstatus = driver->reset_link(dev);\n+\t} else if (dev->has_secondary_link) {\n+\t\tstatus = default_reset_link(dev);\n \t} else {\n \t\tpci_printk(KERN_DEBUG, dev, \"no link-reset support at upstream device %s\\n\",\n-\t\t\tpci_name(udev));\n+\t\t\tpci_name(dev));\n \t\treturn PCI_ERS_RESULT_DISCONNECT;\n \t}\n \n \tif (status != PCI_ERS_RESULT_RECOVERED) {\n \t\tpci_printk(KERN_DEBUG, dev, \"link reset at upstream device %s failed\\n\",\n-\t\t\tpci_name(udev));\n+\t\t\tpci_name(dev));\n \t\treturn PCI_ERS_RESULT_DISCONNECT;\n \t}\n \n@@ -243,31 +214,7 @@ static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,\n \telse\n \t\tresult_data.result = PCI_ERS_RESULT_RECOVERED;\n \n-\tif (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {\n-\t\t/*\n-\t\t * If the error is reported by a bridge, we think this error\n-\t\t * is related to the downstream link of the bridge, so we\n-\t\t * do error recovery on all subordinates of the bridge instead\n-\t\t * of the bridge and clear the error status of the bridge.\n-\t\t */\n-\t\tif (cb == report_error_detected)\n-\t\t\tdev->error_state = state;\n-\t\tpci_walk_bus(dev->subordinate, cb, &result_data);\n-\t\tif (cb == report_resume) {\n-\t\t\tpci_aer_clear_device_status(dev);\n-\t\t\tpci_cleanup_aer_uncorrect_error_status(dev);\n-\t\t\tdev->error_state = pci_channel_io_normal;\n-\t\t}\n-\t} else {\n-\t\t/*\n-\t\t * If the error is reported by an end point, we think this\n-\t\t * error is related to the upstream link of the end point.\n-\t\t * The error is non fatal so the bus is ok; just invoke\n-\t\t * the callback for the function that logged the error.\n-\t\t */\n-\t\tcb(dev, &result_data);\n-\t}\n-\n+\tpci_walk_bus(dev->subordinate, cb, &result_data);\n \treturn result_data.result;\n }\n \n@@ -276,6 +223,14 @@ void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,\n {\n \tpci_ers_result_t status;\n \n+\t/*\n+\t * Error recovery runs on all subordinates of the first downstream port.\n+\t * If the downstream port detected the error, it is cleared at the end.\n+\t */\n+\tif (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||\n+\t pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM))\n+\t\tdev = dev->bus->self;\n+\n \tstatus = broadcast_error_message(dev,\n \t\t\tstate,\n \t\t\t\"error_detected\",\n@@ -311,6 +266,8 @@ void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,\n \t\t\t\t\"resume\",\n \t\t\t\treport_resume);\n \n+\tpci_aer_clear_device_status(dev);\n+\tpci_cleanup_aer_uncorrect_error_status(dev);\n \tpci_info(dev, \"AER: Device recovery successful\\n\");\n \treturn;\n \n", "prefixes": [ "PATCHv3", "06/10" ] }