Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1172931/?format=api
{ "id": 1172931, "url": "http://patchwork.ozlabs.org/api/patches/1172931/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20191007172559.11166.29328.stgit@localhost.localdomain/", "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": "<20191007172559.11166.29328.stgit@localhost.localdomain>", "list_archive_url": null, "date": "2019-10-07T17:27:55", "name": "[RFC,v2] e1000e: Use rtnl_lock to prevent race conditions between net and pci/pm", "commit_ref": null, "pull_url": null, "state": "rfc", "archived": false, "hash": "2034526332f10f46aa6192ab014e7c323f0f0e85", "submitter": { "id": 252, "url": "http://patchwork.ozlabs.org/api/people/252/?format=api", "name": "Alexander Duyck", "email": "alexander.duyck@gmail.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/20191007172559.11166.29328.stgit@localhost.localdomain/mbox/", "series": [ { "id": 134684, "url": "http://patchwork.ozlabs.org/api/series/134684/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=134684", "date": "2019-10-07T17:27:55", "name": "[RFC,v2] e1000e: Use rtnl_lock to prevent race conditions between net and pci/pm", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/134684/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1172931/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1172931/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>)", "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=gmail.com", "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"RVrYNxEC\"; dkim-atps=neutral" ], "Received": [ "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 46n6rL2CcKz9sPF\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 8 Oct 2019 04:28:02 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id B4E6887702;\n\tMon, 7 Oct 2019 17:28:00 +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 j7bqzWJGXDNw; Mon, 7 Oct 2019 17:27:59 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id AD11D87216;\n\tMon, 7 Oct 2019 17:27:59 +0000 (UTC)", "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 1C9DD1BF419\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 7 Oct 2019 17:27:58 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 1871E86483\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 7 Oct 2019 17:27:58 +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 23rZ6meOZCQb for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 7 Oct 2019 17:27:57 +0000 (UTC)", "from mail-pf1-f193.google.com (mail-pf1-f193.google.com\n\t[209.85.210.193])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 3D3598646F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 7 Oct 2019 17:27:57 +0000 (UTC)", "by mail-pf1-f193.google.com with SMTP id q7so9064946pfh.8\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 07 Oct 2019 10:27:57 -0700 (PDT)", "from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0])\n\tby smtp.gmail.com with ESMTPSA id\n\tk95sm115110pje.10.2019.10.07.10.27.55\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tMon, 07 Oct 2019 10:27:55 -0700 (PDT)" ], "X-Virus-Scanned": [ "amavisd-new at osuosl.org", "amavisd-new at osuosl.org" ], "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:from:to:cc:date:message-id:in-reply-to:references\n\t:user-agent:mime-version:content-transfer-encoding;\n\tbh=rewVBm4IqqEvTaYiuvZUBNZZiDgXMthoGgqbVwwE7fI=;\n\tb=RVrYNxECPmgNvxSfK06La7b07vRhlukaBBdvvvYhmTRZo+aO+qTFH2ZblgGiJxB9/5\n\tOvP5MHzQJKg0rzKqupUtvizgdPVhCKRAfrl49yPNVOVlXxRj4npFks9mYqju8oOCAGQA\n\tdGvcGzd+f++le3NzgBXVDh49kuno995vYdpX8WI3wyUL4iMiYtAfbzX3WrQnWf8RTa93\n\toupjUTkdAb3z8UShfYW7aIlM2F3OFyXoVUq5uLaols5fO7kLCvhUr4DbN49+FIN01Lyu\n\thBW1an4CIKtF0lcrO6Yfz34VNGvjnv0RBxADmA2g5Paue/HhIaFbgH57xCO8M/TXH8An\n\tBGcA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to\n\t:references:user-agent:mime-version:content-transfer-encoding;\n\tbh=rewVBm4IqqEvTaYiuvZUBNZZiDgXMthoGgqbVwwE7fI=;\n\tb=hJSS6bDxZhSsWZRVAWwtLclJgXhMXs9vX/OV9eJVONFWsuctNO+A1W6FQFHRp2JDUv\n\t5lHrI3JrTs+KG9vXbFG0qWLCdtOFPiiKrk8xHIl6S/g+e4r8xxNRxLFyVq4o1B4Msju7\n\ttVGV26tB5FNfhLbT4Pbz7IfYPp2QGw9uQ2/Uk+cY6exqlloU53sy2GBwkdmc0/eyStRw\n\tI+eBKtvLKgj8Si0YN9w+5os4LiLs1dKsA89Oez9EeuN1pZXLhvJhtvHco39khiA+lheY\n\t8iTDIK5qK4+NZnNfWnjbayvi+jHi6bCTUtKRO7/z3xYhAvhoiZdbIet/xbDDs+drjbhW\n\tZ6gA==", "X-Gm-Message-State": "APjAAAWquQ3T9Dl8r9JQhF52jNLx/IQeacibrY5afKCK+oPCyuF80KTK\n\t5L+ejbqWmZhKpbJ8CqP+/fo=", "X-Google-Smtp-Source": "APXvYqyBCbO+Qi4CHuA8UQrMr7Jemry4iV0QSvxPw701kJ52QWmD9TrnfhS56eXUMVEYY/OzlknSgg==", "X-Received": "by 2002:a17:90a:1aa9:: with SMTP id\n\tp38mr447244pjp.142.1570469276472; \n\tMon, 07 Oct 2019 10:27:56 -0700 (PDT)", "From": "Alexander Duyck <alexander.duyck@gmail.com>", "To": "alexander.duyck@gmail.com", "Date": "Mon, 07 Oct 2019 10:27:55 -0700", "Message-ID": "<20191007172559.11166.29328.stgit@localhost.localdomain>", "In-Reply-To": "<CAKgT0UdwqGGKvaSJ+3vd-_d-6t9MB=No+7SpkbOT2PnynRK+2w@mail.gmail.com>", "References": "<CAKgT0UdwqGGKvaSJ+3vd-_d-6t9MB=No+7SpkbOT2PnynRK+2w@mail.gmail.com>", "User-Agent": "StGit/0.17.1-dirty", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [RFC PATCH v2] e1000e: Use rtnl_lock to prevent\n\trace conditions between net and pci/pm", "X-BeenThere": "intel-wired-lan@osuosl.org", "X-Mailman-Version": "2.1.29", "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": "zdai@linux.vnet.ibm.com, netdev@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org,\n\tzdai@us.ibm.com, davem@davemloft.net", "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: Alexander Duyck <alexander.h.duyck@linux.intel.com>\n\nThis patch is meant to address possible race conditions that can exist\nbetween network configuration and power management. A similar issue was\nfixed for igb in commit 9474933caf21 (\"igb: close/suspend race in\nnetif_device_detach\").\n\nIn addition it consolidates the code so that the PCI error handling code\nwill essentially perform the power management freeze on the device prior to\nattempting a reset, and will thaw the device afterwards if that is what it\nis planning to do. Otherwise when we call close on the interface it should\nsee it is detached and not attempt to call the logic to down the interface\nand free the IRQs again.\n\n>From what I can tell the check that was adding the check for __E1000_DOWN\nin e1000e_close was added when runtime power management was added. However\nit should not be relevant for us as we perform a call to\npm_runtime_get_sync before we call e1000_down/free_irq so it should always\nbe back up before we call into this anyway.\n\nSigned-off-by: Alexander Duyck <alexander.h.duyck@linux.intel.com>\n---\n\nRFC v2: Dropped some unused variables\n\tAdded logic to check for device present before removing to pm_freeze\n\tFixed misplaced err_irq to before rtnl_unlock()\n\n drivers/net/ethernet/intel/e1000e/netdev.c | 40 +++++++++++++++-------------\n 1 file changed, 21 insertions(+), 19 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c\nindex d7d56e42a6aa..8b4e589aca36 100644\n--- a/drivers/net/ethernet/intel/e1000e/netdev.c\n+++ b/drivers/net/ethernet/intel/e1000e/netdev.c\n@@ -4715,12 +4715,12 @@ int e1000e_close(struct net_device *netdev)\n \n \tpm_runtime_get_sync(&pdev->dev);\n \n-\tif (!test_bit(__E1000_DOWN, &adapter->state)) {\n+\tif (netif_device_present(netdev)) {\n \t\te1000e_down(adapter, true);\n \t\te1000_free_irq(adapter);\n \n \t\t/* Link status message must follow this format */\n-\t\tpr_info(\"%s NIC Link is Down\\n\", adapter->netdev->name);\n+\t\tpr_info(\"%s NIC Link is Down\\n\", netdev->name);\n \t}\n \n \tnapi_disable(&adapter->napi);\n@@ -6298,10 +6298,14 @@ static int e1000e_pm_freeze(struct device *dev)\n {\n \tstruct net_device *netdev = dev_get_drvdata(dev);\n \tstruct e1000_adapter *adapter = netdev_priv(netdev);\n+\tbool present;\n \n+\trtnl_lock();\n+\n+\tpresent = netif_device_present(netdev);\n \tnetif_device_detach(netdev);\n \n-\tif (netif_running(netdev)) {\n+\tif (present && netif_running(netdev)) {\n \t\tint count = E1000_CHECK_RESET_COUNT;\n \n \t\twhile (test_bit(__E1000_RESETTING, &adapter->state) && count--)\n@@ -6313,6 +6317,8 @@ static int e1000e_pm_freeze(struct device *dev)\n \t\te1000e_down(adapter, false);\n \t\te1000_free_irq(adapter);\n \t}\n+\trtnl_unlock();\n+\n \te1000e_reset_interrupt_capability(adapter);\n \n \t/* Allow time for pending master requests to run */\n@@ -6626,27 +6632,31 @@ static int __e1000_resume(struct pci_dev *pdev)\n \treturn 0;\n }\n \n-#ifdef CONFIG_PM_SLEEP\n static int e1000e_pm_thaw(struct device *dev)\n {\n \tstruct net_device *netdev = dev_get_drvdata(dev);\n \tstruct e1000_adapter *adapter = netdev_priv(netdev);\n+\tint rc = 0;\n \n \te1000e_set_interrupt_capability(adapter);\n-\tif (netif_running(netdev)) {\n-\t\tu32 err = e1000_request_irq(adapter);\n \n-\t\tif (err)\n-\t\t\treturn err;\n+\trtnl_lock();\n+\tif (netif_running(netdev)) {\n+\t\trc = e1000_request_irq(adapter);\n+\t\tif (rc)\n+\t\t\tgoto err_irq;\n \n \t\te1000e_up(adapter);\n \t}\n \n \tnetif_device_attach(netdev);\n+err_irq:\n+\trtnl_unlock();\n \n-\treturn 0;\n+\treturn rc;\n }\n \n+#ifdef CONFIG_PM_SLEEP\n static int e1000e_pm_suspend(struct device *dev)\n {\n \tstruct pci_dev *pdev = to_pci_dev(dev);\n@@ -6818,16 +6828,11 @@ static void e1000_netpoll(struct net_device *netdev)\n static pci_ers_result_t e1000_io_error_detected(struct pci_dev *pdev,\n \t\t\t\t\t\tpci_channel_state_t state)\n {\n-\tstruct net_device *netdev = pci_get_drvdata(pdev);\n-\tstruct e1000_adapter *adapter = netdev_priv(netdev);\n-\n-\tnetif_device_detach(netdev);\n+\te1000e_pm_freeze(&pdev->dev);\n \n \tif (state == pci_channel_io_perm_failure)\n \t\treturn PCI_ERS_RESULT_DISCONNECT;\n \n-\tif (netif_running(netdev))\n-\t\te1000e_down(adapter, true);\n \tpci_disable_device(pdev);\n \n \t/* Request a slot slot reset. */\n@@ -6893,10 +6898,7 @@ static void e1000_io_resume(struct pci_dev *pdev)\n \n \te1000_init_manageability_pt(adapter);\n \n-\tif (netif_running(netdev))\n-\t\te1000e_up(adapter);\n-\n-\tnetif_device_attach(netdev);\n+\te1000e_pm_thaw(&pdev->dev);\n \n \t/* If the controller has AMT, do not set DRV_LOAD until the interface\n \t * is up. For all other cases, let the f/w know that the h/w is now\n", "prefixes": [ "RFC", "v2" ] }