From patchwork Wed Jul 18 14:14:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 142280 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp593995ljj; Wed, 18 Jul 2018 07:16:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd/X6gv2JDxVdMWthSOdzNeTEZT3qMdR+i4KQncv44Q9OBR7R7UXLBPDnsPbl3fuPF2oYaq X-Received: by 2002:a65:4888:: with SMTP id n8-v6mr6073267pgs.149.1531923380530; Wed, 18 Jul 2018 07:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531923380; cv=none; d=google.com; s=arc-20160816; b=M95Y9xXzdxhF2K5xRq5MwBybB+U+DZ0n2aDKZxMlXjqjgL2YHSnJ2ijR1H3fGXQE9b 3kjw35RHBff02QRg1/UCn7Cry2SClkEBRG4nCYJnYQRI3XGLK4xm1EoRfz9c1Axd+zze Q43PuNXD6Px1FEVOUFXsAvgMOvAS67cS6OZ7Fhh/9pdkLpqrj4jBHxPCZwlGcciB5MQs qBfrixQk0eagn7QjyRoobe73d+e//zGQFo09rC+MV9bMHFymFth/8rz3K0G3DoZvrsTg icQOYAMEvf/SaWpHdh+9Vqh4x3fLcKrXNhwr4H2hHfU8d2O+2UxOm3f2sjliMbo8U2lf vwDw== 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=IKS5NREnjUkqhJghh+4agBaGCRtS9c4z9aGkXoq8nuQ=; b=yxffLQM05c2cIpTiMljwrxBoQbTR4Wb3pQchuERkRT8eQS3itFSPbzamfekH1khsxK IT6+YLBozyK8hv6u57Ndlq/BuyX5+Xn6j7q4uXIWtP6Z1rSl+gUhOykPj59eZQHnyytH IQuVD+BZylRYeeIVHBuharHGg/SDw7bs9ecbftPI2NIwECr6klOyr3KgGfO4/0Yp7r4m ILWwxB0bFleLNlzfL43wGy/M5xcjffATK5hWTrSQvmMzFEFf0DjNvAP6R2IgByEvzNdV GwqxUXYZtBAr8qmI7mUDdyGPpR7ZJIQHYLyySSzV6MfQMqgQPMUKzHSF0Y+wx0QnCg1S JW2g== 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 65-v6si3467581pld.451.2018.07.18.07.16.20; Wed, 18 Jul 2018 07:16:20 -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 S1731161AbeGROyZ (ORCPT + 31 others); Wed, 18 Jul 2018 10:54:25 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9693 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727083AbeGROyY (ORCPT ); Wed, 18 Jul 2018 10:54:24 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E03B06D0FE8C; Wed, 18 Jul 2018 22:16:03 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Wed, 18 Jul 2018 22:15:57 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 7/9] scsi: hisi_sas: Tidy hisi_sas_task_prep() Date: Wed, 18 Jul 2018 22:14:31 +0800 Message-ID: <1531923273-193768-8-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1531923273-193768-1-git-send-email-john.garry@huawei.com> References: <1531923273-193768-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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen To decrease the usage of spinlock during delivery IO, relocate some code in hisi_sas_task_prep(). Also an invalid comment is removed. Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_main.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index b0bcd14..432a38a 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -296,8 +296,8 @@ static int hisi_sas_task_prep(struct sas_task *task, struct device *dev = hisi_hba->dev; int dlvry_queue_slot, dlvry_queue, rc, slot_idx; int n_elem = 0, n_elem_req = 0, n_elem_resp = 0; - unsigned long flags, flags_dq; struct hisi_sas_dq *dq; + unsigned long flags; int wr_q_index; if (!sas_port) { @@ -393,16 +393,17 @@ static int hisi_sas_task_prep(struct sas_task *task, slot = &hisi_hba->slot_info[slot_idx]; - spin_lock_irqsave(&dq->lock, flags_dq); + spin_lock_irqsave(&dq->lock, flags); wr_q_index = hisi_hba->hw->get_free_slot(hisi_hba, dq); if (wr_q_index < 0) { - spin_unlock_irqrestore(&dq->lock, flags_dq); + spin_unlock_irqrestore(&dq->lock, flags); rc = -EAGAIN; goto err_out_tag; } list_add_tail(&slot->delivery, &dq->list); - spin_unlock_irqrestore(&dq->lock, flags_dq); + list_add_tail(&slot->entry, &sas_dev->list); + spin_unlock_irqrestore(&dq->lock, flags); dlvry_queue = dq->id; dlvry_queue_slot = wr_q_index; @@ -440,9 +441,6 @@ static int hisi_sas_task_prep(struct sas_task *task, break; } - spin_lock_irqsave(&dq->lock, flags); - list_add_tail(&slot->entry, &sas_dev->list); - spin_unlock_irqrestore(&dq->lock, flags); spin_lock_irqsave(&task->task_state_lock, flags); task->task_state_flags |= SAS_TASK_AT_INITIATOR; spin_unlock_irqrestore(&task->task_state_lock, flags); @@ -818,7 +816,6 @@ static void hisi_sas_do_release_task(struct hisi_hba *hisi_hba, struct sas_task hisi_sas_slot_task_free(hisi_hba, task, slot); } -/* hisi_hba.lock should be locked */ static void hisi_sas_release_task(struct hisi_hba *hisi_hba, struct domain_device *device) {