Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3625334imu; Mon, 28 Jan 2019 08:03:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Aixal46/LAG8cpsVhZHpoPgQv8rZzq5aC82RFXjKhamJSwsII2r4AZalpuRX4c90WD9Wh X-Received: by 2002:a63:4f20:: with SMTP id d32mr20241439pgb.47.1548691406929; Mon, 28 Jan 2019 08:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691406; cv=none; d=google.com; s=arc-20160816; b=saM6CBcw8cJcQFIE+rRcgrFLuxo3x4uMXGhAOd4N8CunDXfE1GY6Rw0NDIkO16k0Gh USz8P3hhTNv+bumzRuEBnVmF9YZKA4hSLMqfjgNZjS6ISE9Hc5pO0MKtLnwJ9D8EYUhz kQP+HYcSDHeQm3vOPCnp22FNFwzWXmsSeY/hHLffWaeFmc0FXjRxrqBeFl4RUvwsET9R TUOIPUrjP3qyvfFSv5ZsE2emOJ4bwUFS/pXh3uX5iSQ98pmJ1mWv3A2D1G4kf7BxePTf cftDovKx7lghHyJMFqblD3jt2TatH2k2nusVBJ3IuKvk9dz3UQO/+l8R0fIhu9YRMVv3 +/eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dO09AIHRlSeUj4B8+abgs9FMgc2iTVsvNKtaf2KHmCk=; b=G7YDVfbEm8ZAo6hq/Pa5Vk0YDfC0D39ILcgmMHHlasXwHVwoj6uc7wHlrK2kG0TS2A +5WojaOQr8zYyPxtZrOoH/kqggmSZhZ3mVQiLr3EsxWqWGfr5mGQgap03uaiUR0PYoz8 aSHDL+4yd+uJNAg3SZgJ7YYyNK5h5XXY4Iza5XV/ZboiwzqBJc9GMPgHywxTDWhA00T4 9Mu7N7DB22A8Fss2ztRZa/WPx5++QW+grNnoBu0HzAgudDv+lY/AFlZv5IO+IE8EP7sE dkFcWNUhGg+UHeoYA+sB+QSsetBzIj6gGct4vknY287wR12C0YhcVrlWkH6thwWVPCA0 uHSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pSvJ080z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca6si17609219plb.141.2019.01.28.08.03.10; Mon, 28 Jan 2019 08:03:26 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=pSvJ080z; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731004AbfA1QBT (ORCPT + 99 others); Mon, 28 Jan 2019 11:01:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:46554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730946AbfA1QBR (ORCPT ); Mon, 28 Jan 2019 11:01:17 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4C89A2082E; Mon, 28 Jan 2019 16:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691276; bh=JQP+/wZ9s0dJPR8LqxcHn8gMRinFj+VO638v3GhjAPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pSvJ080zl+Bi2XSbxH8lzSCoJkgjKlomn1eUaBbyesT4oeD9IZ8BirD6aliV7ZU90 Q7M5V91GXAyRkP+kvHiPELJYKTSn82dadqz6Wd1bmAigKAetWA5Z3S/NFx92jfZZUS dV39zmIoMMljcXqDi2xQfBwiytnuh2WsxLaqd56o= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alan Brady , Jeff Kirsher , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 042/258] i40e: prevent overlapping tx_timeout recover Date: Mon, 28 Jan 2019 10:55:48 -0500 Message-Id: <20190128155924.51521-42-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alan Brady [ Upstream commit d5585b7b6846a6d0f9517afe57be3843150719da ] If a TX hang occurs, we attempt to recover by incrementally resetting. If we're starved for CPU time, it's possible the reset doesn't actually complete (or even fire) before another tx_timeout fires causing us to fly through the different resets without actually doing them. This adds a bit to set and check if a timeout recovery is already pending and, if so, bail out of tx_timeout. The bit will get cleared at the end of i40e_rebuild when reset is complete. Signed-off-by: Alan Brady Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h index 7a80652e2500..f84e2c2d02c0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e.h +++ b/drivers/net/ethernet/intel/i40e/i40e.h @@ -122,6 +122,7 @@ enum i40e_state_t { __I40E_MDD_EVENT_PENDING, __I40E_VFLR_EVENT_PENDING, __I40E_RESET_RECOVERY_PENDING, + __I40E_TIMEOUT_RECOVERY_PENDING, __I40E_MISC_IRQ_REQUESTED, __I40E_RESET_INTR_RECEIVED, __I40E_REINIT_REQUESTED, diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index ed9d3fc4aaba..bfa5c525cf31 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -336,6 +336,10 @@ static void i40e_tx_timeout(struct net_device *netdev) (pf->tx_timeout_last_recovery + netdev->watchdog_timeo))) return; /* don't do any new action before the next timeout */ + /* don't kick off another recovery if one is already pending */ + if (test_and_set_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state)) + return; + if (tx_ring) { head = i40e_get_head(tx_ring); /* Read interrupt register */ @@ -9566,6 +9570,7 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired) clear_bit(__I40E_RESET_FAILED, pf->state); clear_recovery: clear_bit(__I40E_RESET_RECOVERY_PENDING, pf->state); + clear_bit(__I40E_TIMEOUT_RECOVERY_PENDING, pf->state); } /** -- 2.19.1