Message ID | 20190731183116.4791-1-mcroce@redhat.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [net] mvpp2: fix panic on module removal | expand |
Hi Matteo, On Wed, Jul 31, 2019 at 08:31:16PM +0200, Matteo Croce wrote: > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > index c51f1d5b550b..5002d51fc9d6 100644 > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > @@ -5760,7 +5760,6 @@ static int mvpp2_remove(struct platform_device *pdev) > mvpp2_dbgfs_cleanup(priv); > > flush_workqueue(priv->stats_queue); > - destroy_workqueue(priv->stats_queue); > > fwnode_for_each_available_child_node(fwnode, port_fwnode) { > if (priv->port_list[i]) { > @@ -5770,6 +5769,8 @@ static int mvpp2_remove(struct platform_device *pdev) > i++; > } Shouldn't you also move flush_workqueue() here? > + destroy_workqueue(priv->stats_queue); > + > for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { > struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i]; Thanks! Antoine
On Thu, Aug 1, 2019 at 9:18 AM Antoine Tenart <antoine.tenart@bootlin.com> wrote: > > Hi Matteo, > > On Wed, Jul 31, 2019 at 08:31:16PM +0200, Matteo Croce wrote: > > > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > index c51f1d5b550b..5002d51fc9d6 100644 > > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > @@ -5760,7 +5760,6 @@ static int mvpp2_remove(struct platform_device *pdev) > > mvpp2_dbgfs_cleanup(priv); > > > > flush_workqueue(priv->stats_queue); > > - destroy_workqueue(priv->stats_queue); > > > > fwnode_for_each_available_child_node(fwnode, port_fwnode) { > > if (priv->port_list[i]) { > > @@ -5770,6 +5769,8 @@ static int mvpp2_remove(struct platform_device *pdev) > > i++; > > } > > Shouldn't you also move flush_workqueue() here? > I think that that flush it's unneeded at all, as all port remove calls cancel_delayed_work_sync(). I tried removing it and it doesn't crash on rmmod. -- Matteo Croce per aspera ad upstream
On Thu, Aug 01, 2019 at 01:46:39PM +0200, Matteo Croce wrote: > On Thu, Aug 1, 2019 at 9:18 AM Antoine Tenart > <antoine.tenart@bootlin.com> wrote: > > On Wed, Jul 31, 2019 at 08:31:16PM +0200, Matteo Croce wrote: > > > > > > diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > > index c51f1d5b550b..5002d51fc9d6 100644 > > > --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > > +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c > > > @@ -5760,7 +5760,6 @@ static int mvpp2_remove(struct platform_device *pdev) > > > mvpp2_dbgfs_cleanup(priv); > > > > > > flush_workqueue(priv->stats_queue); > > > - destroy_workqueue(priv->stats_queue); > > > > > > fwnode_for_each_available_child_node(fwnode, port_fwnode) { > > > if (priv->port_list[i]) { > > > @@ -5770,6 +5769,8 @@ static int mvpp2_remove(struct platform_device *pdev) > > > i++; > > > } > > > > Shouldn't you also move flush_workqueue() here? > > I think that that flush it's unneeded at all, as all port remove calls > cancel_delayed_work_sync(). > > I tried removing it and it doesn't crash on rmmod. I was wondering this, and looking at the documentation it seems to me removing flush_workqueue() should be fine. Thanks! Antoine
From: Matteo Croce <mcroce@redhat.com> Date: Wed, 31 Jul 2019 20:31:16 +0200 > mvpp2 uses a delayed workqueue to gather traffic statistics. > On module removal the workqueue can be destroyed before calling > cancel_delayed_work_sync() on its works. > Fix it by moving the destroy_workqueue() call after mvpp2_port_remove(). Please post a new version with the flush_workqueue() removed.
On Mon, Aug 5, 2019 at 7:58 PM David Miller <davem@davemloft.net> wrote: > > From: Matteo Croce <mcroce@redhat.com> > Date: Wed, 31 Jul 2019 20:31:16 +0200 > > > mvpp2 uses a delayed workqueue to gather traffic statistics. > > On module removal the workqueue can be destroyed before calling > > cancel_delayed_work_sync() on its works. > > Fix it by moving the destroy_workqueue() call after mvpp2_port_remove(). > > Please post a new version with the flush_workqueue() removed. Hi, I thought that it was already merged: https://lore.kernel.org/netdev/20190801121330.30823-1-mcroce@redhat.com/ Let me know if it's ok already. Regards,
From: Matteo Croce <mcroce@redhat.com> Date: Mon, 5 Aug 2019 20:17:39 +0200 > On Mon, Aug 5, 2019 at 7:58 PM David Miller <davem@davemloft.net> wrote: >> >> From: Matteo Croce <mcroce@redhat.com> >> Date: Wed, 31 Jul 2019 20:31:16 +0200 >> >> > mvpp2 uses a delayed workqueue to gather traffic statistics. >> > On module removal the workqueue can be destroyed before calling >> > cancel_delayed_work_sync() on its works. >> > Fix it by moving the destroy_workqueue() call after mvpp2_port_remove(). >> >> Please post a new version with the flush_workqueue() removed. > > Hi, > > I thought that it was already merged: > > https://lore.kernel.org/netdev/20190801121330.30823-1-mcroce@redhat.com/ > > Let me know if it's ok already. Oops, my bad. :-)
diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c index c51f1d5b550b..5002d51fc9d6 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c @@ -5760,7 +5760,6 @@ static int mvpp2_remove(struct platform_device *pdev) mvpp2_dbgfs_cleanup(priv); flush_workqueue(priv->stats_queue); - destroy_workqueue(priv->stats_queue); fwnode_for_each_available_child_node(fwnode, port_fwnode) { if (priv->port_list[i]) { @@ -5770,6 +5769,8 @@ static int mvpp2_remove(struct platform_device *pdev) i++; } + destroy_workqueue(priv->stats_queue); + for (i = 0; i < MVPP2_BM_POOLS_NUM; i++) { struct mvpp2_bm_pool *bm_pool = &priv->bm_pools[i];