netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
@ 2022-02-09 15:57 Ioana Ciornei
  2022-02-09 18:43 ` AW: " Richter, Rafael
  2022-02-10 15:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Ioana Ciornei @ 2022-02-09 15:57 UTC (permalink / raw)
  To: davem, kuba, netdev
  Cc: Rafael Richter, Daniel Klauer, Robert-Ionut Alexa, Ioana Ciornei

From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>

The netdev should be unregistered before we are disconnecting from the
MAC/PHY so that the dev_close callback is called and the PHY and the
phylink workqueues are actually stopped before we are disconnecting and
destroying the phylink instance.

Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index e985ae008a97..dd9385d15f6b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4523,12 +4523,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
 #ifdef CONFIG_DEBUG_FS
 	dpaa2_dbg_remove(priv);
 #endif
+
+	unregister_netdev(net_dev);
 	rtnl_lock();
 	dpaa2_eth_disconnect_mac(priv);
 	rtnl_unlock();
 
-	unregister_netdev(net_dev);
-
 	dpaa2_eth_dl_port_del(priv);
 	dpaa2_eth_dl_traps_unregister(priv);
 	dpaa2_eth_dl_free(priv);
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* AW: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
  2022-02-09 15:57 [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY Ioana Ciornei
@ 2022-02-09 18:43 ` Richter, Rafael
  2022-02-10  8:54   ` Richter, Rafael
  2022-02-10 15:30 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 6+ messages in thread
From: Richter, Rafael @ 2022-02-09 18:43 UTC (permalink / raw)
  To: Ioana Ciornei, davem, kuba, netdev; +Cc: Klauer, Daniel, Robert-Ionut Alexa

Hi Ioana!

I've been testing this patch. However, I'm still facing the same kernel panic during shutdown if a SGMII interface was activated before.

Here is the stack trace:

[   96.923647] systemd-shutdown[1]: Rebooting.
[   97.461827] fsl-mc dpbp.9: Removing from iommu group 7
[   97.838899] fsl-mc dpbp.8: Removing from iommu group 7
[   98.206385] fsl-mc dpbp.7: Removing from iommu group 7
[   98.554855] fsl-mc dpbp.6: Removing from iommu group 7
[   98.815498] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   98.816624] Mem abort info:
[   98.816981]   ESR = 0x86000004
[   98.817371]   EC = 0x21: IABT (current EL), IL = 32 bits
[   98.818046]   SET = 0, FnV = 0
[   98.818436]   EA = 0, S1PTW = 0
[   98.818837]   FSC = 0x04: level 0 translation fault
[   98.819456] user pgtable: 4k pages, 48-bit VAs, pgdp=00000020835d7000
[   98.820273] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[   98.821140] Internal error: Oops: 86000004 [#1] PREEMPT SMP
[   98.821848] Modules linked in:
[   98.822241] CPU: 15 PID: 0 Comm: swapper/15 Not tainted 5.17.0-rc2-00212-g3bed06e36994-dirty #1
[   98.823345] Hardware name: mpxlx2160a-gl6 (DT)
[   98.823909] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   98.824794] pc : 0x0
[   98.825077] lr : call_timer_fn.constprop.0+0x20/0x80
[   98.825717] sp : ffff80000943ba40
[   98.826139] x29: ffff80000943ba40 x28: 0000000000000000 x27: ffff80000943bad0
[   98.827052] x26: ffff0020002ff140 x25: ffff800008ee6980 x24: ffff00267c19fd28
[   98.827963] x23: ffff80000943bad0 x22: 0000000000000000 x21: 0000000000000101
[   98.828873] x20: ffff0020002ff140 x19: 0000000000000000 x18: fffffc0080035a48
[   98.829783] x17: ffff8026733ae000 x16: ffff80000807c000 x15: 0000000000004000
[   98.830693] x14: 00000000000003d0 x13: 0000000000000000 x12: 00000000000001e2
[   98.831602] x11: 00000000000003a6 x10: ffff8026733ae000 x9 : ffff00267c19fd70
[   98.832511] x8 : 0000000000000001 x7 : ffffffffffffffff x6 : 0000000000000000
[   98.833420] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000200
[   98.834329] x2 : 0000000000000200 x1 : 0000000000000000 x0 : ffff0020030872b0
[   98.835239] Call trace:
[   98.835552]  0x0
[   98.835790]  __run_timers.part.0+0x1e8/0x220
[   98.836338]  run_timer_softirq+0x38/0x70
[   98.836840]  _stext+0x124/0x29c
[   98.837244]  __irq_exit_rcu+0xdc/0xfc
[   98.837716]  irq_exit_rcu+0xc/0x14
[   98.838153]  el1_interrupt+0x34/0x80
[   98.838617]  el1h_64_irq_handler+0x14/0x1c
[   98.839140]  el1h_64_irq+0x78/0x7c
[   98.839575]  cpuidle_enter_state+0x12c/0x314
[   98.840121]  cpuidle_enter+0x34/0x4c
[   98.840577]  do_idle+0x1f0/0x254
[   98.840994]  cpu_startup_entry+0x20/0x70
[   98.841497]  secondary_start_kernel+0x13c/0x160
[   98.842076]  __secondary_switched+0x54/0x58
[   98.842618] Code: bad PC value
[   98.843010] ---[ end trace 0000000000000000 ]---
[   98.843597] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[   98.844479] Kernel Offset: disabled
[   98.844922] CPU features: 0x10,00000042,40000842
[   98.845510] Memory Limit: none
[   98.845901] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---

BR,

Rafael Richter
________________________________________
Von: Ioana Ciornei <ioana.ciornei@nxp.com>
Gesendet: Mittwoch, 9. Februar 2022 16:57
An: davem@davemloft.net; kuba@kernel.org; netdev@vger.kernel.org
Cc: Richter, Rafael; Klauer, Daniel; Robert-Ionut Alexa; Ioana Ciornei
Betreff: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY

From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>

The netdev should be unregistered before we are disconnecting from the
MAC/PHY so that the dev_close callback is called and the PHY and the
phylink workqueues are actually stopped before we are disconnecting and
destroying the phylink instance.

Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index e985ae008a97..dd9385d15f6b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4523,12 +4523,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
 #ifdef CONFIG_DEBUG_FS
        dpaa2_dbg_remove(priv);
 #endif
+
+       unregister_netdev(net_dev);
        rtnl_lock();
        dpaa2_eth_disconnect_mac(priv);
        rtnl_unlock();

-       unregister_netdev(net_dev);
-
        dpaa2_eth_dl_port_del(priv);
        dpaa2_eth_dl_traps_unregister(priv);
        dpaa2_eth_dl_free(priv);
--
2.33.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* AW: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
  2022-02-09 18:43 ` AW: " Richter, Rafael
@ 2022-02-10  8:54   ` Richter, Rafael
  2022-02-10  9:40     ` Ioana Ciornei
  0 siblings, 1 reply; 6+ messages in thread
From: Richter, Rafael @ 2022-02-10  8:54 UTC (permalink / raw)
  To: Ioana Ciornei, davem, kuba, netdev; +Cc: Klauer, Daniel, Robert-Ionut Alexa

Hi Ioana!

please ignore the previous mail. Everything works now fine. It was a local issue with my setup.

BR,

Rafael
________________________________________
Von: Richter, Rafael
Gesendet: Mittwoch, 9. Februar 2022 19:43
An: Ioana Ciornei; davem@davemloft.net; kuba@kernel.org; netdev@vger.kernel.org
Cc: Klauer, Daniel; Robert-Ionut Alexa
Betreff: AW: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY

Hi Ioana!

I've been testing this patch. However, I'm still facing the same kernel panic during shutdown if a SGMII interface was activated before.

Here is the stack trace:

[   96.923647] systemd-shutdown[1]: Rebooting.
[   97.461827] fsl-mc dpbp.9: Removing from iommu group 7
[   97.838899] fsl-mc dpbp.8: Removing from iommu group 7
[   98.206385] fsl-mc dpbp.7: Removing from iommu group 7
[   98.554855] fsl-mc dpbp.6: Removing from iommu group 7
[   98.815498] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
[   98.816624] Mem abort info:
[   98.816981]   ESR = 0x86000004
[   98.817371]   EC = 0x21: IABT (current EL), IL = 32 bits
[   98.818046]   SET = 0, FnV = 0
[   98.818436]   EA = 0, S1PTW = 0
[   98.818837]   FSC = 0x04: level 0 translation fault
[   98.819456] user pgtable: 4k pages, 48-bit VAs, pgdp=00000020835d7000
[   98.820273] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[   98.821140] Internal error: Oops: 86000004 [#1] PREEMPT SMP
[   98.821848] Modules linked in:
[   98.822241] CPU: 15 PID: 0 Comm: swapper/15 Not tainted 5.17.0-rc2-00212-g3bed06e36994-dirty #1
[   98.823345] Hardware name: mpxlx2160a-gl6 (DT)
[   98.823909] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   98.824794] pc : 0x0
[   98.825077] lr : call_timer_fn.constprop.0+0x20/0x80
[   98.825717] sp : ffff80000943ba40
[   98.826139] x29: ffff80000943ba40 x28: 0000000000000000 x27: ffff80000943bad0
[   98.827052] x26: ffff0020002ff140 x25: ffff800008ee6980 x24: ffff00267c19fd28
[   98.827963] x23: ffff80000943bad0 x22: 0000000000000000 x21: 0000000000000101
[   98.828873] x20: ffff0020002ff140 x19: 0000000000000000 x18: fffffc0080035a48
[   98.829783] x17: ffff8026733ae000 x16: ffff80000807c000 x15: 0000000000004000
[   98.830693] x14: 00000000000003d0 x13: 0000000000000000 x12: 00000000000001e2
[   98.831602] x11: 00000000000003a6 x10: ffff8026733ae000 x9 : ffff00267c19fd70
[   98.832511] x8 : 0000000000000001 x7 : ffffffffffffffff x6 : 0000000000000000
[   98.833420] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000200
[   98.834329] x2 : 0000000000000200 x1 : 0000000000000000 x0 : ffff0020030872b0
[   98.835239] Call trace:
[   98.835552]  0x0
[   98.835790]  __run_timers.part.0+0x1e8/0x220
[   98.836338]  run_timer_softirq+0x38/0x70
[   98.836840]  _stext+0x124/0x29c
[   98.837244]  __irq_exit_rcu+0xdc/0xfc
[   98.837716]  irq_exit_rcu+0xc/0x14
[   98.838153]  el1_interrupt+0x34/0x80
[   98.838617]  el1h_64_irq_handler+0x14/0x1c
[   98.839140]  el1h_64_irq+0x78/0x7c
[   98.839575]  cpuidle_enter_state+0x12c/0x314
[   98.840121]  cpuidle_enter+0x34/0x4c
[   98.840577]  do_idle+0x1f0/0x254
[   98.840994]  cpu_startup_entry+0x20/0x70
[   98.841497]  secondary_start_kernel+0x13c/0x160
[   98.842076]  __secondary_switched+0x54/0x58
[   98.842618] Code: bad PC value
[   98.843010] ---[ end trace 0000000000000000 ]---
[   98.843597] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[   98.844479] Kernel Offset: disabled
[   98.844922] CPU features: 0x10,00000042,40000842
[   98.845510] Memory Limit: none
[   98.845901] ---[ end Kernel panic - not syncing: Oops: Fatal exception in interrupt ]---

BR,

Rafael Richter
________________________________________
Von: Ioana Ciornei <ioana.ciornei@nxp.com>
Gesendet: Mittwoch, 9. Februar 2022 16:57
An: davem@davemloft.net; kuba@kernel.org; netdev@vger.kernel.org
Cc: Richter, Rafael; Klauer, Daniel; Robert-Ionut Alexa; Ioana Ciornei
Betreff: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY

From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>

The netdev should be unregistered before we are disconnecting from the
MAC/PHY so that the dev_close callback is called and the PHY and the
phylink workqueues are actually stopped before we are disconnecting and
destroying the phylink instance.

Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Signed-off-by: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index e985ae008a97..dd9385d15f6b 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4523,12 +4523,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *ls_dev)
 #ifdef CONFIG_DEBUG_FS
        dpaa2_dbg_remove(priv);
 #endif
+
+       unregister_netdev(net_dev);
        rtnl_lock();
        dpaa2_eth_disconnect_mac(priv);
        rtnl_unlock();

-       unregister_netdev(net_dev);
-
        dpaa2_eth_dl_port_del(priv);
        dpaa2_eth_dl_traps_unregister(priv);
        dpaa2_eth_dl_free(priv);
--
2.33.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
  2022-02-10  8:54   ` Richter, Rafael
@ 2022-02-10  9:40     ` Ioana Ciornei
  2022-02-10 10:17       ` AW: " Richter, Rafael
  0 siblings, 1 reply; 6+ messages in thread
From: Ioana Ciornei @ 2022-02-10  9:40 UTC (permalink / raw)
  To: Richter, Rafael; +Cc: davem, kuba, netdev, Klauer, Daniel, Robert-ionut Alexa

On Thu, Feb 10, 2022 at 08:54:34AM +0000, Richter, Rafael wrote:
> Hi Ioana!
> 
> please ignore the previous mail. Everything works now fine. It was a local issue with my setup.
> 
> BR,
> 


Hi Rafael,

Great to hear that the patch fixes the issue.
I didn't respond until now because I was trying to get it to reproduce
on my end even with the patch - to no avail.

Anyhow, would you mind sending a Tested-by tag?

Ioana

^ permalink raw reply	[flat|nested] 6+ messages in thread

* AW: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
  2022-02-10  9:40     ` Ioana Ciornei
@ 2022-02-10 10:17       ` Richter, Rafael
  0 siblings, 0 replies; 6+ messages in thread
From: Richter, Rafael @ 2022-02-10 10:17 UTC (permalink / raw)
  To: Ioana Ciornei, netdev; +Cc: davem, kuba, Robert-ionut Alexa, Klauer, Daniel

Thank you Ioana for this patch.
Its usage prevents that the kernel panics (v5.17-rc2) on shutdown on our board (LX2160A + mv88e6xxx) if any dpaa-interface (sgmii-mac) has been activated before.

Tested-by: Rafael Richter <rafael.richter@gin.de>
________________________________________
Von: Ioana Ciornei <ioana.ciornei@nxp.com>
Gesendet: Donnerstag, 10. Februar 2022 10:40
An: Richter, Rafael
Cc: davem@davemloft.net; kuba@kernel.org; netdev@vger.kernel.org; Klauer, Daniel; Robert-ionut Alexa
Betreff: Re: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY

On Thu, Feb 10, 2022 at 08:54:34AM +0000, Richter, Rafael wrote:
> Hi Ioana!
>
> please ignore the previous mail. Everything works now fine. It was a local issue with my setup.
>
> BR,
>


Hi Rafael,

Great to hear that the patch fixes the issue.
I didn't respond until now because I was trying to get it to reproduce
on my end even with the patch - to no avail.

Anyhow, would you mind sending a Tested-by tag?

Ioana


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
  2022-02-09 15:57 [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY Ioana Ciornei
  2022-02-09 18:43 ` AW: " Richter, Rafael
@ 2022-02-10 15:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-10 15:30 UTC (permalink / raw)
  To: Ioana Ciornei
  Cc: davem, kuba, netdev, rafael.richter, daniel.klauer, robert-ionut.alexa

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Wed,  9 Feb 2022 17:57:43 +0200 you wrote:
> From: Robert-Ionut Alexa <robert-ionut.alexa@nxp.com>
> 
> The netdev should be unregistered before we are disconnecting from the
> MAC/PHY so that the dev_close callback is called and the PHY and the
> phylink workqueues are actually stopped before we are disconnecting and
> destroying the phylink instance.
> 
> [...]

Here is the summary with links:
  - [net] dpaa2-eth: unregister the netdev before disconnecting from the PHY
    https://git.kernel.org/netdev/net/c/9ccc6e0c8959

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-10 15:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 15:57 [PATCH net] dpaa2-eth: unregister the netdev before disconnecting from the PHY Ioana Ciornei
2022-02-09 18:43 ` AW: " Richter, Rafael
2022-02-10  8:54   ` Richter, Rafael
2022-02-10  9:40     ` Ioana Ciornei
2022-02-10 10:17       ` AW: " Richter, Rafael
2022-02-10 15:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).