From patchwork Mon Sep 24 15:06: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: 147368 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp837238lji; Mon, 24 Sep 2018 08:10:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV63EajjW0WLQfMGfFZoj20yeNYxUhH2ZTilUdJC8/WZ+qFEhb61fA6Byqy8lklWiLxKh3yi4 X-Received: by 2002:a17:902:d909:: with SMTP id c9-v6mr10583398plz.165.1537801823407; Mon, 24 Sep 2018 08:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537801823; cv=none; d=google.com; s=arc-20160816; b=e1Y5K5OU8dmMiavSOUdHglJf9nZctPTt5Naceb1QMemF0p0+lLIuQtEWUSL0IEN0mR W3DFSfkUkzCID/7r8lNI+s2XlGKKruljI9os+QQ5hYCT5vxicRIt0oWZATnTMpFWeMn1 u/En94ZJTbEENllwiyO5EqnPPsJL03BcceCAMT1M7d3eDcDip8+ssEJyPc5SAM3Ll1gt G3SJJJgud059bz8Ojut7jxTCVAMNECerVxjpI2p3aG5eLsdlHoJSD5M6pDBQtGrUGitF T0s18NAv2Cbaw6HzIBogff48RGKZ3ElsFgxoKJgg6ouEVSdY3Amc4Btm5NPA6rDfARjX tVEQ== 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; bh=AAoLJDLYmEJiHC89PIX6elwnrCVX/nK+UpJFljJCzsw=; b=IiGOOqyPd+VOFqwBl+vbrdfYy+TNLFymQRux6W2YbFek3SkS9u4pQwNlXV7XXMzaf3 rC2EB5k619tzcVmqGy1deMAmpJgN4nYawPyyxtfyUXcJUsJ4+gxO/9K5udFq3c3nJzRl ORWINORApC2fJLCsd2HnHGac7HMFV9nsokQw9LnHcysUC23RpDe0zWALSiCgfwGLut+n kfWmE8EV79OzZf4yZ3hjqP2rTTLhAE8Z1l25yanKtOHQGeEilLyhq3Z47iDqE7HqLxnG c2OOLB3dqd/UecWSzujfH9wd88PwjJU6Qrtz5G8REqZT7bTx054VmdCmrjQ5Pnu8aAbB zM4Q== 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 b5-v6si36893127pfa.116.2018.09.24.08.10.22; Mon, 24 Sep 2018 08:10:23 -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 S1731010AbeIXVM6 (ORCPT + 32 others); Mon, 24 Sep 2018 17:12:58 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12684 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729737AbeIXVMV (ORCPT ); Mon, 24 Sep 2018 17:12:21 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id F103E63A0974B; Mon, 24 Sep 2018 23:09:38 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.399.0; Mon, 24 Sep 2018 23:09:32 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 4/7] scsi: hisi_sas: Free slot later in slot_complete_vx_hw() Date: Mon, 24 Sep 2018 23:06:31 +0800 Message-ID: <1537801594-207139-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1537801594-207139-1-git-send-email-john.garry@huawei.com> References: <1537801594-207139-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 If an SSP/SMP IO times out, it may be actually in reality be simultaneously processing completion of the slot in slot_complete_vx_hw(). Then if the slot is freed in slot_complete_vx_hw() (this IPTT is freed and it may be re-used by other slot), and we may abort the wrong slot in hisi_sas_abort_task(). So to solve the issue, free the slot after the check of SAS_TASK_STATE_ABORTED in slot_complete_vx_hw(). Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 2 +- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 2 files changed, 2 insertions(+), 2 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 9c5c5a6..67134b4 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -2483,7 +2483,6 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, } out: - hisi_sas_slot_task_free(hisi_hba, task, slot); sts = ts->stat; spin_lock_irqsave(&task->task_state_lock, flags); if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { @@ -2493,6 +2492,7 @@ static void slot_err_v2_hw(struct hisi_hba *hisi_hba, } task->task_state_flags |= SAS_TASK_STATE_DONE; spin_unlock_irqrestore(&task->task_state_lock, flags); + hisi_sas_slot_task_free(hisi_hba, task, slot); if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) { spin_lock_irqsave(&device->done_lock, flags); diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 08b503e2..3995ff6 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1751,7 +1751,6 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p) } out: - hisi_sas_slot_task_free(hisi_hba, task, slot); sts = ts->stat; spin_lock_irqsave(&task->task_state_lock, flags); if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { @@ -1761,6 +1760,7 @@ static irqreturn_t fatal_axi_int_v3_hw(int irq_no, void *p) } task->task_state_flags |= SAS_TASK_STATE_DONE; spin_unlock_irqrestore(&task->task_state_lock, flags); + hisi_sas_slot_task_free(hisi_hba, task, slot); if (!is_internal && (task->task_proto != SAS_PROTOCOL_SMP)) { spin_lock_irqsave(&device->done_lock, flags);