From patchwork Mon May 31 10:43:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12289131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 459B9C47083 for ; Mon, 31 May 2021 10:43:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C946611CB for ; Mon, 31 May 2021 10:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231327AbhEaKpE (ORCPT ); Mon, 31 May 2021 06:45:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbhEaKpD (ORCPT ); Mon, 31 May 2021 06:45:03 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E3F1C061761; Mon, 31 May 2021 03:43:23 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id t15so3021211eju.3; Mon, 31 May 2021 03:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=buWoO5ZNQLGx/bpd8SgWHa31Z/TjhX1VqfvpZfL27+A=; b=ftYkK6IdrhPv8PoBQkWjiWlRqsej4QgNg9C6vj9w4v9dHOu1bfwA5AKnW+4prEB0ju F3pSXz6qg819wouB6BYiG0PLiucvKVh6V4QztNiKvgUqU8VDp1WoXylWAoXXJzV3fjpP Y5LCe0rzzgG0i0EaXUqXklVkn+pURvJnA+6bE5ZYTtLWb52xl3YPuUvo70T8NHNGt81D e3t71kPwENuZCq4m9R2utyOVg8pGTYu3k8OttnUHb/adIgMNmRWJaodOx3BMbqmznWpK lfRGK7dqWJ6SyzCy5ZrG30R5y080/kp5x+HZG4r33EaS3i65k+8MYtb7p6rfMNhvkuF3 vFbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=buWoO5ZNQLGx/bpd8SgWHa31Z/TjhX1VqfvpZfL27+A=; b=HYV80MypB8yUKhtyeZXS9HF1S2cxPtwfrm+1hmIb5L1/S8Wjx2VCDAM+EidJfLjrYk B7GRkvCXK1u73fud+36+1/29D6BV93mgbu/22DkljFaZGdAvW4cYifs2KzhdSom3x0c7 +XDQWzh2gnJeLhM6n3nW0cKtNqnFttI6WBBtAhC6Ms2k7lCl4MnAdYR9w/JX40h55YA3 fGxoHyAOYTS3HP3+avKyp7MdBX9ikyhdRPCKozGYVuVyJ1jF7vWXLWW+ErqW8xVWWrXa ISZ9SPG5S+hnaMnCbZ2wFqnxC/UT4zKW2PHTFJ2APYJrkx71wfqsnSauKxZMCgXrayVm V00g== X-Gm-Message-State: AOAM533nxiui1/cWCVDquQDeChjZKx5QaxVJQwe251m9KQS5uSxXZ2k6 vh79Zsx8NoMS+YKOYj0Se2s= X-Google-Smtp-Source: ABdhPJwr1ta6+/ucUtEz/UcXAF9XbbtgNYhYFyblxxwFSpENS8ii/eMIXxevkiHCI7mGLj8i5xaOVg== X-Received: by 2002:a17:906:2bd0:: with SMTP id n16mr22513527ejg.110.1622457801696; Mon, 31 May 2021 03:43:21 -0700 (PDT) Received: from localhost.localdomain (ip5f5bec5d.dynamic.kabel-deutschland.de. [95.91.236.93]) by smtp.gmail.com with ESMTPSA id dk9sm5741035ejb.91.2021.05.31.03.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 03:43:21 -0700 (PDT) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/4] scsi: ufs: Cleanup ufshcd_add_command_trace() Date: Mon, 31 May 2021 12:43:05 +0200 Message-Id: <20210531104308.391842-2-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210531104308.391842-1-huobean@gmail.com> References: <20210531104308.391842-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo To consistent with trace event print, convert the value of the variable 'lba' in the unit of LBA (logical block address). Suggested-by: Bart Van Assche Signed-off-by: Bean Huo Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 02267b090729..85590d3a719e 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -25,6 +25,7 @@ #include "ufs_bsg.h" #include "ufshcd-crypto.h" #include +#include "../sd.h" #define CREATE_TRACE_POINTS #include @@ -364,7 +365,7 @@ static void ufshcd_add_uic_command_trace(struct ufs_hba *hba, static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag, enum ufs_trace_str_t str_t) { - sector_t lba = -1; + u64 lba = -1; u8 opcode = 0, group_id = 0; u32 intr, doorbell; struct ufshcd_lrb *lrbp = &hba->lrb[tag]; @@ -382,22 +383,23 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag, /* trace UPIU also */ ufshcd_add_cmd_upiu_trace(hba, tag, str_t); opcode = cmd->cmnd[0]; + lba = sectors_to_logical(cmd->device, blk_rq_pos(cmd->request)); + if ((opcode == READ_10) || (opcode == WRITE_10)) { /* * Currently we only fully trace read(10) and write(10) * commands */ - if (cmd->request && cmd->request->bio) - lba = cmd->request->bio->bi_iter.bi_sector; transfer_len = be32_to_cpu( lrbp->ucd_req_ptr->sc.exp_data_transfer_len); if (opcode == WRITE_10) group_id = lrbp->cmd->cmnd[6]; } else if (opcode == UNMAP) { - if (cmd->request) { - lba = scsi_get_lba(cmd); - transfer_len = blk_rq_bytes(cmd->request); - } + /* + * The number of Bytes to be unmapped beginning with the + * lba. + */ + transfer_len = blk_rq_bytes(cmd->request); } } From patchwork Mon May 31 10:43:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12289135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41E61C47080 for ; Mon, 31 May 2021 10:43:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23C386124C for ; Mon, 31 May 2021 10:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231397AbhEaKpH (ORCPT ); Mon, 31 May 2021 06:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbhEaKpE (ORCPT ); Mon, 31 May 2021 06:45:04 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6718C06174A; Mon, 31 May 2021 03:43:23 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id k7so6458216ejv.12; Mon, 31 May 2021 03:43:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tA6A2ohh4L8vBzT6/8t9tpUkgl45rDZLB/Lv05qFeiw=; b=kAfcQ/GGr5m+hwwczKIC6ejflav1uQUMGfO5AOqqv9OpJM9l5w44bw5NWNgDMp9zXL fDx7ar2wpcjlHbvEHxScCT6FJf6pFTGpMsx/RpIW3RDkRw91OMj2ItNl5Sp+FlBo2Z1f /KyndLMF+FFEfYgMwzpVKXvy94HsLbTCrLs297J7bsm7Cd9IWLh0hx5VV2NwqmuabVkK /qqzLCfr2vao3YvT30mWPRoWJvSTjq5h+rIyu2Af6uStJMoXOVgUy0jX6avYY4rhx+D+ 93vWMjM7sZCHu7ktRLUdx55RaxeSL0PIy5FiLi9sjOGHjhb87zII4QLRDB8eVu+ldKmr FIbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tA6A2ohh4L8vBzT6/8t9tpUkgl45rDZLB/Lv05qFeiw=; b=drjt6IkTyMZNJqYdH4bm66ysMdckOrSwTxkeY5jzwBRuzgxfQZl4c8LgVT3dE2gD10 UiNnFHuW+7XLctHCFRsqvL9OW72d8n0JHUt2II78koBA32S+8Et2jO3znIr12kWod62t WmxLLb6f47gbQpl2QRrqrGEUnbtYQa25+1pM3i04+H2Ph0jankTzVYPIH7bCE/ROBVUm lQ//CT3+MZrcytjbaaaPOAUSDo2OH22Hfumdt2YXhlq/4FQ0Nh6iKfTcwO53X8L+5AhM JGZ3hazU0I9VFDMP9lgkhzgUPbORMSMgF0dHMS5/1xHscW+hDktO6NNWbwuusIu9GUa6 0Z0A== X-Gm-Message-State: AOAM530WMYw88fBPtQFUxR5jVuXKtGHc4hgSUB8RMvscsisZzsTr/exy GtABr0rjJj3PUvUwHdZqgiM= X-Google-Smtp-Source: ABdhPJwa7MnHJHeEjbiD02yy+8LFvhMpLVGXYyeU9KmVCI5OPQLFmaPwGaZqBBP8Rn3Sn2/XM/cNYQ== X-Received: by 2002:a17:906:f6d7:: with SMTP id jo23mr3164770ejb.302.1622457802464; Mon, 31 May 2021 03:43:22 -0700 (PDT) Received: from localhost.localdomain (ip5f5bec5d.dynamic.kabel-deutschland.de. [95.91.236.93]) by smtp.gmail.com with ESMTPSA id dk9sm5741035ejb.91.2021.05.31.03.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 03:43:22 -0700 (PDT) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] scsi: ufs: Let UPIU completion trace print RSP UPIU header Date: Mon, 31 May 2021 12:43:06 +0200 Message-Id: <20210531104308.391842-3-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210531104308.391842-1-huobean@gmail.com> References: <20210531104308.391842-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo The current UPIU completion event trace still prints the COMMAND UPIU header, rather than the RSP UPIU header. This makes UPIU command trace useless in problem shooting in case we receive a trace log from the customer/field. There are two important fields in RSP UPIU: 1. The response field, which indicates the UFS defined overall success or failure of the series of Command, Data and RESPONSE UPIU’s that make up the execution of a task. 2. The Status field, which contains the command set specific status for a specific command issued by the initiator device. Before this patch, the UPIU paired trace events: ufshcd_upiu: send_req: fe3b0000.ufs: HDR:01 20 00 1c 00 00 00 00 00 00 00 00, CDB:3b e1 00 00 00 00 00 00 30 00 00 00 00 00 00 00 ufshcd_upiu: complete_rsp: fe3b0000.ufs: HDR:01 20 00 1c 00 00 00 00 00 00 00 00, CDB:3b e1 00 00 00 00 00 00 30 00 00 00 00 00 00 00 After the patch: ufshcd_upiu: send_req: fe3b0000.ufs: HDR:01 20 00 1c 00 00 00 00 00 00 00 00, CDB:3b e1 00 00 00 00 00 00 30 00 00 00 00 00 00 00 ufshcd_upiu: complete_rsp: fe3b0000.ufs: HDR:21 00 00 1c 00 00 00 00 00 00 00 00, CDB:3b e1 00 00 00 00 00 00 30 00 00 00 00 00 00 00 Signed-off-by: Bean Huo Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 85590d3a719e..c5754d5486c9 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -302,11 +302,17 @@ static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, enum ufs_trace_str_t str_t) { struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr; + struct utp_upiu_header *header; if (!trace_ufshcd_upiu_enabled()) return; - trace_ufshcd_upiu(dev_name(hba->dev), str_t, &rq->header, &rq->sc.cdb, + if (str_t == UFS_CMD_SEND) + header = &rq->header; + else + header = &hba->lrb[tag].ucd_rsp_ptr->header; + + trace_ufshcd_upiu(dev_name(hba->dev), str_t, header, &rq->sc.cdb, UFS_TSF_CDB); } From patchwork Mon May 31 10:43:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12289137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A77F2C47082 for ; Mon, 31 May 2021 10:43:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80BEA60FF3 for ; Mon, 31 May 2021 10:43:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231474AbhEaKpO (ORCPT ); Mon, 31 May 2021 06:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231357AbhEaKpF (ORCPT ); Mon, 31 May 2021 06:45:05 -0400 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86E94C061574; Mon, 31 May 2021 03:43:24 -0700 (PDT) Received: by mail-ej1-x62d.google.com with SMTP id jt22so16027853ejb.7; Mon, 31 May 2021 03:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J6H9WGXYQrem7icV2sz1sWQwyHLvRgt4yHtiTHtzZlc=; b=douWCSMM3wPLfJv+MkKPa/w46b9NcIaI+PtpQ3LwIQuwXxYa3Nw0m2QPXGzlU+Xzng zaMHfTSNVCpeT6gycmJUK2BJ82X8BkxxCzqvPyKp/IykX4qIq6bn/H2FCcM6pCB1JAd+ XhbHGokcnzzdAtaPCBOjApbw598DdFzRRETW6tp6hKG74axhd4zCI06KJAh7uVJoY6y/ v536iNw3MpkxpILuf+wdrQJeO/CNS8B6X45MHf4AJscqaXaJMYETSG+4147PjuV1LSHO 9D72KVDobpLYlu/zB2JFB3KyGbumiqiEiTJsxy8M6XHh17OxXQj6Rvw6OlPlKIB8pFNy mCiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J6H9WGXYQrem7icV2sz1sWQwyHLvRgt4yHtiTHtzZlc=; b=pOTT3fFNP7JlTdf4KpTm/5HjyW781GIxVTqS1a+Gc/Zy4MeRHvO9KQpQ0n+bKL/2kv HIrg97pufiGxQ2ORKysn6oaFV7InjbxfYfMQQmSggFY1G8Y7znODfrAdQAc1wtPqrBuR Lj/3/cnAlq8ABQ1+8qAn4+nmyvojNGiAhaVWeCg+sWYl/SzBWvT1fKEasSuNzN5XV0b3 TaaI2mW7uh5JwpZiM+XfIMHq4/1lHC3eTXsrn+G/wu1XOuD19tTDvQnBhJ9ibnKPUDCA +wMJTglQkW2f3jc/bbXgLmiLhhij19iHYKTj+LCZhCd/9iznKPqGwthg8UE0TrQBw13V 2K0g== X-Gm-Message-State: AOAM531bAywraktat6nQOec4l95INKZ8xo7rL8YUNjpI2Gly2T1q2O0k 6C31HOlkR3t53ebGH3zMjzw= X-Google-Smtp-Source: ABdhPJzhUwzGZu153knctX6DiLSQRXDa4A+syM6Q2UYXJlYvj+cH6FasUGt+4SL/QBhG7QtsX2vvMw== X-Received: by 2002:a17:906:1806:: with SMTP id v6mr21972016eje.454.1622457803215; Mon, 31 May 2021 03:43:23 -0700 (PDT) Received: from localhost.localdomain (ip5f5bec5d.dynamic.kabel-deutschland.de. [95.91.236.93]) by smtp.gmail.com with ESMTPSA id dk9sm5741035ejb.91.2021.05.31.03.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 03:43:23 -0700 (PDT) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] scsi: ufs: Let command trace only for the cmd != null case Date: Mon, 31 May 2021 12:43:07 +0200 Message-Id: <20210531104308.391842-4-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210531104308.391842-1-huobean@gmail.com> References: <20210531104308.391842-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo For the query request, we already have query_trace, but in ufshcd_send_command (), there will add two more redundant traces. Since lrbp->cmd is null in the query request, the below these two trace events provide nothing except the tag and DB. Instead of letting them take up the limited trace ring buffer, it’s better not to print these traces in case of cmd == null. ufshcd_command: send_req: ff3b0000.ufs: tag: 28, DB: 0x0, size: -1, IS: 0, LBA: 18446744073709551615, opcode: 0x0 (0x0), group_id: 0x0 ufshcd_command: dev_complete: ff3b0000.ufs: tag: 28, DB: 0x0, size: -1, IS: 0, LBA: 18446744073709551615, opcode: 0x0 (0x0), group_id: 0x0 Signed-off-by: Bean Huo Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 44 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c5754d5486c9..c84bd8e045f6 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -378,35 +378,33 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag, struct scsi_cmnd *cmd = lrbp->cmd; int transfer_len = -1; + if (!cmd) + return; + if (!trace_ufshcd_command_enabled()) { /* trace UPIU W/O tracing command */ - if (cmd) - ufshcd_add_cmd_upiu_trace(hba, tag, str_t); + ufshcd_add_cmd_upiu_trace(hba, tag, str_t); return; } - if (cmd) { /* data phase exists */ - /* trace UPIU also */ - ufshcd_add_cmd_upiu_trace(hba, tag, str_t); - opcode = cmd->cmnd[0]; - lba = sectors_to_logical(cmd->device, blk_rq_pos(cmd->request)); + /* trace UPIU also */ + ufshcd_add_cmd_upiu_trace(hba, tag, str_t); + opcode = cmd->cmnd[0]; + lba = sectors_to_logical(cmd->device, blk_rq_pos(cmd->request)); - if ((opcode == READ_10) || (opcode == WRITE_10)) { - /* - * Currently we only fully trace read(10) and write(10) - * commands - */ - transfer_len = be32_to_cpu( - lrbp->ucd_req_ptr->sc.exp_data_transfer_len); - if (opcode == WRITE_10) - group_id = lrbp->cmd->cmnd[6]; - } else if (opcode == UNMAP) { - /* - * The number of Bytes to be unmapped beginning with the - * lba. - */ - transfer_len = blk_rq_bytes(cmd->request); - } + if (opcode == READ_10 || opcode == WRITE_10) { + /* + * Currently we only fully trace read(10) and write(10) commands + */ + transfer_len = + be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len); + if (opcode == WRITE_10) + group_id = lrbp->cmd->cmnd[6]; + } else if (opcode == UNMAP) { + /* + * The number of Bytes to be unmapped beginning with the lba. + */ + transfer_len = blk_rq_bytes(cmd->request); } intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS); From patchwork Mon May 31 10:43:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 12289139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F238C47080 for ; Mon, 31 May 2021 10:43:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41D7A60FF3 for ; Mon, 31 May 2021 10:43:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231384AbhEaKpR (ORCPT ); Mon, 31 May 2021 06:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231382AbhEaKpG (ORCPT ); Mon, 31 May 2021 06:45:06 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CA9C061760; Mon, 31 May 2021 03:43:25 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id lz27so15964043ejb.11; Mon, 31 May 2021 03:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QJR89/55KXiudMnlzBPyQOfHeATecr68iMPdF7Lg45k=; b=K1CXkY67aICkk8XQVHakyjkkVxcPKI0OgTVvMhRn0798culLJyaL453W0qgY4Uhk6N vTR7zkfwIqMcFLegI0Yf3/meTKtrU/yDDQFU5qTytk9RaRgqM1Mfa2fQX3glxfM2EOID Y5Gs3ZIcqC/NO72M0Olou7LZ0FQJwekMhY+90afE9JRtLgAPPCpfQZAEVcqZ8tDBtIsN jTXMX9H524WiujyAW4oOXDo0g/c5JOYcsSAZEuPRVIeDGcPqXN2sclbF60Ya4KmDF9m1 Q5bgMdFWTGDSlBFZWNybZB3Iy96ksD9XKpa+auj4FXGP186ORO8gtrqaqXIM5e9pYqZd +Z1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QJR89/55KXiudMnlzBPyQOfHeATecr68iMPdF7Lg45k=; b=SVY/3lNHV6UGLn3DPi0dKIs6RV4OPwINjl19efFUESDSNKLn1L/q4DuR5FuOfJRrIV VvUjqi/CBtRV+HUcfb228Lt7U1jcC38ObDn126Z1Mzqjpb61/I9An/lnut4MvcHz49zE RM/WwvgGLgjA+UUWvsgmWRHtk4tmhhe+XRoJ3BwIRJMQTWTSQ1hcxL2RN7vnRVTaTZw7 TMl5BJPZQDxpnZvSwSUsqBdRsblriI0cYtjZfyH6JZTwqIQamPmx5vGqBrWbLSVeYd6i oAw3TkZdzDyhcA/JQuEQEkgNgblPU38o+svGgI4WV/EoX3/CGMIo/QyTcKlbXpXu5oKp 7zZA== X-Gm-Message-State: AOAM5317d1Irl0CO+Cd1ZZpuc3XyysJBt9gZZlMQH9/yAMmlJ5MD05IX lAAYNuk/CEeuISWpSCM9l20= X-Google-Smtp-Source: ABdhPJxDJvrgYdIK8f0tjjYwr6p6Uz/eVz7Ds1pKwC2HivAzFIfzlLx594swmbjxCRutv/Gr/5IFmw== X-Received: by 2002:a17:906:c0c6:: with SMTP id bn6mr21272637ejb.436.1622457803973; Mon, 31 May 2021 03:43:23 -0700 (PDT) Received: from localhost.localdomain (ip5f5bec5d.dynamic.kabel-deutschland.de. [95.91.236.93]) by smtp.gmail.com with ESMTPSA id dk9sm5741035ejb.91.2021.05.31.03.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 03:43:23 -0700 (PDT) From: Bean Huo To: alim.akhtar@samsung.com, avri.altman@wdc.com, asutoshd@codeaurora.org, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, bvanassche@acm.org, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/4] scsi: ufs: Use UPIU query trace in devman_upiu_cmd Date: Mon, 31 May 2021 12:43:08 +0200 Message-Id: <20210531104308.391842-5-huobean@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210531104308.391842-1-huobean@gmail.com> References: <20210531104308.391842-1-huobean@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Bean Huo Since devman_upiu_cmd is not COMMAND UPIU, and doesn't have CDB, it is better to use UPIU query trace, which provides more helpful information for issue shooting. Signed-off-by: Bean Huo Reviewed-by: Can Guo --- drivers/scsi/ufs/ufshcd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c84bd8e045f6..deb9e232b349 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6701,6 +6701,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, hba->dev_cmd.complete = &wait; + ufshcd_add_query_upiu_trace(hba, UFS_QUERY_SEND, lrbp->ucd_req_ptr); /* Make sure descriptors are ready before ringing the doorbell */ wmb(); spin_lock_irqsave(hba->host->host_lock, flags); @@ -6732,6 +6733,8 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba, err = -EINVAL; } } + ufshcd_add_query_upiu_trace(hba, err ? UFS_QUERY_ERR : UFS_QUERY_COMP, + (struct utp_upiu_req *)lrbp->ucd_rsp_ptr); out: blk_put_request(req);