From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linux-scsi@vger.kernel.org>, <linuxarm@huawei.com>,
<linux-kernel@vger.kernel.org>,
Xiang Chen <chenxiang66@hisilicon.com>,
"John Garry" <john.garry@huawei.com>
Subject: [PATCH 7/9] scsi: hisi_sas: Tidy hisi_sas_task_prep()
Date: Wed, 18 Jul 2018 22:14:31 +0800 [thread overview]
Message-ID: <1531923273-193768-8-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1531923273-193768-1-git-send-email-john.garry@huawei.com>
From: Xiang Chen <chenxiang66@hisilicon.com>
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 <chenxiang66@hisilicon.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas_main.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
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)
{
--
1.9.1
next prev parent reply other threads:[~2018-07-18 14:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 14:14 [PATCH 0/9] hisi_sas: Some misc patches John Garry
2018-07-18 14:14 ` [PATCH 1/9] scsi: hisi_sas: Drop hisi_sas_slot_abort() John Garry
2018-07-18 14:14 ` [PATCH 2/9] scsi: hisi_sas: tidy channel interrupt handler for v3 hw John Garry
2018-07-18 14:14 ` [PATCH 3/9] scsi: hisi_sas: Fix the failure of recovering PHY from STP link timeout John Garry
2018-07-18 14:14 ` [PATCH 4/9] scsi: hisi_sas: tidy host controller reset function a bit John Garry
2018-07-18 14:14 ` [PATCH 5/9] scsi: hisi_sas: relocate some common code for v3 hw John Garry
2018-07-18 14:14 ` [PATCH 6/9] scsi: hisi_sas: Implement handlers of PCIe FLR " John Garry
2018-07-18 14:14 ` John Garry [this message]
2018-07-18 14:14 ` [PATCH 8/9] scsi: hisi_sas: add memory barrier in task delivery function John Garry
2018-07-18 14:14 ` [PATCH 9/9] scsi: hisi_sas: Add SATA FIS check for v3 hw John Garry
2018-07-20 2:05 ` [PATCH 0/9] hisi_sas: Some misc patches Martin K. Petersen
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=1531923273-193768-8-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=chenxiang66@hisilicon.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=martin.petersen@oracle.com \
/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).