Skip to contentSkip to conversation

Don't take the mdio_lock in atl1e_probe

PATCH Applied Matthew Wilcox 3 participants 3 messages Aug 12, 2008 – Sep 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't take the mdio_lock in atl1e_probe

Lockdep warns about the mdio_lock taken with interrupts enabled then later taken from interrupt context. Initially, I considered changing these to spin_lock_irq/spin_unlock_irq, but then I looked at atl1e_phy_init() and saw that it calls msleep(). Sleeping while holding a spinlock is not allowed either.

In the probe path, we haven't registered the interrupt handler, so it can't poke at this card yet. It's before we call register_netdev(), so I don't think any other threads can reach this card either. If I'm right, we don't need a spinlock at all.

drivers/net/atl1e/atl1e_main.c +0 -2
index 82d7be1..ba22a51 100644
@@ -2389,9 +2389,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
 	}
 
 	/* Init GPHY as early as possible due to power saving issue  */
-	spin_lock(&adapter->mdio_lock);
 	atl1e_phy_init(&adapter->hw);
-	spin_unlock(&adapter->mdio_lock);
 	/* reset the controller to
 	 * put the device in a known good starting state */
 	err = atl1e_reset_hw(&adapter->hw);
Signature · 4 lines
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
Acked-by on v1 1/1
#1 lore raw

On Tuesday, August 12, 2008 9:13 PM
Matthew Wilcox <[email protected]> wrote

Quoted 25 lines

Lockdep warns about the mdio_lock taken with interrupts enabled then later taken from interrupt context. Initially, I considered changing these to spin_lock_irq/spin_unlock_irq, but then I looked at atl1e_phy_init() and saw that it calls msleep(). Sleeping while holding a spinlock is not allowed either.

In the probe path, we haven't registered the interrupt handler, so it can't poke at this card yet. It's before we call register_netdev(), so I don't think any other threads can reach this card either. If I'm right, we don't need a spinlock at all.

(quoted diff) +0 -0

b/drivers/net/atl1e/atl1e_main.c index 82d7be1..ba22a51 100644

drivers/net/atl1e/atl1e_main.c +0 -0
@@ -2389,9 +2389,7 @@ static int __devinit atl1e_probe(struct
 pci_dev *pdev,
        }
 
        /* Init GPHY as early as possible due to power saving

issue */

drivers/net/atl1e/atl1e_main.c static int __devinit atl1e_probe(struct pci_dev *pdev, · line 2395

Quoted 6 lines
drivers/net/atl1e/atl1e_main.c +0 -2
-       spin_lock(&adapter->mdio_lock);
        atl1e_phy_init(&adapter->hw);
-       spin_unlock(&adapter->mdio_lock);
        /* reset the controller to
         * put the device in a known good starting state */
        err = atl1e_reset_hw(&adapter->hw);

Ok.
Thanks Matthew Wilcox

Applied
#2 lore raw
In reply to Matthew Wilcox
Quoted 18 lines · Matthew Wilcox

Lockdep warns about the mdio_lock taken with interrupts enabled then later taken from interrupt context. Initially, I considered changing these to spin_lock_irq/spin_unlock_irq, but then I looked at atl1e_phy_init() and saw that it calls msleep(). Sleeping while holding a spinlock is not allowed either.

In the probe path, we haven't registered the interrupt handler, so it can't poke at this card yet. It's before we call register_netdev(), so I don't think any other threads can reach this card either. If I'm right, we don't need a spinlock at all.

drivers/net/atl1e/atl1e_main.c +0 -0
index 82d7be1..ba22a51 100644

drivers/net/atl1e/atl1e_main.c static int __devinit atl1e_probe(struct pci_dev *pdev, · line 2394

Quoted 8 lines
drivers/net/atl1e/atl1e_main.c +0 -2
@@ -2389,9 +2389,7 @@ static int __devinit atl1e_probe(struct pci_dev *pdev,
 	}
 
 	/* Init GPHY as early as possible due to power saving issue  */
-	spin_lock(&adapter->mdio_lock);
 	atl1e_phy_init(&adapter->hw);
-	spin_unlock(&adapter->mdio_lock);
 	/* reset the controller to
 	 * put the device in a known good starting state */

applied