Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3030819pxu; Mon, 14 Dec 2020 18:32:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY6tcGXUFTI9JxU8zDTGZ0D+MLthcCwDvtP+cDQ6aYzQ3I0rdrwi856KeYWytO/b8Mnp7j X-Received: by 2002:a17:906:17d9:: with SMTP id u25mr5965271eje.34.1607999574197; Mon, 14 Dec 2020 18:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607999574; cv=none; d=google.com; s=arc-20160816; b=Jm7xTeVg+VWybEhG/Mv80QWaSkiZ6d1udvgv6eL17k4qyy8AmqrERJaUna7UXYuZgu EXN75xCBl2g6x7VwHp4xAppAAPFjJjQqt5Qm04K6KNe/KV0ImvEZHm9j+i76ofJF1bIO Nx4sk8n+lDg6AehpkQZRC/2sKMvp1OSKqz182Bo80wIca9AlC7bpvfgwJE6xDiBRZB5e so8WyfW/vY1yw9OzVGc4LjfQ17EiVxNMPT3leHIEzJiGxhtxBFrcTRUnjbcWfqx26mNm Tkhb1xWZYcqt22t/GcFnvh0pEFy13mzgI7eno/RciSQnGIbrvvIj3dPgDH4Ju0vFQ8Df LlYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=MDUTAHSnLQf17rDCvTDFruIhmvOHEpBhNEFUu+lMa4s=; b=LVDuA4bqgJymxsYHj6aAHHiel9tjbsLu6CwRopWom6GNvb7zJVbcOWnzSdwxmdU1fK 1jRI7JPeGAVBKoy6hmWqD02LTx/q9jfzoruBA805HWM5KYosTIR+vJfA4xPQ1k8ugW+8 HmO0Wi1NdslmhGE6d0hQ94pnAXui7cTG3cLeLgzDgg7azbEO7CdjpPOh+RWM1p3hnC0Y Ep8/F5YJsCiu8F8gMq8z3pbvTed0TMmhPcACSLm+l2Pp4diA3eSXt2IGh8W2QSSp3QmW Wtm4M4fLPCiArwS9nAXwBY73FH0x1Yyc8hPKFI7OW7Wzuc718xCLYR8XghJgvD17HJvD w9tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kRJ91+DD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si159357edn.233.2020.12.14.18.32.31; Mon, 14 Dec 2020 18:32:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kRJ91+DD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503082AbgLNUVT (ORCPT + 99 others); Mon, 14 Dec 2020 15:21:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502992AbgLNUVL (ORCPT ); Mon, 14 Dec 2020 15:21:11 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 162A8C06179C; Mon, 14 Dec 2020 12:20:31 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id j22so6381051eja.13; Mon, 14 Dec 2020 12:20:31 -0800 (PST) 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; bh=MDUTAHSnLQf17rDCvTDFruIhmvOHEpBhNEFUu+lMa4s=; b=kRJ91+DDQZ6kWB3QxvEUPEZD5Jgt7e+I7J3Fuy0W1o1pkPn/wieQhypllwEy5uvLeX +00+JRQlpYrfQLc1u8unP4KOiReU3Mn1ixKZCqM4brGeXCeymXwkkA5BJ7CBvA+/1Oe5 nc8Qoz+/Gh2MZcuNHU0wrZkzQcK5u306OpEUh/vSwOkv1hDikbEBuusH2Z9YGhrrZylu nmYaJS11hj6mgvKqRwzyq6jcWFCSH+APaGnJ8ABJcrz5tamPtoA7J5Y4UnxIIKQSdj3M +NirRgndyDmMqFDdmUa09SVYemV0gkXUpbjUJ5fux5EA894kF4MuSx+sMCWNDHBfidFb Qkyg== 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; bh=MDUTAHSnLQf17rDCvTDFruIhmvOHEpBhNEFUu+lMa4s=; b=DPWgwjQ501qAWPJWuiAzaU0JlxaPuLIQVUQS5qcy44XufPZTSBMZTuM0a07WkJj1B/ Z7KQOreexFEL3szGY7C1xBQsYqXSvWPUYEpTCXI98CHqK7mSSFsnTGfz1OrQNdy+2k1L 8DT7RXeuBI3RfP8JZrA1AIiCWqgqK+zCSl4EJiSrrGN63CE6Gyeh29uJrM+srIIOjD5q 8dBUnfhJylF6EQDqE6rQ1AaCpEbEZYfdf8inpfW2cLsyx1tw5PYndn9Z3fdIhPjB+gBT g7DetnuD/ve2h2XOP8of+DbJgLIvtrfxZRV+0jrCQy8U0O4gmHW1B646fJPvvpl570UM megw== X-Gm-Message-State: AOAM533L+0tWV4SipbCgnvAvtI9XLs0Ogh3xWIGZmuzW59gzNUGCm7Jg t5xJ25LPbulOLo8UP7khMkU= X-Received: by 2002:a17:907:961b:: with SMTP id gb27mr23634089ejc.313.1607977229777; Mon, 14 Dec 2020 12:20:29 -0800 (PST) Received: from localhost.localdomain (ip5f5bfce9.dynamic.kabel-deutschland.de. [95.91.252.233]) by smtp.gmail.com with ESMTPSA id r7sm9334634edh.86.2020.12.14.12.20.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Dec 2020 12:20:29 -0800 (PST) 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, rostedt@goodmis.org, joe@perches.com Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] scsi: ufs: Distinguish between query REQ and query RSP in query trace Date: Mon, 14 Dec 2020 21:20:12 +0100 Message-Id: <20201214202014.13835-5-huobean@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201214202014.13835-1-huobean@gmail.com> References: <20201214202014.13835-1-huobean@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bean Huo Currently, in the query completion trace print, since we use hba->lrb[tag].ucd_req_ptr and didn't differentiate UPIU between request and response, thus header and transaction-specific field in UPIU printed by query trace are identical. This is not very practical. As below: query_send: HDR:16 00 00 0e 00 81 00 00 00 00 00 00, CDB:06 0e 03 00 00 00 00 00 00 00 00 00 00 00 00 00 query_complete: HDR:16 00 00 0e 00 81 00 00 00 00 00 00, CDB:06 0e 03 00 00 00 00 00 00 00 00 00 00 00 00 00 For the failure analysis, we want to understand the real response reported by the UFS device, however, the current query trace tells us nothing. After this patch, the query trace on the query_send, and the above a pair of query_send and query_complete will be: query_send: HDR:16 00 00 0e 00 81 00 00 00 00 00 00, CDB:06 0e 03 00 00 00 00 00 00 00 00 00 00 00 00 00 ufshcd_upiu: HDR:36 00 00 0e 00 81 00 00 00 00 00 00, CDB:06 0e 03 00 00 00 00 00 00 00 00 01 00 00 00 00 Acked-by: Avri Altman Acked-by: Steven Rostedt (VMware) Signed-off-by: Bean Huo --- drivers/scsi/ufs/ufshcd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f4a071d12542..d0b054aa0a3c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -318,12 +318,18 @@ static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, static void ufshcd_add_query_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_req *rq_rsp; if (!trace_ufshcd_upiu_enabled()) return; - trace_ufshcd_upiu(dev_name(hba->dev), str_t, &rq->header, &rq->qr); + if (str_t == UFS_QUERY_SEND) + rq_rsp = hba->lrb[tag].ucd_req_ptr; + else + rq_rsp = (struct utp_upiu_req *)hba->lrb[tag].ucd_rsp_ptr; + + trace_ufshcd_upiu(dev_name(hba->dev), str_t, &rq_rsp->header, + &rq_rsp->qr); } static void ufshcd_add_tm_upiu_trace(struct ufs_hba *hba, unsigned int tag, -- 2.17.1