[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM4PR0401MB22601ACDFB926E5AE58A0B69FF8B0@AM4PR0401MB2260.eurprd04.prod.outlook.com>
Date: Sun, 27 Nov 2016 06:25:54 +0000
From: Andy Duan <fugang.duan@....com>
To: Nikita Yushchenko <nikita.yoush@...entembedded.com>,
"David S. Miller" <davem@...emloft.net>,
Troy Kisky <troy.kisky@...ndarydevices.com>,
"Andrew Lunn" <andrew@...n.ch>, Eric Nelson <eric@...int.com>,
Philippe Reynes <tremyfr@...il.com>,
Johannes Berg <johannes@...solutions.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: Chris Healy <cphealy@...il.com>
Subject: RE: [PATCH] net: fec: turn on device when extracting statistics
From: Nikita Yushchenko <nikita.yoush@...entembedded.com> Sent: Friday, November 25, 2016 6:02 PM
>To: Andy Duan <fugang.duan@....com>; David S. Miller
><davem@...emloft.net>; Troy Kisky <troy.kisky@...ndarydevices.com>;
>Andrew Lunn <andrew@...n.ch>; Eric Nelson <eric@...int.com>; Philippe
>Reynes <tremyfr@...il.com>; Johannes Berg <johannes@...solutions.net>;
>netdev@...r.kernel.org; linux-kernel@...r.kernel.org
>Cc: Chris Healy <cphealy@...il.com>; Nikita Yushchenko
><nikita.yoush@...entembedded.com>
>Subject: [PATCH] net: fec: turn on device when extracting statistics
>
>Execution 'ethtool -S' on fec device that is down causes OOPS on Vybrid
>board:
>
>Unhandled fault: external abort on non-linefetch (0x1008) at 0xe0898200 pgd
>= ddecc000 [e0898200] *pgd=9e406811, *pte=400d1653, *ppte=400d1453
>Internal error: : 1008 [#1] SMP ARM ...
>
>Reason of OOPS is that fec_enet_get_ethtool_stats() accesses fec registers
>while IPG clock is stopped by PM.
>
>Fix that by wrapping statistics extraction into pm_runtime_get_sync() ...
>pm_runtime_put_autosuspend() braces.
>
>Signed-off-by: Nikita Yushchenko <nikita.yoush@...entembedded.com>
>---
Acked-by: Fugang Duan <fugang.duan@....com>
> drivers/net/ethernet/freescale/fec_main.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/freescale/fec_main.c
>b/drivers/net/ethernet/freescale/fec_main.c
>index 5aa9d4ded214..9c7592b80ce8 100644
>--- a/drivers/net/ethernet/freescale/fec_main.c
>+++ b/drivers/net/ethernet/freescale/fec_main.c
>@@ -2317,10 +2317,19 @@ static void fec_enet_get_ethtool_stats(struct
>net_device *dev,
> struct ethtool_stats *stats, u64 *data) {
> struct fec_enet_private *fep = netdev_priv(dev);
>- int i;
>+ int i, ret;
>+
>+ ret = pm_runtime_get_sync(&fep->pdev->dev);
>+ if (IS_ERR_VALUE(ret)) {
>+ memset(data, 0, sizeof(*data) * ARRAY_SIZE(fec_stats));
>+ return;
>+ }
>
> for (i = 0; i < ARRAY_SIZE(fec_stats); i++)
> data[i] = readl(fep->hwp + fec_stats[i].offset);
>+
>+ pm_runtime_mark_last_busy(&fep->pdev->dev);
>+ pm_runtime_put_autosuspend(&fep->pdev->dev);
> }
>
> static void fec_enet_get_strings(struct net_device *netdev,
>--
>2.1.4
Powered by blists - more mailing lists