mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi:ufs:core: Add trace READ(16)/WRITE(16) commands
@ 2024-09-25  2:48 liuderong
  2024-09-25 16:34 ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: liuderong @ 2024-09-25  2:48 UTC (permalink / raw)
  To: alim.akhtar, avri.altman, bvanassche; +Cc: linux-scsi, linux-kernel, liuderong

From: liuderong <liuderong@oppo.com>

For sd_zbc_read_zones, READ(16)/WRITE(16) are mandatory for ZBC disks.
Currently, when printing the trace:ufshcd_command on zone UFS devices,
the LBA and SIZE fields appear invalid,
making it difficult to trace commands.
So add trace READ(16)/WRITE(16) commands for zone ufs device.

Trace sample:
ufshcd_command: send_req: 1d84000.ufshc: tag: 31, DB: 0x0,
size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, hwq_id: 7
ufshcd_command: complete_rsp: 1d84000.ufshc: tag: 31, DB: 0x0,
size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, hwq_id: 7

Signed-off-by: liuderong <liuderong@oppo.com>
---
 drivers/ufs/core/ufshcd.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5e3c67e..9e5e903 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -434,15 +434,19 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 
 	opcode = cmd->cmnd[0];
 
-	if (opcode == READ_10 || opcode == WRITE_10) {
+	if (opcode == READ_10 || opcode == READ_16 ||
+		opcode == WRITE_10 || opcode == WRITE_16) {
 		/*
-		 * Currently we only fully trace read(10) and write(10) commands
+		 * Currently we only fully trace the following commands,
+		 * read(10),read(16),write(10), and write(16)
 		 */
 		transfer_len =
 		       be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
 		lba = scsi_get_lba(cmd);
 		if (opcode == WRITE_10)
 			group_id = lrbp->cmd->cmnd[6];
+		if (opcode == WRITE_16)
+			group_id = lrbp->cmd->cmnd[14];
 	} else if (opcode == UNMAP) {
 		/*
 		 * The number of Bytes to be unmapped beginning with the lba.
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi:ufs:core: Add trace READ(16)/WRITE(16) commands
  2024-09-25  2:48 [PATCH] scsi:ufs:core: Add trace READ(16)/WRITE(16) commands liuderong
@ 2024-09-25 16:34 ` Bart Van Assche
  2024-09-27  2:15   ` liuderong
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2024-09-25 16:34 UTC (permalink / raw)
  To: liuderong, alim.akhtar, avri.altman; +Cc: linux-scsi, linux-kernel, Jaegeuk Kim

On 9/24/24 7:48 PM, liuderong@oppo.com wrote:
> From: liuderong <liuderong@oppo.com>
> 
> For sd_zbc_read_zones, READ(16)/WRITE(16) are mandatory for ZBC disks.
> Currently, when printing the trace:ufshcd_command on zone UFS devices,
> the LBA and SIZE fields appear invalid,
> making it difficult to trace commands.
> So add trace READ(16)/WRITE(16) commands for zone ufs device.
> 
> Trace sample:
> ufshcd_command: send_req: 1d84000.ufshc: tag: 31, DB: 0x0,
> size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, hwq_id: 7
> ufshcd_command: complete_rsp: 1d84000.ufshc: tag: 31, DB: 0x0,
> size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, hwq_id: 7
> 
> Signed-off-by: liuderong <liuderong@oppo.com>
> ---
>   drivers/ufs/core/ufshcd.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 5e3c67e..9e5e903 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -434,15 +434,19 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
>   
>   	opcode = cmd->cmnd[0];
>   
> -	if (opcode == READ_10 || opcode == WRITE_10) {
> +	if (opcode == READ_10 || opcode == READ_16 ||
> +		opcode == WRITE_10 || opcode == WRITE_16) {
>   		/*
> -		 * Currently we only fully trace read(10) and write(10) commands
> +		 * Currently we only fully trace the following commands,
> +		 * read(10),read(16),write(10), and write(16)
>   		 */
>   		transfer_len =
>   		       be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
>   		lba = scsi_get_lba(cmd);
>   		if (opcode == WRITE_10)
>   			group_id = lrbp->cmd->cmnd[6];
> +		if (opcode == WRITE_16)
> +			group_id = lrbp->cmd->cmnd[14];
>   	} else if (opcode == UNMAP) {
>   		/*
>   		 * The number of Bytes to be unmapped beginning with the lba.

To me the above patch looks like a subset of this patch from 1.5y ago:
https://lore.kernel.org/linux-scsi/20230215190448.1687786-1-jaegeuk@kernel.org/

Bart.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi:ufs:core: Add trace READ(16)/WRITE(16) commands
  2024-09-25 16:34 ` Bart Van Assche
@ 2024-09-27  2:15   ` liuderong
  0 siblings, 0 replies; 3+ messages in thread
From: liuderong @ 2024-09-27  2:15 UTC (permalink / raw)
  To: Bart Van Assche, alim.akhtar, avri.altman
  Cc: linux-scsi, linux-kernel, Jaegeuk Kim





> On 9/24/24 7:48 PM, liuderong@oppo.com wrote:
>> From: liuderong <liuderong@oppo.com>
>>
>> For sd_zbc_read_zones, READ(16)/WRITE(16) are mandatory for ZBC disks.
>> Currently, when printing the trace:ufshcd_command on zone UFS devices,
>> the LBA and SIZE fields appear invalid,
>> making it difficult to trace commands.
>> So add trace READ(16)/WRITE(16) commands for zone ufs device.
>>
>> Trace sample:
>> ufshcd_command: send_req: 1d84000.ufshc: tag: 31, DB: 0x0,
>> size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, 
>> hwq_id: 7
>> ufshcd_command: complete_rsp: 1d84000.ufshc: tag: 31, DB: 0x0,
>> size: -1, IS: 0, LBA: 0, opcode: 0x8a (WRITE_16), group_id: 0x0, 
>> hwq_id: 7
>>
>> Signed-off-by: liuderong <liuderong@oppo.com>
>> ---
>>   drivers/ufs/core/ufshcd.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>> index 5e3c67e..9e5e903 100644
>> --- a/drivers/ufs/core/ufshcd.c
>> +++ b/drivers/ufs/core/ufshcd.c
>> @@ -434,15 +434,19 @@ static void ufshcd_add_command_trace(struct 
>> ufs_hba *hba, unsigned int tag,
>>         opcode = cmd->cmnd[0];
>>   -    if (opcode == READ_10 || opcode == WRITE_10) {
>> +    if (opcode == READ_10 || opcode == READ_16 ||
>> +        opcode == WRITE_10 || opcode == WRITE_16) {
>>           /*
>> -         * Currently we only fully trace read(10) and write(10) 
>> commands
>> +         * Currently we only fully trace the following commands,
>> +         * read(10),read(16),write(10), and write(16)
>>            */
>>           transfer_len =
>> be32_to_cpu(lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
>>           lba = scsi_get_lba(cmd);
>>           if (opcode == WRITE_10)
>>               group_id = lrbp->cmd->cmnd[6];
>> +        if (opcode == WRITE_16)
>> +            group_id = lrbp->cmd->cmnd[14];
>>       } else if (opcode == UNMAP) {
>>           /*
>>            * The number of Bytes to be unmapped beginning with the lba.
>
> To me the above patch looks like a subset of this patch from 1.5y ago:
> https://lore.kernel.org/linux-scsi/20230215190448.1687786-1-jaegeuk@kernel.org/ 
>
>
> Bart.
Hi Bart,

OK, do we have plan to remove the trace: ufshcd_command?
I think if we want to observe info closest to the ufs device(such as ufs 
io latency), the ufshcd trace is more appropriate.
What do you think?

Thanks,
Derong

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-27  2:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-25  2:48 [PATCH] scsi:ufs:core: Add trace READ(16)/WRITE(16) commands liuderong
2024-09-25 16:34 ` Bart Van Assche
2024-09-27  2:15   ` liuderong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®