Received: by 10.192.165.148 with SMTP id m20csp564875imm; Wed, 25 Apr 2018 04:21:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+NdUbEwFxVroYHUfVmd/0gZYsET7ZdytqMYrBpKam47TGoA8lFf4oMpgYzZPwTaDN0HloL X-Received: by 10.101.100.214 with SMTP id t22mr18461186pgv.41.1524655283539; Wed, 25 Apr 2018 04:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524655283; cv=none; d=google.com; s=arc-20160816; b=SJW08zRXjZ0ItakmqzTbtx55ylCuTeMV6y9da5qcpnWoiNyyVTvEPyv1nioTu5Y4oA 8wIXrPVlhMiPaxKRaD8CCGytxBaUwW4G2c3hrSQ+8LmOQHED1o5QEHYZuOe4f5sNqvkC OkTYGEp0kf+lImGF0YXYwVlVeTwLh936lpJcrySY8qYOJaVfIlzi8JQEp6U5XKAUu9sM GCGQ87vXMEm7afTPcstIo3duztXSRi55XrPXoFocd3K86aVxxgJ3/z7JaTwe7X9XnjgG t9BsPE4d6ywUG5wtG8amYzL1h4bXG7HigykBxk6cuyCfqWsvaY5QOIrpQyDZyUmtXQdN UmwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=8HX0zdOj7dRkCPjRs7jD1pKO71rqGqXekddRIUEdJus=; b=AKtCWvrqKgHCT6O2nEKCJnCwidrreL/0H3fM2vprYHmp6cDyej49jlGzE9UM74yNxt ipIx8jSC8J5A3tFnmGVr1ErYaJaBpHqlcdzeocpcSqQ7zggBa31wbbfF6+rqTbhllhcU nI9Se+9cawEt//fJ8NOUQirnzHwN5D8lqLsLZYw0tLsuCNMnsUkVm90KTlJDIoIfiXSm DCAV6KJpJDCg6QP/q/vg5HXNwzelpBwXl+nxBeNQZ0BzURX89ZJ/krVQ+M4bpFgOBUpA xohFPpmxgA5iF70CI12rmxt52Vn+c49sgXoPnb7us3pngDBzrpSigN0eU5QIneLcHTAF uSXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n30si13701840pgc.231.2018.04.25.04.21.09; Wed, 25 Apr 2018 04:21:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753301AbeDYLTD (ORCPT + 99 others); Wed, 25 Apr 2018 07:19:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52046 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752441AbeDYKkK (ORCPT ); Wed, 25 Apr 2018 06:40:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 253AC272; Wed, 25 Apr 2018 10:40:09 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avinash Dayanand , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.14 078/183] i40evf: Dont schedule reset_task when device is being removed Date: Wed, 25 Apr 2018 12:34:58 +0200 Message-Id: <20180425103245.641107824@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Avinash Dayanand [ Upstream commit 06aa040f039404a0039a5158cd12f41187487a1f ] When a host disables and enables a PF device, all the associated VFs are removed and added back in. It also generates a PFR which in turn resets all the connected VFs. This behaviour is different from that of Linux guest on Linux host. Hence we end up in a situation where there's a PFR and device removal at the same time. And watchdog doesn't have a clue about this and schedules a reset_task. This patch adds code to send signal to reset_task that the device is currently being removed. Signed-off-by: Avinash Dayanand Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/i40evf/i40evf.h | 1 + drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/intel/i40evf/i40evf.h +++ b/drivers/net/ethernet/intel/i40evf/i40evf.h @@ -186,6 +186,7 @@ enum i40evf_state_t { enum i40evf_critical_section_t { __I40EVF_IN_CRITICAL_TASK, /* cannot be interrupted */ __I40EVF_IN_CLIENT_TASK, + __I40EVF_IN_REMOVE_TASK, /* device being removed */ }; /* board specific private data structure */ --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c @@ -1839,6 +1839,12 @@ static void i40evf_reset_task(struct wor int i = 0, err; bool running; + /* When device is being removed it doesn't make sense to run the reset + * task, just return in such a case. + */ + if (test_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section)) + return; + while (test_and_set_bit(__I40EVF_IN_CLIENT_TASK, &adapter->crit_section)) usleep_range(500, 1000); @@ -3022,7 +3028,8 @@ static void i40evf_remove(struct pci_dev struct i40evf_mac_filter *f, *ftmp; struct i40e_hw *hw = &adapter->hw; int err; - + /* Indicate we are in remove and not to run reset_task */ + set_bit(__I40EVF_IN_REMOVE_TASK, &adapter->crit_section); cancel_delayed_work_sync(&adapter->init_task); cancel_work_sync(&adapter->reset_task); cancel_delayed_work_sync(&adapter->client_task);