* [PATCH net-next] net: phy: print error message in phy_error
@ 2018-12-16 15:52 Heiner Kallweit
2018-12-16 16:48 ` Andrew Lunn
2018-12-16 17:02 ` Florian Fainelli
0 siblings, 2 replies; 7+ messages in thread
From: Heiner Kallweit @ 2018-12-16 15:52 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
So far phy_error() silently stops the PHY state machine. If the network
driver doesn't inform about a MDIO error then the user may wonder why
his network is down. So let's inform the user.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 890ae1d73..a898fa411 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
phydev->state = PHY_HALTED;
mutex_unlock(&phydev->lock);
+ phydev_err(phydev, "stopping PHY state machine due to error\n");
+
phy_trigger_machine(phydev);
}
--
2.20.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 15:52 [PATCH net-next] net: phy: print error message in phy_error Heiner Kallweit
@ 2018-12-16 16:48 ` Andrew Lunn
2018-12-16 17:02 ` Florian Fainelli
1 sibling, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2018-12-16 16:48 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Florian Fainelli, David Miller, netdev@vger.kernel.org
On Sun, Dec 16, 2018 at 04:52:21PM +0100, Heiner Kallweit wrote:
> So far phy_error() silently stops the PHY state machine. If the network
> driver doesn't inform about a MDIO error then the user may wonder why
> his network is down. So let's inform the user.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 15:52 [PATCH net-next] net: phy: print error message in phy_error Heiner Kallweit
2018-12-16 16:48 ` Andrew Lunn
@ 2018-12-16 17:02 ` Florian Fainelli
2018-12-16 17:16 ` Heiner Kallweit
2018-12-16 17:19 ` Heiner Kallweit
1 sibling, 2 replies; 7+ messages in thread
From: Florian Fainelli @ 2018-12-16 17:02 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
Le 12/16/18 à 7:52 AM, Heiner Kallweit a écrit :
> So far phy_error() silently stops the PHY state machine. If the network
> driver doesn't inform about a MDIO error then the user may wonder why
> his network is down. So let's inform the user.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Kind of similar to the netdev watchdog on a TX timeout, I wonder if we
should not just put a WARN() here to get a complete stack trace to help
debug those events?
> ---
> drivers/net/phy/phy.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 890ae1d73..a898fa411 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
> phydev->state = PHY_HALTED;
> mutex_unlock(&phydev->lock);
>
> + phydev_err(phydev, "stopping PHY state machine due to error\n");
> +
> phy_trigger_machine(phydev);
> }
>
>
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 17:02 ` Florian Fainelli
@ 2018-12-16 17:16 ` Heiner Kallweit
2018-12-16 17:55 ` Florian Fainelli
2018-12-16 17:19 ` Heiner Kallweit
1 sibling, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2018-12-16 17:16 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
On 16.12.2018 18:02, Florian Fainelli wrote:
> Le 12/16/18 à 7:52 AM, Heiner Kallweit a écrit :
>> So far phy_error() silently stops the PHY state machine. If the network
>> driver doesn't inform about a MDIO error then the user may wonder why
>> his network is down. So let's inform the user.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Kind of similar to the netdev watchdog on a TX timeout, I wonder if we
> should not just put a WARN() here to get a complete stack trace to help
> debug those events?
>
AFAICS phy_error() is always (?) caused by a MDIO access error.
Does it help us to know in which code path the MDIO error occurred?
And maybe the stack trace in case of a tx timeout isn't the best
example, at least from my personal experience. I dealt with such cases
and the stack trace never helped. The root cause always was in a totally
different place (wrong chip tx configuration etc.)
But maybe there are other cases where it's useful.
>> ---
>> drivers/net/phy/phy.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>> index 890ae1d73..a898fa411 100644
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
>> phydev->state = PHY_HALTED;
>> mutex_unlock(&phydev->lock);
>>
>> + phydev_err(phydev, "stopping PHY state machine due to error\n");
>> +
>> phy_trigger_machine(phydev);
>> }
>>
>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 17:16 ` Heiner Kallweit
@ 2018-12-16 17:55 ` Florian Fainelli
2018-12-16 18:11 ` Heiner Kallweit
0 siblings, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2018-12-16 17:55 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
Le 12/16/18 à 9:16 AM, Heiner Kallweit a écrit :
> On 16.12.2018 18:02, Florian Fainelli wrote:
>> Le 12/16/18 à 7:52 AM, Heiner Kallweit a écrit :
>>> So far phy_error() silently stops the PHY state machine. If the network
>>> driver doesn't inform about a MDIO error then the user may wonder why
>>> his network is down. So let's inform the user.
>>>
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>
>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>>
>> Kind of similar to the netdev watchdog on a TX timeout, I wonder if we
>> should not just put a WARN() here to get a complete stack trace to help
>> debug those events?
>>
> AFAICS phy_error() is always (?) caused by a MDIO access error.
> Does it help us to know in which code path the MDIO error occurred?
I would say yes because if you have things like nested MDIO bus accesses
(as can happen with Ethernet switches/DSA) or if runtime PM got in the
way, you would be able to know that.
>
> And maybe the stack trace in case of a tx timeout isn't the best
> example, at least from my personal experience. I dealt with such cases
> and the stack trace never helped. The root cause always was in a totally
> different place (wrong chip tx configuration etc.)
> But maybe there are other cases where it's useful.
That is entirely true, debugging TX timeouts is definitively no fun and
the watchdog does not help at all, other than making users scream and
shout :)
>
>>> ---
>>> drivers/net/phy/phy.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>>> index 890ae1d73..a898fa411 100644
>>> --- a/drivers/net/phy/phy.c
>>> +++ b/drivers/net/phy/phy.c
>>> @@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
>>> phydev->state = PHY_HALTED;
>>> mutex_unlock(&phydev->lock);
>>>
>>> + phydev_err(phydev, "stopping PHY state machine due to error\n");
>>> +
>>> phy_trigger_machine(phydev);
>>> }
>>>
>>>
>>
>>
>
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 17:55 ` Florian Fainelli
@ 2018-12-16 18:11 ` Heiner Kallweit
0 siblings, 0 replies; 7+ messages in thread
From: Heiner Kallweit @ 2018-12-16 18:11 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
On 16.12.2018 18:55, Florian Fainelli wrote:
> Le 12/16/18 à 9:16 AM, Heiner Kallweit a écrit :
>> On 16.12.2018 18:02, Florian Fainelli wrote:
>>> Le 12/16/18 à 7:52 AM, Heiner Kallweit a écrit :
>>>> So far phy_error() silently stops the PHY state machine. If the network
>>>> driver doesn't inform about a MDIO error then the user may wonder why
>>>> his network is down. So let's inform the user.
>>>>
>>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>>
>>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>>>
>>> Kind of similar to the netdev watchdog on a TX timeout, I wonder if we
>>> should not just put a WARN() here to get a complete stack trace to help
>>> debug those events?
>>>
>> AFAICS phy_error() is always (?) caused by a MDIO access error.
>> Does it help us to know in which code path the MDIO error occurred?
>
> I would say yes because if you have things like nested MDIO bus accesses
> (as can happen with Ethernet switches/DSA) or if runtime PM got in the
> way, you would be able to know that.
>
Good, convinced. So I'll provide a v2.
>>
>> And maybe the stack trace in case of a tx timeout isn't the best
>> example, at least from my personal experience. I dealt with such cases
>> and the stack trace never helped. The root cause always was in a totally
>> different place (wrong chip tx configuration etc.)
>> But maybe there are other cases where it's useful.
>
> That is entirely true, debugging TX timeouts is definitively no fun and
> the watchdog does not help at all, other than making users scream and
> shout :)
>
>>
>>>> ---
>>>> drivers/net/phy/phy.c | 2 ++
>>>> 1 file changed, 2 insertions(+)
>>>>
>>>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>>>> index 890ae1d73..a898fa411 100644
>>>> --- a/drivers/net/phy/phy.c
>>>> +++ b/drivers/net/phy/phy.c
>>>> @@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
>>>> phydev->state = PHY_HALTED;
>>>> mutex_unlock(&phydev->lock);
>>>>
>>>> + phydev_err(phydev, "stopping PHY state machine due to error\n");
>>>> +
>>>> phy_trigger_machine(phydev);
>>>> }
>>>>
>>>>
>>>
>>>
>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next] net: phy: print error message in phy_error
2018-12-16 17:02 ` Florian Fainelli
2018-12-16 17:16 ` Heiner Kallweit
@ 2018-12-16 17:19 ` Heiner Kallweit
1 sibling, 0 replies; 7+ messages in thread
From: Heiner Kallweit @ 2018-12-16 17:19 UTC (permalink / raw)
To: Florian Fainelli, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
On 16.12.2018 18:02, Florian Fainelli wrote:
> Le 12/16/18 à 7:52 AM, Heiner Kallweit a écrit :
>> So far phy_error() silently stops the PHY state machine. If the network
>> driver doesn't inform about a MDIO error then the user may wonder why
>> his network is down. So let's inform the user.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Kind of similar to the netdev watchdog on a TX timeout, I wonder if we
> should not just put a WARN() here to get a complete stack trace to help
> debug those events?
>
But it's good that you mention the WARN(). This is the better option in
the other patch I submitted today. I'll prepare an update to this patch.
>> ---
>> drivers/net/phy/phy.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>> index 890ae1d73..a898fa411 100644
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -739,6 +739,8 @@ static void phy_error(struct phy_device *phydev)
>> phydev->state = PHY_HALTED;
>> mutex_unlock(&phydev->lock);
>>
>> + phydev_err(phydev, "stopping PHY state machine due to error\n");
>> +
>> phy_trigger_machine(phydev);
>> }
>>
>>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-12-16 18:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-16 15:52 [PATCH net-next] net: phy: print error message in phy_error Heiner Kallweit
2018-12-16 16:48 ` Andrew Lunn
2018-12-16 17:02 ` Florian Fainelli
2018-12-16 17:16 ` Heiner Kallweit
2018-12-16 17:55 ` Florian Fainelli
2018-12-16 18:11 ` Heiner Kallweit
2018-12-16 17:19 ` Heiner Kallweit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox