netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
@ 2024-06-05  8:42 Csókás, Bence
  2024-06-06 15:21 ` Andrew Lunn
  2024-06-07  1:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 6+ messages in thread
From: Csókás, Bence @ 2024-06-05  8:42 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: Csókás, Bence, Russell King, Andrew Lunn,
	Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni

If the module is in SFP_MOD_ERROR, `sfp_sm_mod_remove()` will
not be run. As a consequence, `sfp_hwmon_remove()` is not getting
run either, leaving a stale `hwmon` device behind. `sfp_sm_mod_remove()`
itself checks `sfp->sm_mod_state` anyways, so this check was not
really needed in the first place.

Signed-off-by: "Csókás, Bence" <csokas.bence@prolan.hu>
---
 drivers/net/phy/sfp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index f75c9eb3958e..d999d9baadb2 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2418,8 +2418,7 @@ static void sfp_sm_module(struct sfp *sfp, unsigned int event)
 
 	/* Handle remove event globally, it resets this state machine */
 	if (event == SFP_E_REMOVE) {
-		if (sfp->sm_mod_state > SFP_MOD_PROBE)
-			sfp_sm_mod_remove(sfp);
+		sfp_sm_mod_remove(sfp);
 		sfp_sm_mod_next(sfp, SFP_MOD_EMPTY, 0);
 		return;
 	}
-- 
2.34.1



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

* Re: [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
  2024-06-05  8:42 [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove Csókás, Bence
@ 2024-06-06 15:21 ` Andrew Lunn
  2024-06-06 15:28   ` Jakub Kicinski
  2024-06-06 15:31   ` Russell King (Oracle)
  2024-06-07  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 2 replies; 6+ messages in thread
From: Andrew Lunn @ 2024-06-06 15:21 UTC (permalink / raw)
  To: Csókás, Bence, Russell King
  Cc: netdev, linux-kernel, Russell King, Heiner Kallweit,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni

On Wed, Jun 05, 2024 at 10:42:51AM +0200, Csókás, Bence wrote:
> If the module is in SFP_MOD_ERROR, `sfp_sm_mod_remove()` will
> not be run. As a consequence, `sfp_hwmon_remove()` is not getting
> run either, leaving a stale `hwmon` device behind. `sfp_sm_mod_remove()`
> itself checks `sfp->sm_mod_state` anyways, so this check was not
> really needed in the first place.
> 
> Signed-off-by: "Csókás, Bence" <csokas.bence@prolan.hu>

I was expecting Russell to review this. Maybe he missed it.

This looks O.K. to me:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
  2024-06-06 15:21 ` Andrew Lunn
@ 2024-06-06 15:28   ` Jakub Kicinski
  2024-06-06 16:15     ` Andrew Lunn
  2024-06-06 15:31   ` Russell King (Oracle)
  1 sibling, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2024-06-06 15:28 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Csókás,\ Bence, Russell King, netdev, linux-kernel,
	Russell King, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Paolo Abeni

On Thu, 6 Jun 2024 17:21:45 +0200 Andrew Lunn wrote:
> I was expecting Russell to review this. Maybe he missed it.

While it's fresh in your mind - does it look like a fix to you?
From a quick look - we're failing to unregister a device?

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

* Re: [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
  2024-06-06 15:21 ` Andrew Lunn
  2024-06-06 15:28   ` Jakub Kicinski
@ 2024-06-06 15:31   ` Russell King (Oracle)
  1 sibling, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2024-06-06 15:31 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Csókás, Bence, netdev, linux-kernel, Heiner Kallweit,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni

On Thu, Jun 06, 2024 at 05:21:45PM +0200, Andrew Lunn wrote:
> On Wed, Jun 05, 2024 at 10:42:51AM +0200, Csókás, Bence wrote:
> > If the module is in SFP_MOD_ERROR, `sfp_sm_mod_remove()` will
> > not be run. As a consequence, `sfp_hwmon_remove()` is not getting
> > run either, leaving a stale `hwmon` device behind. `sfp_sm_mod_remove()`
> > itself checks `sfp->sm_mod_state` anyways, so this check was not
> > really needed in the first place.
> > 
> > Signed-off-by: "Csókás, Bence" <csokas.bence@prolan.hu>
> 
> I was expecting Russell to review this. Maybe he missed it.

I haven't missed it, I just haven't had the time to review and respond.
Work stuff is still very busy. I know this has been going on for well
over a month, but as it's partly coming from my employer and partly due
to medical stuff taking hours out of my working week, there's nothing
much I can do about it. I'm doing the best I can, but I know that I
can't keep up with what people expect of me at the moment.

I've had to tell Kory that I won't be able to review and test his
patch series - it's just totally impossible for me to be near the
hardware I need to test with his series _and_ have the time to do so.
I feel bad about that, because it's addressing the issue I raised a
number of years ago with PTP, yet I don't have the time to be involved
in that right now.

It's frustrating for me that I'm not able to do everything that I'd like
to...

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

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

* Re: [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
  2024-06-06 15:28   ` Jakub Kicinski
@ 2024-06-06 16:15     ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2024-06-06 16:15 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Csókás,\ Bence, Russell King, netdev, linux-kernel,
	Russell King, Heiner Kallweit, David S. Miller, Eric Dumazet,
	Paolo Abeni

On Thu, Jun 06, 2024 at 08:28:30AM -0700, Jakub Kicinski wrote:
> On Thu, 6 Jun 2024 17:21:45 +0200 Andrew Lunn wrote:
> > I was expecting Russell to review this. Maybe he missed it.
> 
> While it's fresh in your mind - does it look like a fix to you?
> From a quick look - we're failing to unregister a device?

Yes. A Fixes of:

commit d2e816c0293fc263b3f168c14992a5f1a50d7593
Author: Russell King <rmk+kernel@armlinux.org.uk>
Date:   Sun Nov 10 14:06:28 2019 +0000

    net: sfp: handle module remove outside state machine
    
    Removing a module resets the module state machine back to its initial
    state.  Rather than explicitly handling this in every state, handle it
    early on outside of the state machine.

is probably best, since that refactored to code.

	Andrew

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

* Re: [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove
  2024-06-05  8:42 [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove Csókás, Bence
  2024-06-06 15:21 ` Andrew Lunn
@ 2024-06-07  1:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-07  1:10 UTC (permalink / raw)
  To: =?utf-8?b?Q3PDs2vDoXMsIEJlbmNlIDxjc29rYXMuYmVuY2VAcHJvbGFuLmh1Pg==?=
  Cc: netdev, linux-kernel, linux, andrew, hkallweit1, davem, edumazet,
	kuba, pabeni

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 5 Jun 2024 10:42:51 +0200 you wrote:
> If the module is in SFP_MOD_ERROR, `sfp_sm_mod_remove()` will
> not be run. As a consequence, `sfp_hwmon_remove()` is not getting
> run either, leaving a stale `hwmon` device behind. `sfp_sm_mod_remove()`
> itself checks `sfp->sm_mod_state` anyways, so this check was not
> really needed in the first place.
> 
> Signed-off-by: "Csókás, Bence" <csokas.bence@prolan.hu>
> 
> [...]

Here is the summary with links:
  - net: sfp: Always call `sfp_sm_mod_remove()` on remove
    https://git.kernel.org/netdev/net/c/e96b2933152f

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:[~2024-06-07  1:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05  8:42 [PATCH] net: sfp: Always call `sfp_sm_mod_remove()` on remove Csókás, Bence
2024-06-06 15:21 ` Andrew Lunn
2024-06-06 15:28   ` Jakub Kicinski
2024-06-06 16:15     ` Andrew Lunn
2024-06-06 15:31   ` Russell King (Oracle)
2024-06-07  1:10 ` 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).