Netdev Archive on lore.kernel.org
 help / color / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: Jose Abreu <Jose.Abreu@synopsys.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Joao Pinto <Joao.Pinto@synopsys.com>,
	"David S . Miller" <davem@davemloft.net>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	linux-tegra <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH net-next 3/3] net: stmmac: Convert to phylink and remove phylib logic
Date: Tue, 25 Jun 2019 12:10:15 +0100
Message-ID: <113f37a2-c37f-cdb5-5194-4361d949258a@nvidia.com> (raw)
In-Reply-To: <78EB27739596EE489E55E81C33FEC33A0B9D7024@DE02WEMBXB.internal.synopsys.com>


On 25/06/2019 08:37, Jose Abreu wrote:
> From: Jon Hunter <jonathanh@nvidia.com>
> 
>> Any further feedback? I am still seeing this issue on today's -next.
> 
> Apologies but I was in FTO.
> 
> Is there any possibility you can just disable the ethX configuration in 
> the rootfs mount and manually configure it after rootfs is done ?
> 
> I just want to make sure in which conditions this is happening (if in 
> ifdown or ifup).

I have been looking at this a bit closer and I can see the problem. What
happens is that ...

1. stmmac_mac_link_up() is called and priv->eee_active is set to false
2. stmmac_eee_init() is called but because priv->eee_active is false,
   timer_setup() for eee_ctrl_timer is never called.
3. stmmac_eee_init() returns true and so then priv->eee_enabled is set 
   to true.
4. When stmmac_tx_clean() is called because priv->eee_enabled is set to    
   true, mod_timer() is called for the eee_ctrl_timer, but because 
   timer_setup() was never called, we hit the BUG defined at
   kernel/time/timer.c:952, because no function is defined for the 
   timer.

The following fixes it for me ...

--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -399,10 +399,13 @@ bool stmmac_eee_init(struct stmmac_priv *priv)
        mutex_lock(&priv->lock);
 
        /* Check if it needs to be deactivated */
-       if (!priv->eee_active && priv->eee_enabled) {
-               netdev_dbg(priv->dev, "disable EEE\n");
-               del_timer_sync(&priv->eee_ctrl_timer);
-               stmmac_set_eee_timer(priv, priv->hw, 0, tx_lpi_timer);
+       if (!priv->eee_active) {
+               if (priv->eee_enabled) {
+                       netdev_dbg(priv->dev, "disable EEE\n");
+                       del_timer_sync(&priv->eee_ctrl_timer);
+                       stmmac_set_eee_timer(priv, priv->hw, 0, tx_lpi_timer);
+               }
+               mutex_unlock(&priv->lock);
                return false;
        }

It also looks like you have a potention deadlock in the current code
because in the case of if (!priv->eee_active && priv->eee_enabled)
you don't unlock the mutex. The above fixes this as well. I can send a
formal patch if this looks correct. 

Cheers
Jon

-- 
nvpublic

  reply index

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 15:18 [PATCH net-next 0/3] net: stmmac: Convert to phylink Jose Abreu
2019-06-11 15:18 ` [PATCH net-next 1/3] net: stmmac: Prepare to convert " Jose Abreu
2019-06-11 15:18 ` [PATCH net-next 2/3] net: stmmac: Start adding phylink support Jose Abreu
2019-06-11 15:35   ` Russell King - ARM Linux admin
2019-06-11 15:40     ` Jose Abreu
2019-06-11 15:18 ` [PATCH net-next 3/3] net: stmmac: Convert to phylink and remove phylib logic Jose Abreu
2019-06-18  9:30   ` Jon Hunter
2019-06-18  9:35     ` Jose Abreu
2019-06-18  9:42       ` Jon Hunter
2019-06-18  9:46         ` Jose Abreu
2019-06-18 10:18           ` Jon Hunter
2019-06-18 15:20             ` Jon Hunter
2019-06-18 19:44               ` Jon Hunter
2019-06-20 14:05                 ` Jon Hunter
2019-06-25  7:37                   ` Jose Abreu
2019-06-25 11:10                     ` Jon Hunter [this message]
2019-06-25 11:25                       ` Jose Abreu
2019-06-13 21:02 ` [PATCH net-next 0/3] net: stmmac: Convert to phylink David Miller
2019-06-14 13:40 ` Corentin Labbe
2019-06-14 14:45   ` Jose Abreu
2019-07-22 12:42 ` Ondřej Jirman
2019-07-22 13:28   ` Jose Abreu
2019-07-22 13:40     ` Andrew Lunn
2019-07-22 13:58       ` Jose Abreu
2019-07-22 14:19         ` Andrew Lunn
2019-07-22 14:26           ` Jose Abreu
2019-07-22 14:39             ` Ondřej Jirman
2019-07-23  9:36               ` Jose Abreu
2019-07-22 13:49     ` Ondřej Jirman

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=113f37a2-c37f-cdb5-5194-4361d949258a@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@st.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox