From patchwork Tue Apr 25 23:29:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 677090 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19D3DC77B61 for ; Tue, 25 Apr 2023 23:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236459AbjDYXaS (ORCPT ); Tue, 25 Apr 2023 19:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236456AbjDYXaR (ORCPT ); Tue, 25 Apr 2023 19:30:17 -0400 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD4FCBBA4 for ; Tue, 25 Apr 2023 16:30:16 -0700 (PDT) Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-63b5ce4f069so7938926b3a.1 for ; Tue, 25 Apr 2023 16:30:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682465416; x=1685057416; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xxouWt0uEijuhb5iMXDgWRbgWnoCjnarrdU7Xj5nBBU=; b=Tuuh6slEa+Qlj92ZLC/VZ5oRcUxbfQYOx0Sqxw80acBIULtiIsrCX1PjPJ8jXAh/aL crBpUl44A5Rjqk9DUZc1FDrJPx8nB2f/ldIJKcd2OKVoI5ewA4XchKtdD0e4kilR9Vk5 Ub7OgzCgjE6mIerWF+tjOJWG41eLnVjybEz4aKdMPQ0lO6ynFpyNTdjR2R0tXtfKTMIE 9Ly4tAjGLJsdalx0zgEGe2YvdnvQTdFHJZ0wM2ino9vsN2o60j8/qFAAbIKBZv8Pu/x+ wc33xVkMTpoL16bzOkw797Hx2g0PhA0nPo7lxvnTfbTCBkFknOWH06A/RP7bEtpbZfZ5 BWwg== X-Gm-Message-State: AAQBX9fCMtmEZfFtmZZa7UdSfFDBIPJAsr7fPZTn9Lb/3DUZiFf4Wle5 SVutOUrAbkK4q4+u2+pWMYU= X-Google-Smtp-Source: AKy350YOfFhfpqiVZdOgAKpfaoGCKZT6m3NR3O9mwuxb0jxIuI9svKYz8HPTCSQU3KvV3962uetktw== X-Received: by 2002:a05:6a00:1823:b0:63b:4313:f8b5 with SMTP id y35-20020a056a00182300b0063b4313f8b5mr27748449pfa.23.1682465415930; Tue, 25 Apr 2023 16:30:15 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:5099:ad7c:6c1:9570]) by smtp.gmail.com with ESMTPSA id b20-20020a056a0002d400b006348cb791f4sm9829941pft.192.2023.04.25.16.30.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 16:30:15 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Avri Altman , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , Stanley Chu , "James E.J. Bottomley" , Matthias Brugger , Bean Huo , Asutosh Das Subject: [PATCH 1/4] scsi: ufs: Increase the START STOP UNIT timeout from one to ten seconds Date: Tue, 25 Apr 2023 16:29:51 -0700 Message-ID: <20230425232954.1229916-2-bvanassche@acm.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230425232954.1229916-1-bvanassche@acm.org> References: <20230425232954.1229916-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org One UFS vendor asked to increase the UFS timeout from 1 s to 3 s. Another UFS vendor asked to increase the UFS timeout from 1 s to 10 s. Hence this patch that increases the UFS timeout to 10 s. This patch can cause the total timeout to exceed 20 s, the Android shutdown timeout. This is fine since the loop around ufshcd_execute_start_stop() exists to deal with unit attentions and because unit attentions are reported quickly. Fixes: dcd5b7637c6d ("scsi: ufs: Reduce the START STOP UNIT timeout") Fixes: 8f2c96420c6e ("scsi: ufs: core: Reduce the power mode change timeout") Acked-by: Adrian Hunter Reviewed-by: Stanley Chu Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9434328ba323..0e2a0656858a 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9182,7 +9182,8 @@ static int ufshcd_execute_start_stop(struct scsi_device *sdev, }; return scsi_execute_cmd(sdev, cdb, REQ_OP_DRV_IN, /*buffer=*/NULL, - /*bufflen=*/0, /*timeout=*/HZ, /*retries=*/0, &args); + /*bufflen=*/0, /*timeout=*/10 * HZ, /*retries=*/0, + &args); } /** From patchwork Tue Apr 25 23:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 677087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 508A4C77B7C for ; Tue, 25 Apr 2023 23:36:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236475AbjDYXgM (ORCPT ); Tue, 25 Apr 2023 19:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236473AbjDYXgH (ORCPT ); Tue, 25 Apr 2023 19:36:07 -0400 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF124C17A for ; Tue, 25 Apr 2023 16:36:05 -0700 (PDT) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-63b733fd00bso5172560b3a.0 for ; Tue, 25 Apr 2023 16:36:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682465765; x=1685057765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0BLcDBB76INQrERMmuujqXhkyY7InYZFQK9oYODTYwQ=; b=eKa/gdeff5DwN7cuYTVBpykwbAWoMtP8VdTcOMQWGD2now7ZoJJQN2HBVizO0MR4fd klt410UHFhMIJE/P8IEu8dddQhhcKTfZXiSgIKv6qcxLWc/5Ousz/m0VtizkGTeVPN+y xXzUnJ44LpF7m/T0ENd6Igr43t2cG7dg1f2co4vkKTip1tIttzKp4iZE/F+h6QjjFTOX KC0fG8dHxhkMzSi+kQuwVI6T2l1Ys5VxLCLEdaeeA/YUyy0pYPDeIxN6lCSFARrdAcWl qusPReMFzPZi+W6z1Czz4D/ZRpLcV5SIEO5MP9T8y9jNBr6ksY3oRpihWvqxegXzaiev nKVA== X-Gm-Message-State: AAQBX9f24NO/iqw09jiwAF3JogqPux6PxUINFeGcmnnRTD5lr8KQxw6L ElseP78l1xhWN96EtCp+Sas= X-Google-Smtp-Source: AKy350Z5bQCyNuwup3ygakYGY9XsgzbuGs7P+Eyh6KwVpWSK2pyHb0UOx1r4stQzEQSptjNYCalcuA== X-Received: by 2002:a05:6a20:160e:b0:ef:a696:9940 with SMTP id l14-20020a056a20160e00b000efa6969940mr24451044pzj.15.1682465765426; Tue, 25 Apr 2023 16:36:05 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:5099:ad7c:6c1:9570]) by smtp.gmail.com with ESMTPSA id j12-20020a056a00174c00b00634b91326a9sm10146984pfc.143.2023.04.25.16.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 16:36:05 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Ming Lei , Hannes Reinecke , John Garry , Mike Christie , "James E.J. Bottomley" Subject: [PATCH 2/4] scsi: core: Update a source code comment Date: Tue, 25 Apr 2023 16:34:44 -0700 Message-ID: <20230425233446.1231000-3-bvanassche@acm.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230425233446.1231000-1-bvanassche@acm.org> References: <20230425233446.1231000-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Make sure that the 'proc_name' comment correctly reflects its new role. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Cc: Mike Christie Signed-off-by: Bart Van Assche --- include/scsi/scsi_host.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 0f29799efa02..f3e071fd61bd 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -365,7 +365,7 @@ struct scsi_host_template { /* - * Name of proc directory + * Name reported via the proc_name SCSI host attribute. */ const char *proc_name; From patchwork Tue Apr 25 23:29:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 677089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24E57C7EE21 for ; Tue, 25 Apr 2023 23:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236472AbjDYXaf (ORCPT ); Tue, 25 Apr 2023 19:30:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236459AbjDYXae (ORCPT ); Tue, 25 Apr 2023 19:30:34 -0400 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A78A0B454 for ; Tue, 25 Apr 2023 16:30:33 -0700 (PDT) Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-63d4595d60fso39188382b3a.0 for ; Tue, 25 Apr 2023 16:30:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682465433; x=1685057433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CdtmOBVIHMDWDuS5/Wfo84zu3auQN36VU5gbul9sxvw=; b=QROZMcxdUFmq3e/wQsx5bnCtyxxcwmh7ews7RyVLKcVXI+cdQG69gRl/FOH6SQutVg HP4XUi+iQpWhuPkYz8a6fs5ZeIVjS3acaZV6CJe9UbavlWtA7QuYrbqjOaMxhJTwmDCl znMSV5b61T/N4FCX0Yyc2cFGdWAoJicr920RK/3wpWK7Te7+t+0lTAKg/ZM5W+4P8r/9 cDq0Egv2q3lDQj7N22C8nhnScI9XhW2zaZg/RUxRaUA9R4Es1UFLtFKaNHL6houL0U17 Wj7u1oEOR9MKRfhjP2qyCJxuNRjVngJ1peK+rmrk2P3g0oMxQIwqqaeET6NskATM2GCp dgPA== X-Gm-Message-State: AC+VfDw1rDXHfC9OVHKvjVNOCzLjkDzgSoBDuu5vcU9/kgcrzsblTd1J UM1VjgrZo5Oo0ZiRtoDl224= X-Google-Smtp-Source: ACHHUZ5Tx/w1wGZa5FRfjudgNlQ8c+OUD9sxIj9XURiXsWiUCINpVsIeatw15ASSb7HF4sfIj7vpbw== X-Received: by 2002:a05:6a20:4417:b0:f2:4c39:8028 with SMTP id ce23-20020a056a20441700b000f24c398028mr555171pzb.21.1682465432990; Tue, 25 Apr 2023 16:30:32 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:5099:ad7c:6c1:9570]) by smtp.gmail.com with ESMTPSA id b20-20020a056a0002d400b006348cb791f4sm9829941pft.192.2023.04.25.16.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 16:30:32 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , Avri Altman , Adrian Hunter , linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Bean Huo , Stanley Chu , Asutosh Das Subject: [PATCH 3/4] scsi: ufs: Move ufshcd_wl_shutdown() Date: Tue, 25 Apr 2023 16:29:53 -0700 Message-ID: <20230425232954.1229916-4-bvanassche@acm.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230425232954.1229916-1-bvanassche@acm.org> References: <20230425232954.1229916-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Move the definition of ufshcd_wl_shutdown() to make the next patch in this series easier to review. Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index c691ddf09698..215a7f713b46 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -9761,28 +9761,6 @@ static int ufshcd_wl_resume(struct device *dev) } #endif -static void ufshcd_wl_shutdown(struct device *dev) -{ - struct scsi_device *sdev = to_scsi_device(dev); - struct ufs_hba *hba; - - hba = shost_priv(sdev->host); - - down(&hba->host_sem); - hba->shutting_down = true; - up(&hba->host_sem); - - /* Turn on everything while shutting down */ - ufshcd_rpm_get_sync(hba); - scsi_device_quiesce(sdev); - shost_for_each_device(sdev, hba->host) { - if (sdev == hba->ufs_device_wlun) - continue; - scsi_device_quiesce(sdev); - } - __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM); -} - /** * ufshcd_suspend - helper function for suspend operations * @hba: per adapter instance @@ -9967,6 +9945,28 @@ int ufshcd_runtime_resume(struct device *dev) EXPORT_SYMBOL(ufshcd_runtime_resume); #endif /* CONFIG_PM */ +static void ufshcd_wl_shutdown(struct device *dev) +{ + struct scsi_device *sdev = to_scsi_device(dev); + struct ufs_hba *hba; + + hba = shost_priv(sdev->host); + + down(&hba->host_sem); + hba->shutting_down = true; + up(&hba->host_sem); + + /* Turn on everything while shutting down */ + ufshcd_rpm_get_sync(hba); + scsi_device_quiesce(sdev); + shost_for_each_device(sdev, hba->host) { + if (sdev == hba->ufs_device_wlun) + continue; + scsi_device_quiesce(sdev); + } + __ufshcd_wl_suspend(hba, UFS_SHUTDOWN_PM); +} + /** * ufshcd_shutdown - shutdown routine * @hba: per adapter instance From patchwork Tue Apr 25 23:34:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 677086 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2563AC77B61 for ; Tue, 25 Apr 2023 23:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236478AbjDYXgU (ORCPT ); Tue, 25 Apr 2023 19:36:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236150AbjDYXgQ (ORCPT ); Tue, 25 Apr 2023 19:36:16 -0400 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126D013C2B for ; Tue, 25 Apr 2023 16:36:14 -0700 (PDT) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-63b5c4c76aaso4662819b3a.2 for ; Tue, 25 Apr 2023 16:36:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682465773; x=1685057773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=92uW4VettcBxSczQVNS605VokDV2BXIWG/ibDraA1Ck=; b=VR/Dp3JHOjjHc7yyLNYrSjH/zcO31Sk6PNFQ4oprM1LgI/qCRiWyH9kU2oyx3g5A+n N24MrUFho+94/H6cqCxPMG2j6rMBXuVzDFpr5gMPXmYf9jTiWxl45ePKdUTcPjG0z+ij 4c4Qjz6LgJBv6XpFKPXH8IQt50eobK89cHXTljMDrPrLx4SOSRZUuc2m/30bmwv5ZdKR KKWXZ7bHjhaPMqFdb9xwdD8vFNiSPcQMGarIKp2IksyfXvPSws1tc6yonEisqKFlnLFT jpspX+0ptt0AK5toA0Qkq/N7t2VM2TELDGDWrxcy1fFgbChZhhNcovD5L/9YkytoQntL EpOA== X-Gm-Message-State: AAQBX9d27h7/a1jlZvutz+lngWYCIRdlqGMBu8CFPUtFPJDbcJKZNay6 QEjdqKfwPzOzn21sJSa6s3k= X-Google-Smtp-Source: AKy350YpiMnTEv1BKbuA2dYbLBVhNmZ8yyUybRKQ0JTOAXofEq0vZ8rIPI1eIZNFE21Br61XXw8pPA== X-Received: by 2002:a05:6a00:2e0e:b0:63f:1037:cc24 with SMTP id fc14-20020a056a002e0e00b0063f1037cc24mr25003774pfb.32.1682465773409; Tue, 25 Apr 2023 16:36:13 -0700 (PDT) Received: from bvanassche-linux.mtv.corp.google.com ([2620:15c:211:201:5099:ad7c:6c1:9570]) by smtp.gmail.com with ESMTPSA id j12-20020a056a00174c00b00634b91326a9sm10146984pfc.143.2023.04.25.16.36.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Apr 2023 16:36:13 -0700 (PDT) From: Bart Van Assche To: "Martin K . Petersen" Cc: Jaegeuk Kim , linux-scsi@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Ming Lei , Hannes Reinecke , John Garry , Mike Christie , Steven Rostedt , Masami Hiramatsu , Vishakha Channapattan , Jolly Shah , Changyuan Lyu Subject: [PATCH 4/4] scsi: Trace SCSI sense data Date: Tue, 25 Apr 2023 16:34:46 -0700 Message-ID: <20230425233446.1231000-5-bvanassche@acm.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230425233446.1231000-1-bvanassche@acm.org> References: <20230425233446.1231000-1-bvanassche@acm.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If a command fails, SCSI sense data is essential to determine why it failed. Hence make the SCSI sense data available in the ftrace output. Cc: Christoph Hellwig Cc: Ming Lei Cc: Hannes Reinecke Cc: John Garry Cc: Mike Christie Signed-off-by: Bart Van Assche --- include/trace/events/scsi.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/include/trace/events/scsi.h b/include/trace/events/scsi.h index a2c7befd451a..bb5f31504fbb 100644 --- a/include/trace/events/scsi.h +++ b/include/trace/events/scsi.h @@ -269,6 +269,7 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template, __field( unsigned int, prot_sglen ) __field( unsigned char, prot_op ) __dynamic_array(unsigned char, cmnd, cmd->cmd_len) + __array(unsigned char, sense_data, SCSI_SENSE_BUFFERSIZE) ), TP_fast_assign( @@ -285,11 +286,13 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template, __entry->prot_sglen = scsi_prot_sg_count(cmd); __entry->prot_op = scsi_get_prot_op(cmd); memcpy(__get_dynamic_array(cmnd), cmd->cmnd, cmd->cmd_len); + memcpy(__entry->sense_data, cmd->sense_buffer, + SCSI_SENSE_BUFFERSIZE); ), TP_printk("host_no=%u channel=%u id=%u lun=%u data_sgl=%u prot_sgl=%u " \ "prot_op=%s driver_tag=%d scheduler_tag=%d cmnd=(%s %s raw=%s) " \ - "result=(driver=%s host=%s message=%s status=%s)", + "result=(driver=%s host=%s message=%s status=%s%s%s)", __entry->host_no, __entry->channel, __entry->id, __entry->lun, __entry->data_sglen, __entry->prot_sglen, show_prot_op_name(__entry->prot_op), __entry->driver_tag, @@ -299,7 +302,17 @@ DECLARE_EVENT_CLASS(scsi_cmd_done_timeout_template, "DRIVER_OK", show_hostbyte_name(((__entry->result) >> 16) & 0xff), "COMMAND_COMPLETE", - show_statusbyte_name(__entry->result & 0xff)) + show_statusbyte_name(__entry->result & 0xff), + __entry->result & 0xff ? " sense_data=" : "", + __entry->result & 0xff ? + ({ + unsigned int len = SCSI_SENSE_BUFFERSIZE; + + while (len && __entry->sense_data[len - 1] == 0) + len--; + __print_hex(__entry->sense_data, len); + }) + : "") ); DEFINE_EVENT(scsi_cmd_done_timeout_template, scsi_dispatch_cmd_done,