Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/971355/?format=api
{ "id": 971355, "url": "http://patchwork.ozlabs.org/api/patches/971355/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20180918235702.26573-10-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-10-keith.busch@intel.com>", "list_archive_url": null, "date": "2018-09-18T23:57:01", "name": "[PATCHv3,09/10] PCI: Unify device inaccessible", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "71c15d683b084d3045b3c3da8a57eefd4a79107c", "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-10-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/971355/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/971355/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 42FKcm68M3z9sCR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 19 Sep 2018 09:55:36 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1730681AbeISFag (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 19 Sep 2018 01:30:36 -0400", "from mga02.intel.com ([134.134.136.20]:47647 \"EHLO mga02.intel.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1730679AbeISFag (ORCPT <rfc822;linux-pci@vger.kernel.org>);\n\tWed, 19 Sep 2018 01:30:36 -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:35 -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:34 -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=\"74357546\"", "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 09/10] PCI: Unify device inaccessible", "Date": "Tue, 18 Sep 2018 17:57:01 -0600", "Message-Id": "<20180918235702.26573-10-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": "This patch brings surprise removals and permanent failures together so\nwe no longer need separate flags. The implemetation enforces the error\nhandling will not be able to override a surprise removal's permanent\nchannel failure.\n\nSigned-off-by: Keith Busch <keith.busch@intel.com>\n---\n drivers/pci/pci.h | 60 +++++++++++++++++++++++++++++++++++++++++++++-----\n drivers/pci/pcie/err.c | 10 ++++-----\n 2 files changed, 59 insertions(+), 11 deletions(-)", "diff": "diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h\nindex 5a96978d3403..44862719b4e9 100644\n--- a/drivers/pci/pci.h\n+++ b/drivers/pci/pci.h\n@@ -295,21 +295,71 @@ struct pci_sriov {\n \tbool\t\tdrivers_autoprobe; /* Auto probing of VFs by driver */\n };\n \n-/* pci_dev priv_flags */\n-#define PCI_DEV_DISCONNECTED 0\n-#define PCI_DEV_ADDED 1\n+/**\n+ * pci_dev_set_io_state - Set the new error state if possible.\n+ *\n+ * @dev - pci device to set new error_state\n+ * @new - the state we want dev to be in\n+ *\n+ * Must be called with device_lock held.\n+ *\n+ * Returns true if state has been changed to the requested state.\n+ */\n+static inline bool pci_dev_set_io_state(struct pci_dev *dev,\n+\t\t\t\t\tpci_channel_state_t new)\n+{\n+\tbool changed = false;\n+\n+\tdevice_lock_assert(&dev->dev);\n+\tswitch (new) {\n+\tcase pci_channel_io_perm_failure:\n+\t\tswitch (dev->error_state) {\n+\t\tcase pci_channel_io_frozen:\n+\t\tcase pci_channel_io_normal:\n+\t\tcase pci_channel_io_perm_failure:\n+\t\t\tchanged = true;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\tcase pci_channel_io_frozen:\n+\t\tswitch (dev->error_state) {\n+\t\tcase pci_channel_io_frozen:\n+\t\tcase pci_channel_io_normal:\n+\t\t\tchanged = true;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\tcase pci_channel_io_normal:\n+\t\tswitch (dev->error_state) {\n+\t\tcase pci_channel_io_frozen:\n+\t\tcase pci_channel_io_normal:\n+\t\t\tchanged = true;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\t}\n+\tif (changed)\n+\t\tdev->error_state = new;\n+\treturn changed;\n+}\n \n static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)\n {\n-\tset_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags);\n+\tdevice_lock(&dev->dev);\n+\tpci_dev_set_io_state(dev, pci_channel_io_perm_failure);\n+\tdevice_unlock(&dev->dev);\n+\n \treturn 0;\n }\n \n static inline bool pci_dev_is_disconnected(const struct pci_dev *dev)\n {\n-\treturn test_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags);\n+\treturn dev->error_state == pci_channel_io_perm_failure;\n }\n \n+/* pci_dev priv_flags */\n+#define PCI_DEV_ADDED 0\n+\n static inline void pci_dev_assign_added(struct pci_dev *dev, bool added)\n {\n \tassign_bit(PCI_DEV_ADDED, &dev->priv_flags, added);\ndiff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c\nindex 31e8a4314384..4da2a62b4f77 100644\n--- a/drivers/pci/pcie/err.c\n+++ b/drivers/pci/pcie/err.c\n@@ -52,9 +52,8 @@ static int report_error_detected(struct pci_dev *dev,\n \tconst struct pci_error_handlers *err_handler;\n \n \tdevice_lock(&dev->dev);\n-\tdev->error_state = state;\n-\n-\tif (!dev->driver ||\n+\tif (!pci_dev_set_io_state(dev, state) ||\n+\t\t!dev->driver ||\n \t\t!dev->driver->err_handler ||\n \t\t!dev->driver->err_handler->error_detected) {\n \t\t/*\n@@ -130,9 +129,8 @@ static int report_resume(struct pci_dev *dev, void *data)\n \tconst struct pci_error_handlers *err_handler;\n \n \tdevice_lock(&dev->dev);\n-\tdev->error_state = pci_channel_io_normal;\n-\n-\tif (!dev->driver ||\n+\tif (!pci_dev_set_io_state(dev, pci_channel_io_normal) ||\n+\t\t!dev->driver ||\n \t\t!dev->driver->err_handler ||\n \t\t!dev->driver->err_handler->resume)\n \t\tgoto out;\n", "prefixes": [ "PATCHv3", "09/10" ] }