From: Zheng Yan <zheng.z....@intel.com> 

[ Upstream commit 749ab2cd127046df79084b6b9165b23491b1db5f ]

During suspend/resume (and possibly in other scenarios as well), the
ASSERT_RTNL() warning is triggered in netif_set_real_num_tx/rx_queues()
functions, something like:

[  278.140874] igb 0000:06:00.0: irq 79 for MSI/MSI-X
[  278.140875] igb 0000:06:00.1: irq 80 for MSI/MSI-X
[  278.140880] igb 0000:06:00.0: irq 81 for MSI/MSI-X
[  278.140882] igb 0000:06:00.1: irq 82 for MSI/MSI-X
[  278.140886] igb 0000:06:00.0: irq 83 for MSI/MSI-X
[  278.140888] igb 0000:06:00.1: irq 84 for MSI/MSI-X
[  278.140892] igb 0000:06:00.0: irq 85 for MSI/MSI-X
[  278.140894] igb 0000:06:00.1: irq 86 for MSI/MSI-X
[  278.140898] igb 0000:06:00.0: irq 87 for MSI/MSI-X
[  278.140900] igb 0000:06:00.1: irq 88 for MSI/MSI-X
[  278.140905] igb 0000:06:00.0: irq 89 for MSI/MSI-X
[  278.140906] igb 0000:06:00.1: irq 90 for MSI/MSI-X
[  278.140910] igb 0000:06:00.0: irq 91 for MSI/MSI-X
[  278.140912] igb 0000:06:00.1: irq 92 for MSI/MSI-X
[  278.140916] igb 0000:06:00.0: irq 93 for MSI/MSI-X
[  278.140918] igb 0000:06:00.1: irq 94 for MSI/MSI-X
[  278.140923] igb 0000:06:00.0: irq 95 for MSI/MSI-X
[  278.140925] igb 0000:06:00.1: irq 96 for MSI/MSI-X
[  278.140976] RTNL: assertion failed at net/core/dev.c (1644)
[  278.140978] Pid: 5078, comm: kworker/u:8 Not tainted 
3.0.25-0.0.0.2.0f8ab74-trace #1
[  278.140980] Call Trace:
[  278.140986]  [<ffffffff8137bd6e>] netif_set_real_num_tx_queues+0x1ae/0x1d0
[  278.140988] RTNL: assertion failed at net/core/dev.c (1644)
[  278.140990] Pid: 5077, comm: kworker/u:7 Not tainted 
3.0.25-0.0.0.2.0f8ab74-trace #1
[  278.140991] Call Trace:
[  278.140995]  [<ffffffff8137bd6e>] netif_set_real_num_tx_queues+0x1ae/0x1d0
[  278.141000]  [<ffffffffa012bd95>] igb_set_interrupt_capability+0x145/0x1e0 
[igb]
[  278.141006]  [<ffffffffa012bd95>] igb_set_interrupt_capability+0x145/0x1e0 
[igb]
[  278.141010]  [<ffffffffa0130e78>] igb_init_interrupt_scheme+0x28/0x2d0 [igb]
[  278.141015]  [<ffffffffa0130e78>] igb_init_interrupt_scheme+0x28/0x2d0 [igb]
[  278.141020]  [<ffffffffa013162c>] igb_resume+0x9c/0x160 [igb]
[  278.141024]  [<ffffffffa013162c>] igb_resume+0x9c/0x160 [igb]
[  278.141028]  [<ffffffff8126ca42>] pci_legacy_resume+0x42/0x60
[  278.141032]  [<ffffffff8126ca42>] pci_legacy_resume+0x42/0x60
[  278.141034]  [<ffffffff8126cc50>] pci_pm_resume+0x90/0xd0
[  278.141037] serial 00:0b: activated
[  278.141039]  [<ffffffff8126cc50>] pci_pm_resume+0x90/0xd0
[  278.141042]  [<ffffffff8131d16c>] pm_op+0x10c/0x1e0
[  278.141045]  [<ffffffff8131d16c>] pm_op+0x10c/0x1e0
[  278.141047]  [<ffffffff8131dd3d>] device_resume+0xad/0x290
[  278.141050]  [<ffffffff8131dd3d>] device_resume+0xad/0x290
[  278.141052]  [<ffffffff8131e141>] async_resume+0x21/0x50
[  278.141055]  [<ffffffff8131e141>] async_resume+0x21/0x50
[  278.141058]  [<ffffffff81087a94>] async_run_entry_fn+0x84/0x180
[  278.141061]  [<ffffffff81087a94>] async_run_entry_fn+0x84/0x180
[  278.141065]  [<ffffffff81078041>] process_one_work+0x171/0x350
[  278.141068]  [<ffffffff81078041>] process_one_work+0x171/0x350
[  278.141070]  [<ffffffff81087a10>] ? async_schedule+0x20/0x20
[  278.141073]  [<ffffffff81087a10>] ? async_schedule+0x20/0x20
[  278.141076]  [<ffffffff8107b1fb>] worker_thread+0x18b/0x430
[  278.141078]  [<ffffffff8107b1fb>] worker_thread+0x18b/0x430
[  278.141081]  [<ffffffff8107b070>] ? manage_workers+0x120/0x120
[  278.141084]  [<ffffffff8107b070>] ? manage_workers+0x120/0x120
[  278.141087]  [<ffffffff8107f75e>] kthread+0x9e/0xb0
[  278.141089]  [<ffffffff8107f75e>] kthread+0x9e/0xb0
[  278.141093]  [<ffffffff81444d04>] kernel_thread_helper+0x4/0x10
[  278.141096]  [<ffffffff81444d04>] kernel_thread_helper+0x4/0x10
[  278.141100]  [<ffffffff8143bcc1>] ? retint_restore_args+0x13/0x13
[  278.141103]  [<ffffffff8143bcc1>] ? retint_restore_args+0x13/0x13
[  278.141106]  [<ffffffff8107f6c0>] ? kthread_worker_fn+0x1b0/0x1b0
[  278.141108]  [<ffffffff8107f6c0>] ? kthread_worker_fn+0x1b0/0x1b0
[  278.141111]  [<ffffffff81444d00>] ? gs_change+0x13/0x13
[  278.141113]  [<ffffffff81444d00>] ? gs_change+0x13/0x13
[  278.141115] RTNL: assertion failed at net/core/dev.c (1682)
[  278.141117] RTNL: assertion failed at net/core/dev.c (1682)
[  278.141119] Pid: 5078, comm: kworker/u:8 Not tainted 
3.0.25-0.0.0.2.0f8ab74-trace #1
[  278.141121] Pid: 5077, comm: kworker/u:7 Not tainted 
3.0.25-0.0.0.2.0f8ab74-trace #1
[  278.141123] Call Trace:
[  278.141124] Call Trace:
[  278.141126]  [<ffffffff8137bbbb>] netif_set_real_num_rx_queues+0x8b/0x90
[  278.141129]  [<ffffffff8137bbbb>] netif_set_real_num_rx_queues+0x8b/0x90
[  278.141133]  [<ffffffffa012bda7>] igb_set_interrupt_capability+0x157/0x1e0 
[igb]
[  278.141137]  [<ffffffffa012bda7>] igb_set_interrupt_capability+0x157/0x1e0 
[igb]
[  278.141142]  [<ffffffffa0130e78>] igb_init_interrupt_scheme+0x28/0x2d0 [igb]
[  278.141146]  [<ffffffffa0130e78>] igb_init_interrupt_scheme+0x28/0x2d0 [igb]
[  278.141150]  [<ffffffffa013162c>] igb_resume+0x9c/0x160 [igb]
[  278.141154]  [<ffffffffa013162c>] igb_resume+0x9c/0x160 [igb]
[  278.141157]  [<ffffffff8126ca42>] pci_legacy_resume+0x42/0x60
[  278.141160]  [<ffffffff8126ca42>] pci_legacy_resume+0x42/0x60
[  278.141163]  [<ffffffff8126cc50>] pci_pm_resume+0x90/0xd0
[  278.141165]  [<ffffffff8126cc50>] pci_pm_resume+0x90/0xd0
[  278.141167]  [<ffffffff8131d16c>] pm_op+0x10c/0x1e0
[  278.141170]  [<ffffffff8131d16c>] pm_op+0x10c/0x1e0
[  278.141172]  [<ffffffff8131dd3d>] device_resume+0xad/0x290
[  278.141174]  [<ffffffff8131dd3d>] device_resume+0xad/0x290
[  278.141176]  [<ffffffff8131e141>] async_resume+0x21/0x50
[  278.141179]  [<ffffffff8131e141>] async_resume+0x21/0x50
[  278.141181]  [<ffffffff81087a94>] async_run_entry_fn+0x84/0x180
[  278.141184]  [<ffffffff81087a94>] async_run_entry_fn+0x84/0x180
[  278.141186]  [<ffffffff81078041>] process_one_work+0x171/0x350
[  278.141190]  [<ffffffff81078041>] process_one_work+0x171/0x350
[  278.141192]  [<ffffffff81087a10>] ? async_schedule+0x20/0x20
[  278.141194]  [<ffffffff81087a10>] ? async_schedule+0x20/0x20
[  278.141197]  [<ffffffff8107b1fb>] worker_thread+0x18b/0x430
[  278.141200]  [<ffffffff8107b1fb>] worker_thread+0x18b/0x430
[  278.141203]  [<ffffffff8107b070>] ? manage_workers+0x120/0x120
[  278.141206]  [<ffffffff8107b070>] ? manage_workers+0x120/0x120
[  278.141208]  [<ffffffff8107f75e>] kthread+0x9e/0xb0
[  278.141210]  [<ffffffff8107f75e>] kthread+0x9e/0xb0
[  278.141213]  [<ffffffff81444d04>] kernel_thread_helper+0x4/0x10
[  278.141216]  [<ffffffff81444d04>] kernel_thread_helper+0x4/0x10
[  278.141218]  [<ffffffff8143bcc1>] ? retint_restore_args+0x13/0x13
[  278.141221]  [<ffffffff8143bcc1>] ? retint_restore_args+0x13/0x13
[  278.141223]  [<ffffffff8107f6c0>] ? kthread_worker_fn+0x1b0/0x1b0
[  278.141226]  [<ffffffff8107f6c0>] ? kthread_worker_fn+0x1b0/0x1b0
[  278.141229]  [<ffffffff81444d00>] ? gs_change+0x13/0x13
[  278.141231]  [<ffffffff81444d00>] ? gs_change+0x13/0x13

The fix was to add proper locking in igb_resume(). And this fix was buried
in the commit 749ab2cd (igb: add basic runtime PM support). This patch
backports just that fix alone.

The original patch description of commit 749ab2cd was:

Use the runtime power management framework to add basic runtime PM support
to the igb driver. Namely, make the driver suspend the device when the link
is off and set it up for generating a wakeup event after the link has been
detected again. This feature is disabled by default.

Based on e1000e's runtime PM code.

Changes since v1:
Don't suspend the device when shutting down the interface.
Avoid race between runtime suspending and ethtool operations.

Signed-off-by: Zheng Yan <zheng.z....@intel.com>
Tested-by: Aaron Brown <aaron.f.br...@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirs...@intel.com>
Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Srivatsa S. Bhat <srivatsa.b...@linux.vnet.ibm.com>
---

 drivers/net/igb/igb_main.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 97f46ac..37e1ebe 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -6513,7 +6513,18 @@ static int igb_resume(struct pci_dev *pdev)
        pci_enable_wake(pdev, PCI_D3hot, 0);
        pci_enable_wake(pdev, PCI_D3cold, 0);
 
-       if (igb_init_interrupt_scheme(adapter)) {
+       if (!rtnl_is_locked()) {
+               /*
+                * shut up ASSERT_RTNL() warning in
+                * netif_set_real_num_tx/rx_queues.
+                */
+               rtnl_lock();
+               err = igb_init_interrupt_scheme(adapter);
+               rtnl_unlock();
+       } else {
+               err = igb_init_interrupt_scheme(adapter);
+       }
+       if (err) {
                dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
                return -ENOMEM;
        }


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to