DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: beilei.xing@intel.com
Cc: dev@dpdk.org, jingjing.wu@intel.com,
	Qi Zhang <qi.z.zhang@intel.com>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 04/24] net/i40e/base: release spinlock before function returns
Date: Tue,  9 Jan 2018 15:17:04 -0500	[thread overview]
Message-ID: <1515529044-10168-5-git-send-email-qi.z.zhang@intel.com> (raw)
In-Reply-To: <1515529044-10168-1-git-send-email-qi.z.zhang@intel.com>

Fix a bug that adminq spin lock is not be released before function
i40e_nvmupd_command returns.

Fixes: 5a2e46a3e405 ("net/i40e/base: refactor NVM update command processing")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/base/i40e_nvm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/i40e/base/i40e_nvm.c b/drivers/net/i40e/base/i40e_nvm.c
index a1e78300d..946778ba3 100644
--- a/drivers/net/i40e/base/i40e_nvm.c
+++ b/drivers/net/i40e/base/i40e_nvm.c
@@ -907,7 +907,11 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 
 	/* Acquire lock to prevent race condition where adminq_task
 	 * can execute after i40e_nvmupd_nvm_read/write but before state
-	 * variables (nvm_wait_opcode, nvm_release_on_done) are updated
+	 * variables (nvm_wait_opcode, nvm_release_on_done) are updated.
+	 *
+	 * During NVMUpdate, it is observed that lock could be held for
+	 * ~5ms for most commands. However lock is held for ~60ms for
+	 * NVMUPD_CSUM_LCB command.
 	 */
 	i40e_acquire_spinlock(&hw->aq.arq_spinlock);
 	switch (hw->nvmupd_state) {
@@ -930,7 +934,8 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		 */
 		if (cmd->offset == 0xffff) {
 			i40e_nvmupd_check_wait_event(hw, hw->nvm_wait_opcode);
-			return I40E_SUCCESS;
+			status = I40E_SUCCESS;
+			goto exit;
 		}
 
 		status = I40E_ERR_NOT_READY;
@@ -945,6 +950,7 @@ enum i40e_status_code i40e_nvmupd_command(struct i40e_hw *hw,
 		*perrno = -ESRCH;
 		break;
 	}
+exit:
 	i40e_release_spinlock(&hw->aq.arq_spinlock);
 	return status;
 }
-- 
2.14.1

  parent reply	other threads:[~2018-01-10  3:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 20:17 [dpdk-dev] [PATCH v2 00/24] net/i40e: update base code Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 01/24] net/i40e/base: add new PHY type Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 02/24] net/i40e/base: add capability macros Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 03/24] net/i40e/base: add (Q)SFP module memory access definitions Qi Zhang
2018-01-09 20:17 ` Qi Zhang [this message]
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 05/24] net/i40e/base: retry AQC to overcome IRCRead hangs Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 06/24] net/i40e/base: add byte swaps in PHY register access Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 07/24] net/i40e/base: add macro for 25G device Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 08/24] net/i40e/base: code refactoring for LED blink Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 09/24] net/i40e/base: add link speed convert function Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 10/24] net/i40e/base: add AQ command for DCB parameters Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 11/24] net/i40e/base: fix NVM lock Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 12/24] net/i40e/base: code clean Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 13/24] net/i40e/base: add NVM update preservation flags Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 14/24] net/i40e/base: enable AQ event get in NVM update Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 15/24] net/i40e/base: fix link LED blink Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 16/24] net/i40e/base: add defines for flat NVM Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 17/24] net/i40e: enhanced loopback AQ command Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 18/24] net/i40e/base: add rearrange process " Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 19/24] net/i40e/base: add AQ critical error type Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 20/24] net/i40e/base: fix compile issue for GCC 6.3 Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 21/24] net/i40e/base: fix reading LLDP configuration Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 22/24] net/i40e/base: fix unaligned data issue Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 23/24] net/i40e: rename a field Qi Zhang
2018-01-09 20:17 ` [dpdk-dev] [PATCH v2 24/24] net/i40e/base: update README file Qi Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515529044-10168-5-git-send-email-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).