{"id":813550,"url":"http://patchwork.ozlabs.org/api/patches/813550/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1505324525-9998-1-git-send-email-geert+renesas@glider.be/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505324525-9998-1-git-send-email-geert+renesas@glider.be>","list_archive_url":null,"date":"2017-09-13T17:42:05","name":"[v2] net: smsc911x: Quieten netif during suspend","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"333f9adfa4066b10489d3d8d5ae58ad6b24d069f","submitter":{"id":63808,"url":"http://patchwork.ozlabs.org/api/people/63808/?format=json","name":"Geert Uytterhoeven","email":"geert+renesas@glider.be"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1505324525-9998-1-git-send-email-geert+renesas@glider.be/mbox/","series":[{"id":2957,"url":"http://patchwork.ozlabs.org/api/series/2957/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=2957","date":"2017-09-13T17:42:05","name":"[v2] net: smsc911x: Quieten netif during suspend","version":2,"mbox":"http://patchwork.ozlabs.org/series/2957/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/813550/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/813550/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@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=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xsprw0lHgz9sNV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 14 Sep 2017 03:42:24 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751421AbdIMRmQ (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 13 Sep 2017 13:42:16 -0400","from andre.telenet-ops.be ([195.130.132.53]:52528 \"EHLO\n\tandre.telenet-ops.be\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751117AbdIMRmO (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Wed, 13 Sep 2017 13:42:14 -0400","from ayla.of.borg ([84.195.106.246])\n\tby andre.telenet-ops.be with bizsmtp\n\tid 95iC1w0095JzmfG015iCl0; Wed, 13 Sep 2017 19:42:13 +0200","from ramsan.of.borg ([192.168.97.29] helo=ramsan)\n\tby ayla.of.borg with esmtp (Exim 4.86_2)\n\t(envelope-from <geert@linux-m68k.org>)\n\tid 1dsBfs-00047w-7o; Wed, 13 Sep 2017 19:42:08 +0200","from geert by ramsan with local (Exim 4.86_2)\n\t(envelope-from <geert@linux-m68k.org>)\n\tid 1dsBfw-0002bz-C8; Wed, 13 Sep 2017 19:42:12 +0200"],"From":"Geert Uytterhoeven <geert+renesas@glider.be>","To":"\"David S . Miller\" <davem@davemloft.net>,\n\tSteve Glendinning <steve.glendinning@shawell.net>","Cc":"Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>,\n\tnetdev@vger.kernel.org, linux-pm@vger.kernel.org,\n\tlinux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tGeert Uytterhoeven <geert+renesas@glider.be>","Subject":"[PATCH v2] net: smsc911x: Quieten netif during suspend","Date":"Wed, 13 Sep 2017 19:42:05 +0200","Message-Id":"<1505324525-9998-1-git-send-email-geert+renesas@glider.be>","X-Mailer":"git-send-email 2.7.4","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"If the network interface is kept running during suspend, the net core\nmay call net_device_ops.ndo_start_xmit() while the Ethernet device is\nstill suspended, which may lead to a system crash.\n\nE.g. on sh73a0/kzm9g and r8a73a4/ape6evm, the external Ethernet chip is\ndriven by a PM controlled clock.  If the Ethernet registers are accessed\nwhile the clock is not running, the system will crash with an imprecise\nexternal abort.\n\nAs this is a race condition with a small time window, it is not so easy\nto trigger at will.  Using pm_test may increase your chances:\n\n    # echo 0 > /sys/module/printk/parameters/console_suspend\n    # echo platform > /sys/power/pm_test\n    # echo mem > /sys/power/state\n\nTo fix this, make sure the network interface is quietened during\nsuspend.\n\nSigned-off-by: Geert Uytterhoeven <geert+renesas@glider.be>\n---\nThis is v2 of the series \"[PATCH 0/2] net: Fix crashes due to activity\nduring suspend\", which degenerated into a single patch after commit\nebc8254aeae34226 (\"Revert \"net: phy: Correctly process PHY_HALTED in\nphy_stop_machine()\"\") made \"[PATCH 1/2] net: phy: Freeze PHY polling before\nsuspending devices\" no longer needed.\n\nv2:\n  - Spelling s/quit/quiet/g.\n\nNo stacktrace is provided, as the imprecise external abort is usually\nreported from an innocent looking and unrelated function like\n__loop_delay(), cpu_idle_poll(), or arch_timer_read_counter_long().\n---\n drivers/net/ethernet/smsc/smsc911x.c | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)","diff":"diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c\nindex 0b6a39b003a4e188..012fb66eed8dd618 100644\n--- a/drivers/net/ethernet/smsc/smsc911x.c\n+++ b/drivers/net/ethernet/smsc/smsc911x.c\n@@ -2595,6 +2595,11 @@ static int smsc911x_suspend(struct device *dev)\n \tstruct net_device *ndev = dev_get_drvdata(dev);\n \tstruct smsc911x_data *pdata = netdev_priv(ndev);\n \n+\tif (netif_running(ndev)) {\n+\t\tnetif_stop_queue(ndev);\n+\t\tnetif_device_detach(ndev);\n+\t}\n+\n \t/* enable wake on LAN, energy detection and the external PME\n \t * signal. */\n \tsmsc911x_reg_write(pdata, PMT_CTRL,\n@@ -2628,7 +2633,15 @@ static int smsc911x_resume(struct device *dev)\n \twhile (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to)\n \t\tudelay(1000);\n \n-\treturn (to == 0) ? -EIO : 0;\n+\tif (to == 0)\n+\t\treturn -EIO;\n+\n+\tif (netif_running(ndev)) {\n+\t\tnetif_device_attach(ndev);\n+\t\tnetif_start_queue(ndev);\n+\t}\n+\n+\treturn 0;\n }\n \n static const struct dev_pm_ops smsc911x_pm_ops = {\n","prefixes":["v2"]}