Skip to content

Commit ccc3e13

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Include the SCSI ID in UFS command tracing output
The logical unit information is missing from the UFS command tracing output. Although the device name is logged, e.g. 13200000.ufs, this name does not include logical unit information. Hence this patch that replaces the device name with the SCSI ID in the tracing output. An example of tracing output with this patch applied: kworker/8:0H-80 [008] ..... 89.106063: ufshcd_command: send_req: 0:0:0:4: tag: 10, DB: 0x7ffffbff, size: 524288, IS: 0, LBA: 1085538, opcode: 0x8a (WRITE_16), group_id: 0x0 dd-4225 [000] d.h.. 89.106219: ufshcd_command: complete_rsp: 0:0:0:4: tag: 11, DB: 0x7ffff7ff, size: 524288, IS: 0, LBA: 1081728, opcode: 0x8a (WRITE_16), group_id: 0x0 Cc: Christoph Hellwig <[email protected]> Cc: Steven Rostedt <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Can Guo <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0bb80ec commit ccc3e13

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,8 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
446446
} else {
447447
doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
448448
}
449-
trace_ufshcd_command(dev_name(hba->dev), str_t, tag,
450-
doorbell, hwq_id, transfer_len, intr, lba, opcode, group_id);
449+
trace_ufshcd_command(cmd->device, str_t, tag, doorbell, hwq_id,
450+
transfer_len, intr, lba, opcode, group_id);
451451
}
452452

453453
static void ufshcd_print_clk_freqs(struct ufs_hba *hba)

include/trace/events/ufs.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,15 @@ DEFINE_EVENT(ufshcd_template, ufshcd_wl_runtime_resume,
267267
TP_ARGS(dev_name, err, usecs, dev_state, link_state));
268268

269269
TRACE_EVENT(ufshcd_command,
270-
TP_PROTO(const char *dev_name, enum ufs_trace_str_t str_t,
270+
TP_PROTO(struct scsi_device *sdev, enum ufs_trace_str_t str_t,
271271
unsigned int tag, u32 doorbell, u32 hwq_id, int transfer_len,
272272
u32 intr, u64 lba, u8 opcode, u8 group_id),
273273

274-
TP_ARGS(dev_name, str_t, tag, doorbell, hwq_id, transfer_len,
275-
intr, lba, opcode, group_id),
274+
TP_ARGS(sdev, str_t, tag, doorbell, hwq_id, transfer_len, intr, lba,
275+
opcode, group_id),
276276

277277
TP_STRUCT__entry(
278-
__string(dev_name, dev_name)
278+
__field(struct scsi_device *, sdev)
279279
__field(enum ufs_trace_str_t, str_t)
280280
__field(unsigned int, tag)
281281
__field(u32, doorbell)
@@ -288,7 +288,7 @@ TRACE_EVENT(ufshcd_command,
288288
),
289289

290290
TP_fast_assign(
291-
__assign_str(dev_name, dev_name);
291+
__entry->sdev = sdev;
292292
__entry->str_t = str_t;
293293
__entry->tag = tag;
294294
__entry->doorbell = doorbell;
@@ -302,8 +302,9 @@ TRACE_EVENT(ufshcd_command,
302302

303303
TP_printk(
304304
"%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x (%s), group_id: 0x%x, hwq_id: %d",
305-
show_ufs_cmd_trace_str(__entry->str_t), __get_str(dev_name),
306-
__entry->tag, __entry->doorbell, __entry->transfer_len, __entry->intr,
305+
show_ufs_cmd_trace_str(__entry->str_t),
306+
dev_name(&__entry->sdev->sdev_dev), __entry->tag,
307+
__entry->doorbell, __entry->transfer_len, __entry->intr,
307308
__entry->lba, (u32)__entry->opcode, str_opcode(__entry->opcode),
308309
(u32)__entry->group_id, __entry->hwq_id
309310
)

0 commit comments

Comments
 (0)