get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/831539/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 831539,
    "url": "http://patchwork.ozlabs.org/api/patches/831539/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171027150656.68250-5-alice.michael@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20171027150656.68250-5-alice.michael@intel.com>",
    "list_archive_url": null,
    "date": "2017-10-27T15:06:52",
    "name": "[next,S81-V3,5/9] i40evf: hold the critical task bit lock while opening",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "d891f6e13ed3b583a9cf9788412df6c1a09d9e27",
    "submitter": {
        "id": 71123,
        "url": "http://patchwork.ozlabs.org/api/people/71123/?format=api",
        "name": "Michael, Alice",
        "email": "alice.michael@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171027150656.68250-5-alice.michael@intel.com/mbox/",
    "series": [
        {
            "id": 10681,
            "url": "http://patchwork.ozlabs.org/api/series/10681/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=10681",
            "date": "2017-10-27T15:06:48",
            "name": "[next,S81-V3,1/9] i40e: display priority_xon and priority_xoff stats",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/10681/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/831539/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/831539/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3yP05x44TVz9t4X\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 10:12:53 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 9CEAA8A40A;\n\tFri, 27 Oct 2017 23:12:51 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ZptuIMee-gxT; Fri, 27 Oct 2017 23:12:48 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 831F88A40D;\n\tFri, 27 Oct 2017 23:12:48 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id EBBCF1C1F24\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:45 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id DF59A8A0A9\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:45 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id vGP6XQhDz+KZ for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:45 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 981048A0E3\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:43 +0000 (UTC)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Oct 2017 16:12:42 -0700",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.16.121])\n\tby fmsmga002.fm.intel.com with ESMTP; 27 Oct 2017 16:12:42 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.44,306,1505804400\"; d=\"scan'208\";\n\ta=\"1236400563\"",
        "From": "Alice Michael <alice.michael@intel.com>",
        "To": "alice.michael@intel.com,\n\tintel-wired-lan@lists.osuosl.org",
        "Date": "Fri, 27 Oct 2017 11:06:52 -0400",
        "Message-Id": "<20171027150656.68250-5-alice.michael@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20171027150656.68250-1-alice.michael@intel.com>",
        "References": "<20171027150656.68250-1-alice.michael@intel.com>",
        "Subject": "[Intel-wired-lan] [next PATCH S81-V3 5/9] i40evf: hold the critical\n\ttask bit lock while opening",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.18-1",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Jacob Keller <jacob.e.keller@intel.com>\n\nIf i40evf_open() is called quickly at the same time as a reset occurs\n(such as via ethtool) it is possible for the device to attempt to open\nwhile a reset is in progress. This occurs because the driver was not\nholding the critical task bit lock during i40evf_open, nor was it\nholding it around the call to i40evf_up_complete() in\ni40evf_reset_task().\n\nWe didn't hold the lock previously because calls to i40evf_down() would\ntake the bit lock directly, and this would have caused a deadlock.\n\nTo avoid this, we'll move the bit lock handling out of i40evf_down() and\ninto the callers of this function. Additionally, we'll now hold the bit\nlock over the entire set of steps when going up or down, to ensure that\nwe remain consistent.\n\nUltimately this causes us to serialize the transitions between down and\nup properly, and avoid changing status while we're resetting.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 40 +++++++++++++++++++------\n 1 file changed, 31 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex 9a945ff..45cff72 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -1035,6 +1035,8 @@ static void i40evf_configure(struct i40evf_adapter *adapter)\n /**\n  * i40evf_up_complete - Finish the last steps of bringing up a connection\n  * @adapter: board private structure\n+ *\n+ * Expects to be called while holding the __I40EVF_IN_CRITICAL_TASK bit lock.\n  **/\n static void i40evf_up_complete(struct i40evf_adapter *adapter)\n {\n@@ -1052,6 +1054,8 @@ static void i40evf_up_complete(struct i40evf_adapter *adapter)\n /**\n  * i40e_down - Shutdown the connection processing\n  * @adapter: board private structure\n+ *\n+ * Expects to be called while holding the __I40EVF_IN_CRITICAL_TASK bit lock.\n  **/\n void i40evf_down(struct i40evf_adapter *adapter)\n {\n@@ -1061,10 +1065,6 @@ void i40evf_down(struct i40evf_adapter *adapter)\n \tif (adapter->state <= __I40EVF_DOWN_PENDING)\n \t\treturn;\n \n-\twhile (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,\n-\t\t\t\t&adapter->crit_section))\n-\t\tusleep_range(500, 1000);\n-\n \tnetif_carrier_off(netdev);\n \tnetif_tx_disable(netdev);\n \tadapter->link_up = false;\n@@ -1097,7 +1097,6 @@ void i40evf_down(struct i40evf_adapter *adapter)\n \t\tadapter->aq_required |= I40EVF_FLAG_AQ_DISABLE_QUEUES;\n \t}\n \n-\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \tmod_timer_pending(&adapter->watchdog_timer, jiffies + 1);\n }\n \n@@ -1960,8 +1959,6 @@ static void i40evf_reset_task(struct work_struct *work)\n \n \tadapter->aq_required |= I40EVF_FLAG_AQ_ADD_MAC_FILTER;\n \tadapter->aq_required |= I40EVF_FLAG_AQ_ADD_VLAN_FILTER;\n-\tclear_bit(__I40EVF_IN_CLIENT_TASK, &adapter->crit_section);\n-\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \ti40evf_misc_irq_enable(adapter);\n \n \tmod_timer(&adapter->watchdog_timer, jiffies + 2);\n@@ -1998,9 +1995,13 @@ static void i40evf_reset_task(struct work_struct *work)\n \t\tadapter->state = __I40EVF_DOWN;\n \t\twake_up(&adapter->down_waitqueue);\n \t}\n+\tclear_bit(__I40EVF_IN_CLIENT_TASK, &adapter->crit_section);\n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \n \treturn;\n reset_err:\n+\tclear_bit(__I40EVF_IN_CLIENT_TASK, &adapter->crit_section);\n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \tdev_err(&adapter->pdev->dev, \"failed to allocate resources during reinit\\n\");\n \ti40evf_close(netdev);\n }\n@@ -2244,8 +2245,14 @@ static int i40evf_open(struct net_device *netdev)\n \t\treturn -EIO;\n \t}\n \n-\tif (adapter->state != __I40EVF_DOWN)\n-\t\treturn -EBUSY;\n+\twhile (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,\n+\t\t\t\t&adapter->crit_section))\n+\t\tusleep_range(500, 1000);\n+\n+\tif (adapter->state != __I40EVF_DOWN) {\n+\t\terr = -EBUSY;\n+\t\tgoto err_unlock;\n+\t}\n \n \t/* allocate transmit descriptors */\n \terr = i40evf_setup_all_tx_resources(adapter);\n@@ -2269,6 +2276,8 @@ static int i40evf_open(struct net_device *netdev)\n \n \ti40evf_irq_enable(adapter, true);\n \n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n+\n \treturn 0;\n \n err_req_irq:\n@@ -2278,6 +2287,8 @@ static int i40evf_open(struct net_device *netdev)\n \ti40evf_free_all_rx_resources(adapter);\n err_setup_tx:\n \ti40evf_free_all_tx_resources(adapter);\n+err_unlock:\n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n \n \treturn err;\n }\n@@ -2301,6 +2312,9 @@ static int i40evf_close(struct net_device *netdev)\n \tif (adapter->state <= __I40EVF_DOWN_PENDING)\n \t\treturn 0;\n \n+\twhile (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,\n+\t\t\t\t&adapter->crit_section))\n+\t\tusleep_range(500, 1000);\n \n \tset_bit(__I40E_VSI_DOWN, adapter->vsi.state);\n \tif (CLIENT_ENABLED(adapter))\n@@ -2310,6 +2324,8 @@ static int i40evf_close(struct net_device *netdev)\n \tadapter->state = __I40EVF_DOWN_PENDING;\n \ti40evf_free_traffic_irqs(adapter);\n \n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n+\n \t/* We explicitly don't free resources here because the hardware is\n \t * still active and can DMA into memory. Resources are cleared in\n \t * i40evf_virtchnl_completion() after we get confirmation from the PF\n@@ -2992,6 +3008,10 @@ static int i40evf_suspend(struct pci_dev *pdev, pm_message_t state)\n \n \tnetif_device_detach(netdev);\n \n+\twhile (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,\n+\t\t\t\t&adapter->crit_section))\n+\t\tusleep_range(500, 1000);\n+\n \tif (netif_running(netdev)) {\n \t\trtnl_lock();\n \t\ti40evf_down(adapter);\n@@ -3000,6 +3020,8 @@ static int i40evf_suspend(struct pci_dev *pdev, pm_message_t state)\n \ti40evf_free_misc_irq(adapter);\n \ti40evf_reset_interrupt_capability(adapter);\n \n+\tclear_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section);\n+\n \tretval = pci_save_state(pdev);\n \tif (retval)\n \t\treturn retval;\n",
    "prefixes": [
        "next",
        "S81-V3",
        "5/9"
    ]
}