Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/831537/?format=api
{ "id": 831537, "url": "http://patchwork.ozlabs.org/api/patches/831537/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20171027150656.68250-2-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-2-alice.michael@intel.com>", "list_archive_url": null, "date": "2017-10-27T15:06:49", "name": "[next,S81-V3,2/9] i40evf: don't rely on netif_running() outside rtnl_lock()", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "33e4a1742eefbdaa2f1bfb49739d1f75ae8b2eaa", "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-2-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/831537/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/831537/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.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 3yP05t1ks7z9t4X\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 28 Oct 2017 10:12:50 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C792F891E7;\n\tFri, 27 Oct 2017 23:12:48 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id cgqlFudpWzQc; Fri, 27 Oct 2017 23:12:48 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 058D8891B0;\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 D8AD91C1F24\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:44 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D1BDF8A0D6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:44 +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 LP-YwJbbtLi8 for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 27 Oct 2017 23:12:43 +0000 (UTC)", "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 2F7968A0AA\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:41 -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=\"1236400554\"", "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:49 -0400", "Message-Id": "<20171027150656.68250-2-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 2/9] i40evf: don't rely on\n\tnetif_running() outside rtnl_lock()", "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\nIn i40evf_reset_task we use netif_running() to determine whether or not\nthe device is currently up. This allows us to properly free queue memory\nand shut down things before we request the hardware reset.\n\nIt turns out that we cannot be guaranteed of netif_running() returning\nfalse until the device is fully up, as the kernel core code sets\n__LINK_STATE_START prior to calling .ndo_open. Since we're not holding\nthe rtnl_lock(), it's possible that the driver's i40evf_open handler\nfunction is currently being called while we're resetting.\n\nWe can't simply hold the rtnl_lock() while checking netif_running() as\nthis could cause a deadlock with the i40evf_open() function.\nAdditionally, we can't avoid the deadlock by holding the rtnl_lock()\nover the whole reset path, as this essentially serializes all resets,\nand can cause massive delays if we have multiple VFs on a system.\n\nInstead, lets just check our own internal state __I40EVF_RUNNING state\nfield. This allows us to ensure that the state is correct and is only\nset after we've finished bringing the device up.\n\nWithout this change we might free data structures about device queues\nand other memory before they've been fully allocated.\n\nSigned-off-by: Jacob Keller <jacob.e.keller@intel.com>\n---\n drivers/net/ethernet/intel/i40evf/i40evf_main.c | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\nindex ca2ebdb..320408f 100644\n--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c\n@@ -1796,7 +1796,11 @@ static void i40evf_disable_vf(struct i40evf_adapter *adapter)\n \n \tadapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED;\n \n-\tif (netif_running(adapter->netdev)) {\n+\t/* We don't use netif_running() because it may be true prior to\n+\t * ndo_open() returning, so we can't assume it means all our open\n+\t * tasks have finished, since we're not holding the rtnl_lock here.\n+\t */\n+\tif (adapter->state == __I40EVF_RUNNING) {\n \t\tset_bit(__I40E_VSI_DOWN, adapter->vsi.state);\n \t\tnetif_carrier_off(adapter->netdev);\n \t\tnetif_tx_disable(adapter->netdev);\n@@ -1854,6 +1858,7 @@ static void i40evf_reset_task(struct work_struct *work)\n \tstruct i40evf_mac_filter *f;\n \tu32 reg_val;\n \tint i = 0, err;\n+\tbool running;\n \n \twhile (test_and_set_bit(__I40EVF_IN_CLIENT_TASK,\n \t\t\t\t&adapter->crit_section))\n@@ -1913,7 +1918,13 @@ static void i40evf_reset_task(struct work_struct *work)\n \t}\n \n continue_reset:\n-\tif (netif_running(netdev)) {\n+\t/* We don't use netif_running() because it may be true prior to\n+\t * ndo_open() returning, so we can't assume it means all our open\n+\t * tasks have finished, since we're not holding the rtnl_lock here.\n+\t */\n+\trunning = (adapter->state == __I40EVF_RUNNING);\n+\n+\tif (running) {\n \t\tnetif_carrier_off(netdev);\n \t\tnetif_tx_stop_all_queues(netdev);\n \t\tadapter->link_up = false;\n@@ -1964,7 +1975,10 @@ static void i40evf_reset_task(struct work_struct *work)\n \n \tmod_timer(&adapter->watchdog_timer, jiffies + 2);\n \n-\tif (netif_running(adapter->netdev)) {\n+\t/* We were running when the reset started, so we need to restore some\n+\t * state here.\n+\t */\n+\tif (running) {\n \t\t/* allocate transmit descriptors */\n \t\terr = i40evf_setup_all_tx_resources(adapter);\n \t\tif (err)\n", "prefixes": [ "next", "S81-V3", "2/9" ] }