Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1894272pxu; Sun, 6 Dec 2020 10:55:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9y5CCXm09urVpUm+ROG/e4tMxabWN+I4LMWf1mekRz0r/02VFeqcnHaQ+4WwQsEtqBL8e X-Received: by 2002:aa7:c3d3:: with SMTP id l19mr1258324edr.366.1607280935033; Sun, 06 Dec 2020 10:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607280935; cv=none; d=google.com; s=arc-20160816; b=QjVc+fIA9gPj9bz7XgXDITqLJpcidCfUWZ5nBU6OC6YbXnIAAvukpkKAchw5+evpsz atU/bCZXUTPh20JHnh0rNR9XXj/kNpF7I9or7SIXUImcLi4lTf5vMbXWoRtS24KgB8rW wl5zhtVBdEt2+Fm4kQAYQ/Ta/47ohSeKnNpmXyezwGCCJyw9pZLGPHyFWmSiBQ3kver6 OHaZSzPv52wYj1Hgtq+aZTJXytMcHmDwQzPmYZXOcR6S2PpJEY5fWuItkmuadjlcSoVp LlsQuLnIEkGdkJKWZn24OBKxLayeqdj28IcV+C/CZ9U3/BnTJbytYNI8622ozaTfQTSg A0HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=d5RbZx996zoMrju4ehznqsHu4HANttELOatNZACZBLQ=; b=c19TrgBLXfm6caOE0OdZ1MFlqZD62klZnTkj+A+ojNiyEHHNjLLBbstRTzwPYYl31T ewlke57Adm8gxh9wrvk8k+UATH7PHGUFWC6rMTCQbi41xxuqzypZ7cDOd9RF53L+Laqs SbqpuesRx3v/UMx7Gso0+9qnwlCvjVy/sQUtDNqIE2wxtxlbxzWnFqWys/VPkyJwGqS0 1KeqCv3bfyQGdAU8HOTkQDfK8qeI9DGqj88iGgCFsGH90LdnuNs5fEB1Gy7cN4BbxiDZ C1BG83FyvU54dW+rb4JuiFYDsl9bWPuH5QrJ7oeg81oyJ+lY9bgvutG5o7zON4K5bB8M Ow7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si3959972edr.28.2020.12.06.10.55.12; Sun, 06 Dec 2020 10:55:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727557AbgLFSwl (ORCPT + 99 others); Sun, 6 Dec 2020 13:52:41 -0500 Received: from mail-pj1-f67.google.com ([209.85.216.67]:54126 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726440AbgLFSwl (ORCPT ); Sun, 6 Dec 2020 13:52:41 -0500 Received: by mail-pj1-f67.google.com with SMTP id iq13so6065300pjb.3; Sun, 06 Dec 2020 10:52:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=d5RbZx996zoMrju4ehznqsHu4HANttELOatNZACZBLQ=; b=LyRZm48bx/3ig2nqi8jJb2MHQRD01vrZwRFf17XEVxF61LI6V1BDpFOPwmONtIB65B syXhMMIj73Lt1An/UunpPlrEN+ieZNnTaDTyO4aUh1oQOqEKSK1Usm1fnHf5fhDKuP70 ol0jZQ39AT9xwgHjQsb5MSoV/VQNaFqlUCooEhfFh5/8iqO0yN7yzs3spx7oIJXKhM80 xTW0ZMQ5veWmwdMgZEDUbAlG1mSpcGLAZCgW2SHYoxtBINRRvLmjo0Tfk3Min5Vh3ep2 T9DATIia9uJbkODErJ6tTx2CW1viEPhmB1IRE3kOoJMXu+auSoH8BhC1Nxr+1KWYT7bc t6Gg== X-Gm-Message-State: AOAM530l6CqpLNNPc+hjzYT0vdmvNEKGQINg9LcRG6inVFvzK1O7XJRg 2ZQifCSO53+voGNg9umCO18= X-Received: by 2002:a17:90a:f992:: with SMTP id cq18mr13603043pjb.216.1607280714006; Sun, 06 Dec 2020 10:51:54 -0800 (PST) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id c14sm3344914pfp.167.2020.12.06.10.51.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Dec 2020 10:51:52 -0800 (PST) Subject: Re: [PATCH v1 1/3] scsi: ufs: Distinguish between query REQ and query RSP in query trace To: Bean Huo , 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, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org References: <20201206164226.6595-1-huobean@gmail.com> <20201206164226.6595-2-huobean@gmail.com> From: Bart Van Assche Message-ID: <043235b9-e99a-8f7e-69fa-599b94ac2b12@acm.org> Date: Sun, 6 Dec 2020 10:51:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201206164226.6595-2-huobean@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/6/20 8:42 AM, Bean Huo wrote: > 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 > > 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 ceb562accc39..e10de94adb3f 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -321,9 +321,15 @@ 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, > const char *str) > { > - struct utp_upiu_req *rq = hba->lrb[tag].ucd_req_ptr; > + struct utp_upiu_req *rq_rsp; > + > + if (!strcmp("query_send", str)) > + 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, &rq->header, &rq->qr); > + trace_ufshcd_upiu(dev_name(hba->dev), str, &rq_rsp->header, > + &rq_rsp->qr); > } Please change the 'str' argument into an enum and let ufshcd_add_query_upiu_trace() do the enum-to-string conversion. That will allow to convert the strcmp() call into an integer comparison. Thanks, Bart.