linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix for KSZ DSA switch shutdown
@ 2021-09-09  9:53 Lino Sanfilippo
  2021-09-09  9:53 ` [PATCH 1/3] net: dsa: introduce function dsa_tree_shutdown() Lino Sanfilippo
                   ` (4 more replies)
  0 siblings, 5 replies; 39+ messages in thread
From: Lino Sanfilippo @ 2021-09-09  9:53 UTC (permalink / raw)
  To: olteanv
  Cc: p.rosenberger, woojung.huh, UNGLinuxDriver, andrew,
	vivien.didelot, f.fainelli, davem, kuba, netdev, linux-kernel,
	Lino Sanfilippo

This patch series fixes a system hang I got each time i tried to shutdown
or reboot a system that uses a KSZ9897 as a DSA switch with a broadcom
GENET network device as the DSA master device. At the time the system hangs
the message "unregister_netdevice: waiting for eth0 to become free. Usage
count = 2." is dumped periodically to the console.

After some investigation I found the reason to be unreleased references to
the master device which are still held by the slave devices at the time the
system is shut down (I have two slave devices in use).

While these references are supposed to be released in ksz_switch_remove()
this function never gets the chance to be called due to the system hang at
the master device deregistration which happens before ksz_switch_remove()
is called.

The fix is to make sure that the master device references are already
released when the device is unregistered. For this reason PATCH1 provides
a new function dsa_tree_shutdown() that can be called by DSA drivers to
untear the DSA switch at shutdown. PATCH2 uses this function in a new
helper function for KSZ switches to properly shutdown the KSZ switch.
PATCH 3 uses the new helper function in the KSZ9477 shutdown handler.

Theses patches have been tested on a Raspberry PI 5.10 kernel with a
KSZ9897. The patches have been adjusted to apply against net-next and are
compile tested with next-next.

Lino Sanfilippo (3):
  net: dsa: introduce function dsa_tree_shutdown()
  net: dsa: microchip: provide the function ksz_switch_shutdown()
  net: dsa: microchip: tear down DSA tree at system shutdown

 drivers/net/dsa/microchip/ksz9477.c    | 12 +++++++++++-
 drivers/net/dsa/microchip/ksz_common.c | 13 +++++++++++++
 drivers/net/dsa/microchip/ksz_common.h |  1 +
 include/net/dsa.h                      |  1 +
 net/dsa/dsa2.c                         |  8 ++++++++
 5 files changed, 34 insertions(+), 1 deletion(-)


base-commit: 626bf91a292e2035af5b9d9cce35c5c138dfe06d
-- 
2.33.0


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

end of thread, other threads:[~2021-09-19  0:30 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09  9:53 [PATCH 0/3] Fix for KSZ DSA switch shutdown Lino Sanfilippo
2021-09-09  9:53 ` [PATCH 1/3] net: dsa: introduce function dsa_tree_shutdown() Lino Sanfilippo
2021-09-09  9:53 ` [PATCH 2/3] net: dsa: microchip: provide the function ksz_switch_shutdown() Lino Sanfilippo
2021-09-09  9:53 ` [PATCH 3/3] net: dsa: microchip: tear down DSA tree at system shutdown Lino Sanfilippo
2021-09-09 10:14 ` [PATCH 0/3] Fix for KSZ DSA switch shutdown Vladimir Oltean
2021-09-09 11:08   ` Lino Sanfilippo
2021-09-09 11:42     ` Vladimir Oltean
2021-09-09 12:56       ` Vladimir Oltean
2021-09-09 13:19         ` Aw: " Lino Sanfilippo
2021-09-09 14:29           ` Lino Sanfilippo
2021-09-09 15:17             ` Andrew Lunn
2021-09-09 16:41               ` Lino Sanfilippo
2021-09-09 15:11           ` Andrew Lunn
2021-09-09 16:46             ` Lino Sanfilippo
2021-09-09 17:55               ` Andrew Lunn
2021-09-09 15:47           ` Vladimir Oltean
2021-09-09 16:00             ` Florian Fainelli
2021-09-10  1:32               ` Saravana Kannan
2021-09-09 16:37             ` Lino Sanfilippo
2021-09-09 16:44               ` Florian Fainelli
2021-09-09 17:07                 ` Lino Sanfilippo
2021-09-09 22:54                   ` Vladimir Oltean
2021-09-09 23:23                     ` Vladimir Oltean
2021-09-10  1:08                       ` Vladimir Oltean
2021-09-10  2:15                     ` Florian Fainelli
2021-09-10 11:51                       ` Andrew Lunn
2021-09-10 14:58                         ` Vladimir Oltean
2021-09-11 11:44                           ` Vladimir Oltean
2021-09-12 20:19                           ` Lino Sanfilippo
2021-09-12 20:29                             ` Vladimir Oltean
2021-09-13 10:32                               ` Aw: " Lino Sanfilippo
2021-09-13 10:44                                 ` Vladimir Oltean
2021-09-13 11:01                                   ` Aw: " Lino Sanfilippo
2021-09-14 18:48                                     ` Vladimir Oltean
2021-09-15  5:42                                       ` Lino Sanfilippo
2021-09-18 19:37                                         ` Lino Sanfilippo
2021-09-18 22:04                                           ` Vladimir Oltean
2021-09-19  0:29                                             ` Vladimir Oltean
2021-09-09 12:40 ` Andrew Lunn

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).