Message ID | 20210222013530.1356-1-liew.s.piaw@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] bcm63xx_enet: fix sporadic kernel panic | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | fail | Series targets non-next tree, but doesn't contain any Fixes tags |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 2 maintainers not CCed: leon@kernel.org tangbin@cmss.chinamobile.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 32 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On 2/21/2021 17:35, Sieng Piaw Liew wrote: > In ndo_stop functions, netdev_completed_queue() is called during forced > tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if > there is any tx skb left. > > This patch moves netdev_reset_queue() to after tx reclaim, so BQL can > complete successfully then reset. > > Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support")
On Sun, 21 Feb 2021 21:05:50 -0800 Florian Fainelli wrote: > On 2/21/2021 17:35, Sieng Piaw Liew wrote: > > In ndo_stop functions, netdev_completed_queue() is called during forced > > tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if > > there is any tx skb left. > > > > This patch moves netdev_reset_queue() to after tx reclaim, so BQL can > > complete successfully then reset. > > > > Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com> > > Acked-by: Florian Fainelli <f.fainelli@gmail.com> > Fixes: 4c59b0f5543d ("bcm63xx_enet: add BQL support") Applied, thanks!
diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index fd8767213165..977f097fc7bf 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1192,7 +1192,6 @@ static int bcm_enet_stop(struct net_device *dev) kdev = &priv->pdev->dev; netif_stop_queue(dev); - netdev_reset_queue(dev); napi_disable(&priv->napi); if (priv->has_phy) phy_stop(dev->phydev); @@ -1231,6 +1230,9 @@ static int bcm_enet_stop(struct net_device *dev) if (priv->has_phy) phy_disconnect(dev->phydev); + /* reset BQL after forced tx reclaim to prevent kernel panic */ + netdev_reset_queue(dev); + return 0; } @@ -2343,7 +2345,6 @@ static int bcm_enetsw_stop(struct net_device *dev) del_timer_sync(&priv->swphy_poll); netif_stop_queue(dev); - netdev_reset_queue(dev); napi_disable(&priv->napi); del_timer_sync(&priv->rx_timeout); @@ -2371,6 +2372,9 @@ static int bcm_enetsw_stop(struct net_device *dev) free_irq(priv->irq_tx, dev); free_irq(priv->irq_rx, dev); + /* reset BQL after forced tx reclaim to prevent kernel panic */ + netdev_reset_queue(dev); + return 0; }
In ndo_stop functions, netdev_completed_queue() is called during forced tx reclaim, after netdev_reset_queue(). This may trigger kernel panic if there is any tx skb left. This patch moves netdev_reset_queue() to after tx reclaim, so BQL can complete successfully then reset. Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com> --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)