Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/881848/?format=api
{ "id": 881848, "url": "http://patchwork.ozlabs.org/api/patches/881848/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20180306015553.10441-2-bpoirier@suse.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": "<20180306015553.10441-2-bpoirier@suse.com>", "list_archive_url": null, "date": "2018-03-06T01:55:53", "name": "[2/2] e1000e: Fix link check race condition", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "0668f31a9e91fc5b41ac71d8e46d949495665fa0", "submitter": { "id": 67008, "url": "http://patchwork.ozlabs.org/api/people/67008/?format=api", "name": "Benjamin Poirier", "email": "bpoirier@suse.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/20180306015553.10441-2-bpoirier@suse.com/mbox/", "series": [ { "id": 32078, "url": "http://patchwork.ozlabs.org/api/series/32078/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=32078", "date": "2018-03-06T01:55:52", "name": "[1/2] Revert \"e1000e: Separate signaling for link check/link up\"", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/32078/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/881848/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/881848/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.136; helo=silver.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org;\n\tdmarc=none (p=none dis=none) header.from=suse.com" ], "Received": [ "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\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 3zwKdF25gqz9sbk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 6 Mar 2018 12:56:32 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 8737922F5C;\n\tTue, 6 Mar 2018 01:56:31 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id a3i3lV92915n; Tue, 6 Mar 2018 01:56:28 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 6273622885;\n\tTue, 6 Mar 2018 01:56:28 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 669381CEF86\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 6 Mar 2018 01:56:26 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 62A1E86488\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 6 Mar 2018 01:56:26 +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 IAuzw44XkISC for <intel-wired-lan@lists.osuosl.org>;\n\tTue, 6 Mar 2018 01:56:25 +0000 (UTC)", "from mx2.suse.de (mx2.suse.de [195.135.220.15])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 80F308642A\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tTue, 6 Mar 2018 01:56:25 +0000 (UTC)", "from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254])\n\tby mx2.suse.de (Postfix) with ESMTP id 0EBEFAF80;\n\tTue, 6 Mar 2018 01:56:24 +0000 (UTC)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org", "by amavisd-new at test-mx.suse.de" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "From": "Benjamin Poirier <bpoirier@suse.com>", "To": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>", "Date": "Tue, 6 Mar 2018 10:55:53 +0900", "Message-Id": "<20180306015553.10441-2-bpoirier@suse.com>", "X-Mailer": "git-send-email 2.16.2", "In-Reply-To": "<20180306015553.10441-1-bpoirier@suse.com>", "References": "<20180306015553.10441-1-bpoirier@suse.com>", "Subject": "[Intel-wired-lan] [PATCH 2/2] e1000e: Fix link check race condition", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.24", "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>", "Cc": "netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,\n\tlinux-kernel@vger.kernel.org,\n\tLennart Sorensen <lsorense@csclub.uwaterloo.ca>", "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": "Alex reported the following race condition:\n\n/* link goes up... interrupt... schedule watchdog */\n\\ e1000_watchdog_task\n\t\\ e1000e_has_link\n\t\t\\ hw->mac.ops.check_for_link() === e1000e_check_for_copper_link\n\t\t\t\\ e1000e_phy_has_link_generic(..., &link)\n\t\t\t\tlink = true\n\n\t\t\t\t\t /* link goes down... interrupt */\n\t\t\t\t\t \\ e1000_msix_other\n\t\t\t\t\t\t hw->mac.get_link_status = true\n\n\t\t\t/* link is up */\n\t\t\tmac->get_link_status = false\n\n\t\tlink_active = true\n\t\t/* link_active is true, wrongly, and stays so because\n\t\t * get_link_status is false */\n\nAvoid this problem by making sure that we don't set get_link_status = false\nafter having checked the link.\n\nIt seems this problem has been present since the introduction of e1000e.\n\nLink: https://lkml.org/lkml/2018/1/29/338\nReported-by: Alexander Duyck <alexander.duyck@gmail.com>\nSigned-off-by: Benjamin Poirier <bpoirier@suse.com>\n---\n drivers/net/ethernet/intel/e1000e/ich8lan.c | 31 ++++++++++++++++-------------\n drivers/net/ethernet/intel/e1000e/mac.c | 14 ++++++-------\n 2 files changed, 24 insertions(+), 21 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c\nindex d6d4ed7acf03..1dddfb7b2de6 100644\n--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c\n+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c\n@@ -1383,6 +1383,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t */\n \tif (!mac->get_link_status)\n \t\treturn 0;\n+\tmac->get_link_status = false;\n \n \t/* First we want to see if the MII Status Register reports\n \t * link. If so, then we want to get the current speed/duplex\n@@ -1390,12 +1391,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t */\n \tret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);\n \tif (ret_val)\n-\t\treturn ret_val;\n+\t\tgoto out;\n \n \tif (hw->mac.type == e1000_pchlan) {\n \t\tret_val = e1000_k1_gig_workaround_hv(hw, link);\n \t\tif (ret_val)\n-\t\t\treturn ret_val;\n+\t\t\tgoto out;\n \t}\n \n \t/* When connected at 10Mbps half-duplex, some parts are excessively\n@@ -1428,7 +1429,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \n \t\tret_val = hw->phy.ops.acquire(hw);\n \t\tif (ret_val)\n-\t\t\treturn ret_val;\n+\t\t\tgoto out;\n \n \t\tif (hw->mac.type == e1000_pch2lan)\n \t\t\temi_addr = I82579_RX_CONFIG;\n@@ -1450,7 +1451,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t\thw->phy.ops.release(hw);\n \n \t\tif (ret_val)\n-\t\t\treturn ret_val;\n+\t\t\tgoto out;\n \n \t\tif (hw->mac.type >= e1000_pch_spt) {\n \t\t\tu16 data;\n@@ -1459,14 +1460,14 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t\t\tif (speed == SPEED_1000) {\n \t\t\t\tret_val = hw->phy.ops.acquire(hw);\n \t\t\t\tif (ret_val)\n-\t\t\t\t\treturn ret_val;\n+\t\t\t\t\tgoto out;\n \n \t\t\t\tret_val = e1e_rphy_locked(hw,\n \t\t\t\t\t\t\t PHY_REG(776, 20),\n \t\t\t\t\t\t\t &data);\n \t\t\t\tif (ret_val) {\n \t\t\t\t\thw->phy.ops.release(hw);\n-\t\t\t\t\treturn ret_val;\n+\t\t\t\t\tgoto out;\n \t\t\t\t}\n \n \t\t\t\tptr_gap = (data & (0x3FF << 2)) >> 2;\n@@ -1480,18 +1481,18 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t\t\t\t}\n \t\t\t\thw->phy.ops.release(hw);\n \t\t\t\tif (ret_val)\n-\t\t\t\t\treturn ret_val;\n+\t\t\t\t\tgoto out;\n \t\t\t} else {\n \t\t\t\tret_val = hw->phy.ops.acquire(hw);\n \t\t\t\tif (ret_val)\n-\t\t\t\t\treturn ret_val;\n+\t\t\t\t\tgoto out;\n \n \t\t\t\tret_val = e1e_wphy_locked(hw,\n \t\t\t\t\t\t\t PHY_REG(776, 20),\n \t\t\t\t\t\t\t 0xC023);\n \t\t\t\thw->phy.ops.release(hw);\n \t\t\t\tif (ret_val)\n-\t\t\t\t\treturn ret_val;\n+\t\t\t\t\tgoto out;\n \n \t\t\t}\n \t\t}\n@@ -1518,7 +1519,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t (hw->adapter->pdev->device == E1000_DEV_ID_PCH_I218_V3)) {\n \t\tret_val = e1000_k1_workaround_lpt_lp(hw, link);\n \t\tif (ret_val)\n-\t\t\treturn ret_val;\n+\t\t\tgoto out;\n \t}\n \tif (hw->mac.type >= e1000_pch_lpt) {\n \t\t/* Set platform power management values for\n@@ -1526,7 +1527,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t\t */\n \t\tret_val = e1000_platform_pm_pch_lpt(hw, link);\n \t\tif (ret_val)\n-\t\t\treturn ret_val;\n+\t\t\tgoto out;\n \t}\n \n \t/* Clear link partner's EEE ability */\n@@ -1549,9 +1550,7 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t}\n \n \tif (!link)\n-\t\treturn 0;\t/* No link detected */\n-\n-\tmac->get_link_status = false;\n+\t\tgoto out;\n \n \tswitch (hw->mac.type) {\n \tcase e1000_pch2lan:\n@@ -1617,6 +1616,10 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw)\n \t\te_dbg(\"Error configuring flow control\\n\");\n \n \treturn ret_val;\n+\n+out:\n+\tmac->get_link_status = true;\n+\treturn ret_val;\n }\n \n static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)\ndiff --git a/drivers/net/ethernet/intel/e1000e/mac.c b/drivers/net/ethernet/intel/e1000e/mac.c\nindex b322011ec282..5bdc3a2d4fd7 100644\n--- a/drivers/net/ethernet/intel/e1000e/mac.c\n+++ b/drivers/net/ethernet/intel/e1000e/mac.c\n@@ -424,19 +424,15 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)\n \t */\n \tif (!mac->get_link_status)\n \t\treturn 0;\n+\tmac->get_link_status = false;\n \n \t/* First we want to see if the MII Status Register reports\n \t * link. If so, then we want to get the current speed/duplex\n \t * of the PHY.\n \t */\n \tret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link);\n-\tif (ret_val)\n-\t\treturn ret_val;\n-\n-\tif (!link)\n-\t\treturn 0;\t/* No link detected */\n-\n-\tmac->get_link_status = false;\n+\tif (ret_val || !link)\n+\t\tgoto out;\n \n \t/* Check if there was DownShift, must be checked\n \t * immediately after link-up\n@@ -465,6 +461,10 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw)\n \t\te_dbg(\"Error configuring flow control\\n\");\n \n \treturn ret_val;\n+\n+out:\n+\tmac->get_link_status = true;\n+\treturn ret_val;\n }\n \n /**\n", "prefixes": [ "2/2" ] }