Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/971357/?format=api
{ "id": 971357, "url": "http://patchwork.ozlabs.org/api/patches/971357/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180918235702.26573-8-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-8-keith.busch@intel.com>", "list_archive_url": null, "date": "2018-09-18T23:56:59", "name": "[PATCHv3,07/10] PCI/ERR: Simplify broadcast callouts", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "fd1b4a7d674bc03e39abcca083d4aafc2a9fae32", "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-8-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/971357/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/971357/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 42FKcp3gxXz9sCR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 19 Sep 2018 09:55:38 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1730679AbeISFai (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 19 Sep 2018 01:30:38 -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 S1730670AbeISFai (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tWed, 19 Sep 2018 01:30:38 -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:33 -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=\"74357535\"", "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 07/10] PCI/ERR: Simplify broadcast callouts", "Date": "Tue, 18 Sep 2018 17:56:59 -0600", "Message-Id": "<20180918235702.26573-8-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": "There is no point in having a generic broadcast function if it needs\nto have special cases for each callback it broadcasts. This patch\nabstracts the error broadcast to only the necessary information and\nremoves the now unnecessary helper to walk the bus.\n\nSigned-off-by: Keith Busch <keith.busch@intel.com>\n---\n drivers/pci/pcie/err.c | 107 ++++++++++++++++++-------------------------------\n 1 file changed, 38 insertions(+), 69 deletions(-)", "diff": "diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c\nindex 0fa5e1417a4a..362a717c831a 100644\n--- a/drivers/pci/pcie/err.c\n+++ b/drivers/pci/pcie/err.c\n@@ -19,11 +19,6 @@\n #include \"portdrv.h\"\n #include \"../pci.h\"\n \n-struct aer_broadcast_data {\n-\tenum pci_channel_state state;\n-\tenum pci_ers_result result;\n-};\n-\n static pci_ers_result_t merge_result(enum pci_ers_result orig,\n \t\t\t\t enum pci_ers_result new)\n {\n@@ -49,16 +44,15 @@ static pci_ers_result_t merge_result(enum pci_ers_result orig,\n \treturn orig;\n }\n \n-static int report_error_detected(struct pci_dev *dev, void *data)\n+static int report_error_detected(struct pci_dev *dev,\n+\t\t\t\t enum pci_channel_state state,\n+\t\t\t\t enum pci_ers_result *result)\n {\n \tpci_ers_result_t vote;\n \tconst struct pci_error_handlers *err_handler;\n-\tstruct aer_broadcast_data *result_data;\n-\n-\tresult_data = (struct aer_broadcast_data *) data;\n \n \tdevice_lock(&dev->dev);\n-\tdev->error_state = result_data->state;\n+\tdev->error_state = state;\n \n \tif (!dev->driver ||\n \t\t!dev->driver->err_handler ||\n@@ -75,22 +69,29 @@ static int report_error_detected(struct pci_dev *dev, void *data)\n \t\t\tvote = PCI_ERS_RESULT_NONE;\n \t} else {\n \t\terr_handler = dev->driver->err_handler;\n-\t\tvote = err_handler->error_detected(dev, result_data->state);\n+\t\tvote = err_handler->error_detected(dev, state);\n \t\tpci_uevent_ers(dev, PCI_ERS_RESULT_NONE);\n \t}\n \n-\tresult_data->result = merge_result(result_data->result, vote);\n+\t*result = merge_result(*result, vote);\n \tdevice_unlock(&dev->dev);\n \treturn 0;\n }\n \n+static int report_frozen_detected(struct pci_dev *dev, void *data)\n+{\n+\treturn report_error_detected(dev, pci_channel_io_frozen, data);\n+}\n+\n+static int report_normal_detected(struct pci_dev *dev, void *data)\n+{\n+\treturn report_error_detected(dev, pci_channel_io_normal, data);\n+}\n+\n static int report_mmio_enabled(struct pci_dev *dev, void *data)\n {\n-\tpci_ers_result_t vote;\n+\tpci_ers_result_t vote, *result = data;\n \tconst struct pci_error_handlers *err_handler;\n-\tstruct aer_broadcast_data *result_data;\n-\n-\tresult_data = (struct aer_broadcast_data *) data;\n \n \tdevice_lock(&dev->dev);\n \tif (!dev->driver ||\n@@ -100,7 +101,7 @@ static int report_mmio_enabled(struct pci_dev *dev, void *data)\n \n \terr_handler = dev->driver->err_handler;\n \tvote = err_handler->mmio_enabled(dev);\n-\tresult_data->result = merge_result(result_data->result, vote);\n+\t*result = merge_result(*result, vote);\n out:\n \tdevice_unlock(&dev->dev);\n \treturn 0;\n@@ -108,11 +109,8 @@ static int report_mmio_enabled(struct pci_dev *dev, void *data)\n \n static int report_slot_reset(struct pci_dev *dev, void *data)\n {\n-\tpci_ers_result_t vote;\n+\tpci_ers_result_t vote, *result = data;\n \tconst struct pci_error_handlers *err_handler;\n-\tstruct aer_broadcast_data *result_data;\n-\n-\tresult_data = (struct aer_broadcast_data *) data;\n \n \tdevice_lock(&dev->dev);\n \tif (!dev->driver ||\n@@ -122,7 +120,7 @@ static int report_slot_reset(struct pci_dev *dev, void *data)\n \n \terr_handler = dev->driver->err_handler;\n \tvote = err_handler->slot_reset(dev);\n-\tresult_data->result = merge_result(result_data->result, vote);\n+\t*result = merge_result(*result, vote);\n out:\n \tdevice_unlock(&dev->dev);\n \treturn 0;\n@@ -189,39 +187,11 @@ static pci_ers_result_t reset_link(struct pci_dev *dev, u32 service)\n \treturn status;\n }\n \n-/**\n- * broadcast_error_message - handle message broadcast to downstream drivers\n- * @dev: pointer to from where in a hierarchy message is broadcasted down\n- * @state: error state\n- * @error_mesg: message to print\n- * @cb: callback to be broadcasted\n- *\n- * Invoked during error recovery process. Once being invoked, the content\n- * of error severity will be broadcasted to all downstream drivers in a\n- * hierarchy in question.\n- */\n-static pci_ers_result_t broadcast_error_message(struct pci_dev *dev,\n-\tenum pci_channel_state state,\n-\tchar *error_mesg,\n-\tint (*cb)(struct pci_dev *, void *))\n-{\n-\tstruct aer_broadcast_data result_data;\n-\n-\tpci_printk(KERN_DEBUG, dev, \"broadcast %s message\\n\", error_mesg);\n-\tresult_data.state = state;\n-\tif (cb == report_error_detected)\n-\t\tresult_data.result = PCI_ERS_RESULT_CAN_RECOVER;\n-\telse\n-\t\tresult_data.result = PCI_ERS_RESULT_RECOVERED;\n-\n-\tpci_walk_bus(dev->subordinate, cb, &result_data);\n-\treturn result_data.result;\n-}\n-\n void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,\n \t\t u32 service)\n {\n-\tpci_ers_result_t status;\n+\tpci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;\n+\tstruct pci_bus *bus;\n \n \t/*\n \t * Error recovery runs on all subordinates of the first downstream port.\n@@ -230,21 +200,23 @@ void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,\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+\tbus = dev->subordinate;\n \n-\tstatus = broadcast_error_message(dev,\n-\t\t\tstate,\n-\t\t\t\"error_detected\",\n-\t\t\treport_error_detected);\n+\tpci_dbg(dev, \"broadcast error_detected message\\n\");\n+\tif (state == pci_channel_io_frozen)\n+\t\tpci_walk_bus(bus, report_frozen_detected, &status);\n+\telse\n+\t\tpci_walk_bus(bus, report_normal_detected, &status);\n \n \tif (state == pci_channel_io_frozen &&\n \t reset_link(dev, service) != PCI_ERS_RESULT_RECOVERED)\n \t\tgoto failed;\n \n-\tif (status == PCI_ERS_RESULT_CAN_RECOVER)\n-\t\tstatus = broadcast_error_message(dev,\n-\t\t\t\tstate,\n-\t\t\t\t\"mmio_enabled\",\n-\t\t\t\treport_mmio_enabled);\n+\tif (status == PCI_ERS_RESULT_CAN_RECOVER) {\n+\t\tstatus = PCI_ERS_RESULT_RECOVERED;\n+\t\tpci_dbg(dev, \"broadcast mmio_enabled message\\n\");\n+\t\tpci_walk_bus(bus, report_mmio_enabled, &status);\n+\t}\n \n \tif (status == PCI_ERS_RESULT_NEED_RESET) {\n \t\t/*\n@@ -252,19 +224,16 @@ void pcie_do_recovery(struct pci_dev *dev, enum pci_channel_state state,\n \t\t * functions to reset slot before calling\n \t\t * drivers' slot_reset callbacks?\n \t\t */\n-\t\tstatus = broadcast_error_message(dev,\n-\t\t\t\tstate,\n-\t\t\t\t\"slot_reset\",\n-\t\t\t\treport_slot_reset);\n+\t\tstatus = PCI_ERS_RESULT_RECOVERED;\n+\t\tpci_dbg(dev, \"broadcast slot_reset message\\n\");\n+\t\tpci_walk_bus(bus, report_slot_reset, &status);\n \t}\n \n \tif (status != PCI_ERS_RESULT_RECOVERED)\n \t\tgoto failed;\n \n-\tbroadcast_error_message(dev,\n-\t\t\t\tstate,\n-\t\t\t\t\"resume\",\n-\t\t\t\treport_resume);\n+\tpci_dbg(dev, \"broadcast resume message\\n\");\n+\tpci_walk_bus(bus, report_resume, &status);\n \n \tpci_aer_clear_device_status(dev);\n \tpci_cleanup_aer_uncorrect_error_status(dev);\n", "prefixes": [ "PATCHv3", "07/10" ] }