Commit 69a314d6 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Martin K. Petersen

scsi: ufs: Add more contexts in the ufs tracepoints

This adds user-friendly tracepoints with group id.

Link: https://lore.kernel.org/r/20201117165839.1643377-6-jaegeuk@kernel.orgReviewed-by: default avatarCan Guo <cang@codeaurora.org>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e93e6e49
...@@ -355,7 +355,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, ...@@ -355,7 +355,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba,
unsigned int tag, const char *str) unsigned int tag, const char *str)
{ {
sector_t lba = -1; sector_t lba = -1;
u8 opcode = 0; u8 opcode = 0, group_id = 0;
u32 intr, doorbell; u32 intr, doorbell;
struct ufshcd_lrb *lrbp = &hba->lrb[tag]; struct ufshcd_lrb *lrbp = &hba->lrb[tag];
struct scsi_cmnd *cmd = lrbp->cmd; struct scsi_cmnd *cmd = lrbp->cmd;
...@@ -381,13 +381,15 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, ...@@ -381,13 +381,15 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba,
lba = cmd->request->bio->bi_iter.bi_sector; lba = cmd->request->bio->bi_iter.bi_sector;
transfer_len = be32_to_cpu( transfer_len = be32_to_cpu(
lrbp->ucd_req_ptr->sc.exp_data_transfer_len); lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
if (opcode == WRITE_10)
group_id = lrbp->cmd->cmnd[6];
} }
} }
intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS); intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
trace_ufshcd_command(dev_name(hba->dev), str, tag, trace_ufshcd_command(dev_name(hba->dev), str, tag,
doorbell, transfer_len, intr, lba, opcode); doorbell, transfer_len, intr, lba, opcode, group_id);
} }
static void ufshcd_print_clk_freqs(struct ufs_hba *hba) static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
......
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
#define str_opcode(opcode) \
__print_symbolic(opcode, \
{ WRITE_16, "WRITE_16" }, \
{ WRITE_10, "WRITE_10" }, \
{ READ_16, "READ_16" }, \
{ READ_10, "READ_10" }, \
{ SYNCHRONIZE_CACHE, "SYNC" }, \
{ UNMAP, "UNMAP" })
#define UFS_LINK_STATES \ #define UFS_LINK_STATES \
EM(UIC_LINK_OFF_STATE) \ EM(UIC_LINK_OFF_STATE) \
EM(UIC_LINK_ACTIVE_STATE) \ EM(UIC_LINK_ACTIVE_STATE) \
...@@ -216,9 +225,10 @@ DEFINE_EVENT(ufshcd_template, ufshcd_init, ...@@ -216,9 +225,10 @@ DEFINE_EVENT(ufshcd_template, ufshcd_init,
TRACE_EVENT(ufshcd_command, TRACE_EVENT(ufshcd_command,
TP_PROTO(const char *dev_name, const char *str, unsigned int tag, TP_PROTO(const char *dev_name, const char *str, unsigned int tag,
u32 doorbell, int transfer_len, u32 intr, u64 lba, u32 doorbell, int transfer_len, u32 intr, u64 lba,
u8 opcode), u8 opcode, u8 group_id),
TP_ARGS(dev_name, str, tag, doorbell, transfer_len, intr, lba, opcode), TP_ARGS(dev_name, str, tag, doorbell, transfer_len,
intr, lba, opcode, group_id),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(dev_name, dev_name) __string(dev_name, dev_name)
...@@ -229,6 +239,7 @@ TRACE_EVENT(ufshcd_command, ...@@ -229,6 +239,7 @@ TRACE_EVENT(ufshcd_command,
__field(u32, intr) __field(u32, intr)
__field(u64, lba) __field(u64, lba)
__field(u8, opcode) __field(u8, opcode)
__field(u8, group_id)
), ),
TP_fast_assign( TP_fast_assign(
...@@ -240,13 +251,15 @@ TRACE_EVENT(ufshcd_command, ...@@ -240,13 +251,15 @@ TRACE_EVENT(ufshcd_command,
__entry->intr = intr; __entry->intr = intr;
__entry->lba = lba; __entry->lba = lba;
__entry->opcode = opcode; __entry->opcode = opcode;
__entry->group_id = group_id;
), ),
TP_printk( TP_printk(
"%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x", "%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x (%s), group_id: 0x%x",
__get_str(str), __get_str(dev_name), __entry->tag, __get_str(str), __get_str(dev_name), __entry->tag,
__entry->doorbell, __entry->transfer_len, __entry->doorbell, __entry->transfer_len,
__entry->intr, __entry->lba, (u32)__entry->opcode __entry->intr, __entry->lba, (u32)__entry->opcode,
str_opcode(__entry->opcode), (u32)__entry->group_id
) )
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment