From patchwork Wed May 2 15:56:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 134839 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp846227lji; Wed, 2 May 2018 08:57:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqECFsMSD0m3Q9r8g7o5IW3ULupwwCRZqKqWSZUUwqYE3/tuoBY+ySozKex76hRAf8bTLXH X-Received: by 2002:a65:6188:: with SMTP id c8-v6mr16651190pgv.131.1525276652092; Wed, 02 May 2018 08:57:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525276652; cv=none; d=google.com; s=arc-20160816; b=tkUAyMYiCBJ52yMSN9XGkM6KWyse3DbQhXEVZS6b32RxDIJMT8pcnpd71SUTjd+vmH Wan1et8b1Ihj6F2jYjoImnMgfjX6NMqHb4YmJdZDg7A6jajZ3sRSHtjsYAHhlor959Aq 0jjf35cZkKUbsR8sxwY6lrXWWEPlhkP74p/I7RkCnpfWk/tE+BmLdqopbSgeeEBnP9JP wl7imVQLrtqJ1Cses11sI1x0cHtd/AcZEI/WO0rSb1W00LlMEIgq0BsIX3QUA/rzijN8 g4U1taUz+ufvlKTr9Z4HUhZ2mTxyfJUfm8l5BukWDQIbYZgAWbLj/6kwptrzOYmsMDLf RlhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=DAmu1TIzEtH0ozda3x5/Ly2aDoUcBTOL4fUrYfvmzn0=; b=Aj79dGhk0BRoJDenHjsK4svJmwjnMsnjW5FO2/fUhgexiBmAdj9vXoUXbUUUPNWeRV bTkRVXarg95yGMVZMmGSZW6pSYTk3etCfIsx0MwzfQkHIznhfBoNd8hRwciJ2AMufPjI v9GnrWIWqgdmWN02hOrjZlHDnYaZqZ/fXVqVcVBsjfYMejZJ9g+5c6XrFR+76OR3KFMN fn0EYzo9aIaiEmZ29ZWxIxEWpuVOu0uFvQ2l0FZeSm32ziwBFqKn1psmemAhZo8vS8eb rKEjQh/higcj63HL3HUsgC7zcG4p70FECUpqZSby66N+Pwjq92DXDc8WiARQLKu/2NkK YUxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 o184-v6si9681120pga.128.2018.05.02.08.57.31; Wed, 02 May 2018 08:57:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752017AbeEBP5a (ORCPT + 1 other); Wed, 2 May 2018 11:57:30 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:54537 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751658AbeEBP51 (ORCPT ); Wed, 2 May 2018 11:57:27 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C2404C811592E; Wed, 2 May 2018 23:57:23 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.361.1; Wed, 2 May 2018 23:57:16 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 01/11] scsi: hisi_sas: optimise the usage of DQ locking Date: Wed, 2 May 2018 23:56:24 +0800 Message-ID: <1525276594-92173-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525276594-92173-1-git-send-email-john.garry@huawei.com> References: <1525276594-92173-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen In the DQ tasklet processing it is not necessary to take the DQ lock, as there is no contention between adding slots to the CQ and removing slots from the matching DQ. In addition, since we run each DQ in a separate tasklet context, there would be no possible contention between DQ processing running for the same queue in parallel. It is still necessary to take hisi_hba lock when free'ing slots. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 --- 2 files changed, 6 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index a5abde8..384e4ef 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -3151,14 +3151,12 @@ static void cq_tasklet_v2_hw(unsigned long val) struct hisi_sas_complete_v2_hdr *complete_queue; u32 rd_point = cq->rd_point, wr_point, dev_id; int queue = cq->id; - struct hisi_sas_dq *dq = &hisi_hba->dq[queue]; if (unlikely(hisi_hba->reject_stp_links_msk)) phys_try_accept_stp_links_v2_hw(hisi_hba); complete_queue = hisi_hba->complete_hdr[queue]; - spin_lock(&dq->lock); wr_point = hisi_sas_read32(hisi_hba, COMPL_Q_0_WR_PTR + (0x14 * queue)); @@ -3208,7 +3206,6 @@ static void cq_tasklet_v2_hw(unsigned long val) /* update rd_point */ cq->rd_point = rd_point; hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); - spin_unlock(&dq->lock); } static irqreturn_t cq_interrupt_v2_hw(int irq_no, void *p) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 33735a7..afc1242 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1721,11 +1721,9 @@ static void cq_tasklet_v3_hw(unsigned long val) struct hisi_sas_complete_v3_hdr *complete_queue; u32 rd_point = cq->rd_point, wr_point; int queue = cq->id; - struct hisi_sas_dq *dq = &hisi_hba->dq[queue]; complete_queue = hisi_hba->complete_hdr[queue]; - spin_lock(&dq->lock); wr_point = hisi_sas_read32(hisi_hba, COMPL_Q_0_WR_PTR + (0x14 * queue)); @@ -1752,7 +1750,6 @@ static void cq_tasklet_v3_hw(unsigned long val) /* update rd_point */ cq->rd_point = rd_point; hisi_sas_write32(hisi_hba, COMPL_Q_0_RD_PTR + (0x14 * queue), rd_point); - spin_unlock(&dq->lock); } static irqreturn_t cq_interrupt_v3_hw(int irq_no, void *p)