Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp995803yba; Thu, 4 Apr 2019 02:02:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqy19pnUHccGF/fzy2en3zqRogChMx9E/Z31uCKjjfrlf5Ea03dlw3HwgJcrvVyDQcIXw/Mw X-Received: by 2002:a62:1d90:: with SMTP id d138mr4532395pfd.232.1554368526719; Thu, 04 Apr 2019 02:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368526; cv=none; d=google.com; s=arc-20160816; b=e9yJCPGqWwtHusDiGqZoFrLFjMyFMQXpuoyKYBqYDsJdTLzmFXBbQQqew/btYXgLCi OzESXZcneAB2NsaOocg1M6qkUNEQam3Zh6MPZSWCnQDpFLOO0Rp3cl1buKfHmUgmcaMI yYu+wta1Gfx8XL8A2gy0eLfNrC6YbvdAjCiJgcKA1JU1WsKW82vvWuj/5gB7l3NJJjy3 jkG4s2d+asTRzXlbGCQr5DVrstgZsO+wcNXfFWxIiGeze2UFFie5Uy44W4MSXXejixab HCcVFsSSvZJy9QEeGGMmqtDeXLD0OQe0aHgdTAlcQGIZ8pGm+jsLu27Bmi0Rf7z9VJY8 nrgQ== 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=h4Qws0m5xEYTia+0ZGK56OoJCRILOMwdBwqymprOMqU=; b=ZrE6yDHS2mUHBSIJR9XX70d8mAu5FfyUbN3c31P7tZImudoFDNkIwuIk3V/kZvByJw wrdz3US8j1NZ12UFgD1RatBC1vLYf6EJRhCGTMpeJ2VOemzWkRg8DXgxSvy8VfGOEPT1 jF1m4NCIZpF6ZqexFpjaHkhMp6fEopq0S5cJAcrx2pn5Fp5nYJ31TWAbX1tCCc1mkCZX OmX4X5Gzlbp7Iu7Ktb3vP9AwoFGAOHEgmEdSHoGEA7qi+e33oPdDdrMLmEFPtLyceyFk mEbEw3UIveMP9IYdBYtiiK8o0LZdCPSNyEfYdL0/zqav2zv01n+huaM7w28Kh+xTYKdv aMzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tzyd2nwx; 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 u33si16033860pga.341.2019.04.04.02.01.51; Thu, 04 Apr 2019 02:02:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=tzyd2nwx; 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 S1731200AbfDDJAG (ORCPT + 99 others); Thu, 4 Apr 2019 05:00:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbfDDJAF (ORCPT ); Thu, 4 Apr 2019 05:00:05 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 7898D21855; Thu, 4 Apr 2019 09:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368404; bh=So8D3m/GzPHLJY4Cf6N/XuYD0lN1CmjdlglUaX4ZTQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzyd2nwxLi4L7ZLPjxm/izRVH7kZUcvNpeevpAREF1hEnSGCjM1Y32PUQFDYvcXH9 fRATkbVo3tfJ/aYCrOe6sRikeUCRxb6mfSOvcgI7ac7uUV4RYCNV/TJH3TGf8enDcf jsNWvQucE3SRDT/YnP15cziNa+NJ/0oddbslVe70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiang Chen , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 019/187] scsi: hisi_sas: Fix a timeout race of driver internal and SMP IO Date: Thu, 4 Apr 2019 10:45:56 +0200 Message-Id: <20190404084604.001760444@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4790595723d4b833b18c994973d39f9efb842887 ] For internal IO and SMP IO, there is a time-out timer for them. In the timer handler, it checks whether IO is done according to the flag task->task_state_lock. There is an issue which may cause system suspended: internal IO or SMP IO is sent, but at that time because of hardware exception (such as inject 2Bit ECC error), so IO is not completed and also not timeout. But, at that time, the SAS controller reset occurs to recover system. It will release the resource and set the status of IO to be SAS_TASK_STATE_DONE, so when IO timeout, it will never complete the completion of IO and wait for ever. [ 729.123632] Call trace: [ 729.126791] [] __switch_to+0x94/0xa8 [ 729.133106] [] __schedule+0x1e8/0x7fc [ 729.138975] [] schedule+0x34/0x8c [ 729.144401] [] schedule_timeout+0x1d8/0x3cc [ 729.150690] [] wait_for_common+0xdc/0x1a0 [ 729.157101] [] wait_for_completion+0x28/0x34 [ 729.165973] [] hisi_sas_internal_task_abort+0x2a0/0x424 [hisi_sas_test_main] [ 729.176447] [] hisi_sas_abort_task+0x244/0x2d8 [hisi_sas_test_main] [ 729.185258] [] sas_eh_handle_sas_errors+0x1c8/0x7b8 [ 729.192391] [] sas_scsi_recover_host+0x130/0x398 [ 729.199237] [] scsi_error_handler+0x148/0x5c0 [ 729.206009] [] kthread+0x10c/0x138 [ 729.211563] [] ret_from_fork+0x10/0x18 To solve the issue, callback function task_done of those IOs need to be called when on SAS controller reset. Signed-off-by: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/hisi_sas/hisi_sas_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index c25f3a9b0b9f..fd9d82c9033d 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -810,7 +810,8 @@ static void hisi_sas_do_release_task(struct hisi_hba *hisi_hba, struct sas_task spin_lock_irqsave(&task->task_state_lock, flags); task->task_state_flags &= ~(SAS_TASK_STATE_PENDING | SAS_TASK_AT_INITIATOR); - task->task_state_flags |= SAS_TASK_STATE_DONE; + if (!slot->is_internal && task->task_proto != SAS_PROTOCOL_SMP) + task->task_state_flags |= SAS_TASK_STATE_DONE; spin_unlock_irqrestore(&task->task_state_lock, flags); } -- 2.19.1