]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
i40e: prevent service task from running while we're suspended
authorJacob Keller <jacob.e.keller@intel.com>
Fri, 14 Jul 2017 13:27:05 +0000 (09:27 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 29 Sep 2017 19:51:01 +0000 (12:51 -0700)
Although the service task does check the suspended status before
running, it might already be part way through running when we go to
suspend. Lets ensure that the service task is stopped and will not be
restarted again until we finish resuming. This ensures that service task
code does not cause strange interactions with the suspend/resume
handlers.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 494cafde6b269cecb100b7bb29df28dca950ad81..368373459ad5d5dd24dafa3d083eb0817605e9cc 100644 (file)
@@ -12065,6 +12065,10 @@ static int i40e_suspend(struct device *dev)
 
        set_bit(__I40E_DOWN, pf->state);
 
+       /* Ensure service task will not be running */
+       del_timer_sync(&pf->service_timer);
+       cancel_work_sync(&pf->service_task);
+
        if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE))
                i40e_enable_mc_magic_wake(pf);
 
@@ -12097,6 +12101,10 @@ static int i40e_resume(struct device *dev)
        /* Clear suspended state last after everything is recovered */
        clear_bit(__I40E_SUSPENDED, pf->state);
 
+       /* Restart the service task */
+       mod_timer(&pf->service_timer,
+                 round_jiffies(jiffies + pf->service_timer_period));
+
        return 0;
 }