Skip to content

Commit 33385ad

Browse files
hkallweitgregkh
authored andcommitted
igb: fix deadlock caused by taking RTNL in RPM resume path
[ Upstream commit ac8c58f ] Recent net core changes caused an issue with few Intel drivers (reportedly igb), where taking RTNL in RPM resume path results in a deadlock. See [0] for a bug report. I don't think the core changes are wrong, but taking RTNL in RPM resume path isn't needed. The Intel drivers are the only ones doing this. See [1] for a discussion on the issue. Following patch changes the RPM resume path to not take RTNL. [0] https://bugzilla.kernel.org/show_bug.cgi?id=215129 [1] https://lore.kernel.org/netdev/20211125074949.5f897431@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/t/ Fixes: bd86924 ("net: core: try to runtime-resume detached device in __dev_open") Fixes: f32a213 ("ethtool: runtime-resume netdev parent before ethtool ioctl ops") Tested-by: Martin Stolpe <[email protected]> Signed-off-by: Heiner Kallweit <[email protected]> Signed-off-by: Tony Nguyen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent b99c71f commit 33385ad

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9247,7 +9247,7 @@ static int __maybe_unused igb_suspend(struct device *dev)
92479247
return __igb_shutdown(to_pci_dev(dev), NULL, 0);
92489248
}
92499249

9250-
static int __maybe_unused igb_resume(struct device *dev)
9250+
static int __maybe_unused __igb_resume(struct device *dev, bool rpm)
92519251
{
92529252
struct pci_dev *pdev = to_pci_dev(dev);
92539253
struct net_device *netdev = pci_get_drvdata(pdev);
@@ -9290,17 +9290,24 @@ static int __maybe_unused igb_resume(struct device *dev)
92909290

92919291
wr32(E1000_WUS, ~0);
92929292

9293-
rtnl_lock();
9293+
if (!rpm)
9294+
rtnl_lock();
92949295
if (!err && netif_running(netdev))
92959296
err = __igb_open(netdev, true);
92969297

92979298
if (!err)
92989299
netif_device_attach(netdev);
9299-
rtnl_unlock();
9300+
if (!rpm)
9301+
rtnl_unlock();
93009302

93019303
return err;
93029304
}
93039305

9306+
static int __maybe_unused igb_resume(struct device *dev)
9307+
{
9308+
return __igb_resume(dev, false);
9309+
}
9310+
93049311
static int __maybe_unused igb_runtime_idle(struct device *dev)
93059312
{
93069313
struct net_device *netdev = dev_get_drvdata(dev);
@@ -9319,7 +9326,7 @@ static int __maybe_unused igb_runtime_suspend(struct device *dev)
93199326

93209327
static int __maybe_unused igb_runtime_resume(struct device *dev)
93219328
{
9322-
return igb_resume(dev);
9329+
return __igb_resume(dev, true);
93239330
}
93249331

93259332
static void igb_shutdown(struct pci_dev *pdev)
@@ -9435,7 +9442,7 @@ static pci_ers_result_t igb_io_error_detected(struct pci_dev *pdev,
94359442
* @pdev: Pointer to PCI device
94369443
*
94379444
* Restart the card from scratch, as if from a cold-boot. Implementation
9438-
* resembles the first-half of the igb_resume routine.
9445+
* resembles the first-half of the __igb_resume routine.
94399446
**/
94409447
static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
94419448
{
@@ -9475,7 +9482,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
94759482
*
94769483
* This callback is called when the error recovery driver tells us that
94779484
* its OK to resume normal operation. Implementation resembles the
9478-
* second-half of the igb_resume routine.
9485+
* second-half of the __igb_resume routine.
94799486
*/
94809487
static void igb_io_resume(struct pci_dev *pdev)
94819488
{

0 commit comments

Comments
 (0)