Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5617364imu; Mon, 26 Nov 2018 03:04:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZsc2DgtM4jHtkxcjIcXWLEOSD1L4Rr75cHGhJfi1vyU4fjVRU/DENADgmFvIkcI2oBVTH X-Received: by 2002:a17:902:292b:: with SMTP id g40mr27579457plb.82.1543230268427; Mon, 26 Nov 2018 03:04:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543230268; cv=none; d=google.com; s=arc-20160816; b=AYdWOqzjUwSTs2VjTSXIzHKHqJtUZulnrowiFI6fkqv3KBiLd1g5zG/bc7p7ftkdH2 GJBtvwvXeklz/elbNhUCj2lsc93KdocISkQxAQe0zWCsUNeRnhqCpdMslaMlIu5XeDnt D5WLY/ncRngtiO8b6dszbtkj8A7UtXyd69JU0q9w9gB4dmmXqMNi4BRjB+GpicyV22si YrxUKj77BLkuXbmv7dDHNJE7HdK8+yZ6Fao0Hji/rjXZB8ZARffJG9zmpmUwlwNMFJ+g G6OFQ+ogcCn2TpeGQtoy7Tzwz3OV3qGrJzYgIUGD9rOQbUMKbFoSv7z+UuhJ8pJLqjtn /xLw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oUgd/W8SiSWi0SrI2Ubd1T6fEtw39l2PWktlsu+/rbU=; b=qgCDjikAZIrStvuse9en9igKUtALy087RrCCKHmZCSjQqO/6ReamXO4gIksrjEVWLV NdRmFSQFbwyHxoUB8/jD5smbiUmDQpWwYd26e17CTozi2SMJiafAbXJcSlNqUZ0zP7Lf gTvdBZOMovyKaLb802S1Mu+LeQj5ZCOwzD51dldnrq6XUGHctID7gACx9c5deLucHHXh mdkbpOIEseB5FblyCEm3I/yFYrgGkb06KU5zhTIowtUwK94BUMpN/adazwb0m+ywbxmf 84wD+TpLeMv7e2jAbin8+j3VMzXCu/bMtUx8NuTf2/Ctwly2ZMW+1XDlrX9xptrQH0yi xnYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wO+ZFFZG; 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 q14si60490937pgq.197.2018.11.26.03.04.13; Mon, 26 Nov 2018 03:04:28 -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=wO+ZFFZG; 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 S1730696AbeKZV5B (ORCPT + 99 others); Mon, 26 Nov 2018 16:57:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:40782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbeKZV5A (ORCPT ); Mon, 26 Nov 2018 16:57:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8EF322089F; Mon, 26 Nov 2018 11:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543230195; bh=VW7ZsZiVIR638kWftugTZnYF8ORwlHJuGtU78F7RuUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wO+ZFFZGlwfNQCa84FvlsB8U4dfdNLZpbnsCCWORAXphxN5aiqlgwW+e50zp8D2nz loHdeer47lGMRcziZZxr2JbUagjgpnANx0oHdAKd+4BsC2KvN4q4Nw2XHz0qBrR83o F9itlJ1kWkayT8LL4LLx4cU63ZloTT40j3eBySH0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huazhong Tan , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 010/118] net: hns3: bugfix for the initialization of command queues spin lock Date: Mon, 26 Nov 2018 11:50:04 +0100 Message-Id: <20181126105100.247930442@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105059.832485122@linuxfoundation.org> References: <20181126105059.832485122@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit b2f74dbaf12bf59ff35d451005b3cdee78232ff0 ] The spin lock of the command queue only need to be initialized once when the driver initializes the command queue. It is not necessary to initialize the spin lock when resetting. At the same time, the modification of the queue member should be performed after acquiring the lock. Fixes: 3efb960f056d ("net: hns3: Refactor the initialization of command queue") Signed-off-by: Huazhong Tan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c index ac13cb2b168e..68026a5ad7e7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c @@ -304,6 +304,10 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev) { int ret; + /* Setup the lock for command queue */ + spin_lock_init(&hdev->hw.cmq.csq.lock); + spin_lock_init(&hdev->hw.cmq.crq.lock); + /* Setup the queue entries for use cmd queue */ hdev->hw.cmq.csq.desc_num = HCLGE_NIC_CMQ_DESC_NUM; hdev->hw.cmq.crq.desc_num = HCLGE_NIC_CMQ_DESC_NUM; @@ -337,18 +341,20 @@ int hclge_cmd_init(struct hclge_dev *hdev) u32 version; int ret; + spin_lock_bh(&hdev->hw.cmq.csq.lock); + spin_lock_bh(&hdev->hw.cmq.crq.lock); + hdev->hw.cmq.csq.next_to_clean = 0; hdev->hw.cmq.csq.next_to_use = 0; hdev->hw.cmq.crq.next_to_clean = 0; hdev->hw.cmq.crq.next_to_use = 0; - /* Setup the lock for command queue */ - spin_lock_init(&hdev->hw.cmq.csq.lock); - spin_lock_init(&hdev->hw.cmq.crq.lock); - hclge_cmd_init_regs(&hdev->hw); clear_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state); + spin_unlock_bh(&hdev->hw.cmq.crq.lock); + spin_unlock_bh(&hdev->hw.cmq.csq.lock); + ret = hclge_cmd_query_firmware_version(&hdev->hw, &version); if (ret) { dev_err(&hdev->pdev->dev, -- 2.17.1