Skip to contentSkip to conversation

bus: mhi: host: Change the trace string for the userspace tools mapping

PATCH Applied Krishna chaitanya chundru 3 participants 5 messages Feb 18, 2024 – Feb 22, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus: mhi: host: Change the trace string for the userspace tools mapping

User space tools can't map strings if we use directly, as the string address is internal to kernel.

So add trace point strings for the user space tools to map strings properly.

---
 drivers/bus/mhi/host/main.c  | 4 ++--
 drivers/bus/mhi/host/trace.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/bus/mhi/host/main.c +2 -2
index 2d38f6005da6..15d657af9b5b 100644
@@ -1340,7 +1340,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 	enum mhi_cmd_type cmd = MHI_CMD_NOP;
 	int ret;
 
-	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, "Updating");
+	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, TPS("Updating"));
 	switch (to_state) {
 	case MHI_CH_STATE_TYPE_RESET:
 		write_lock_irq(&mhi_chan->lock);
@@ -1407,7 +1407,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 		write_unlock_irq(&mhi_chan->lock);
 	}
 
-	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, "Updated");
+	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated"));
 exit_channel_update:
 	mhi_cntrl->runtime_put(mhi_cntrl);
 	mhi_device_put(mhi_cntrl->mhi_dev);
drivers/bus/mhi/host/trace.h +2 -0
index d12a98d44272..368515dcb22d 100644
@@ -84,6 +84,8 @@ DEV_ST_TRANSITION_LIST
 #define dev_st_trans(a, b)		{ DEV_ST_TRANSITION_##a, b },
 #define dev_st_trans_end(a, b)		{ DEV_ST_TRANSITION_##a, b }
 
+#define TPS(x)	tracepoint_string(x)
+
 TRACE_EVENT(mhi_gen_tre,
 
 	TP_PROTO(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,

---
base-commit: ceeb64f41fe6a1eb9fc56d583983a81f8f3dd058
change-id: 20240218-ftrace_string-7677762aa63c

Best regards,

Signature · 1 line
Krishna chaitanya chundru <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Krishna chaitanya chundru

User space tools can't map strings if we use directly, as the string address is internal to kernel.

So add trace point strings for the user space tools to map strings properly.

- Mani

Quoted 49 lines
---
 drivers/bus/mhi/host/main.c  | 4 ++--
 drivers/bus/mhi/host/trace.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/bus/mhi/host/main.c +2 -2
index 2d38f6005da6..15d657af9b5b 100644
@@ -1340,7 +1340,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 	enum mhi_cmd_type cmd = MHI_CMD_NOP;
 	int ret;
 
-	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, "Updating");
+	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, TPS("Updating"));
 	switch (to_state) {
 	case MHI_CH_STATE_TYPE_RESET:
 		write_lock_irq(&mhi_chan->lock);
@@ -1407,7 +1407,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 		write_unlock_irq(&mhi_chan->lock);
 	}
 
-	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, "Updated");
+	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated"));
 exit_channel_update:
 	mhi_cntrl->runtime_put(mhi_cntrl);
 	mhi_device_put(mhi_cntrl->mhi_dev);
drivers/bus/mhi/host/trace.h +2 -1
index d12a98d44272..368515dcb22d 100644
@@ -84,6 +84,8 @@ DEV_ST_TRANSITION_LIST
 #define dev_st_trans(a, b)		{ DEV_ST_TRANSITION_##a, b },
 #define dev_st_trans_end(a, b)		{ DEV_ST_TRANSITION_##a, b }
 
+#define TPS(x)	tracepoint_string(x)
+
 TRACE_EVENT(mhi_gen_tre,
 
 	TP_PROTO(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
 
---

base-commit: ceeb64f41fe6a1eb9fc56d583983a81f8f3dd058
change-id: 20240218-ftrace_string-7677762aa63c

Best regards,

Signature · 1 line
Krishna chaitanya chundru <[email protected]>
Signature · 1 line
மணிவண்ணன் சதாசிவம்
maintainer
#2 lore raw
Quoted 10 lines · On Wed, 21 Feb 2024 11:41:46 +0530 Manivannan Sadhasivam…
Quoted 7 lines · Krishna chaitanya chundru

User space tools can't map strings if we use directly, as the string address is internal to kernel.

So add trace point strings for the user space tools to map strings properly.

Suggested-by may be more accurate?

-- Steve

Quoted 1 line
#3 lore raw
Quoted 7 lines · Steven Rostedt
Quoted 4 lines · On Wed, 21 Feb 2024 11:41:46 +0530 Manivannan Sadhasivam…
Quoted 3 lines · Krishna chaitanya chundru

User space tools can't map strings if we use directly, as the string address is internal to kernel.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

So add trace point strings for the user space tools to map strings properly.

Suggested-by may be more accurate?

Sure. Will change it while applying.

- Mani

Quoted 4 lines

-- Steve

Quoted 1 line
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#4 lore raw
In reply to Krishna chaitanya chundru
Quoted 7 lines · Krishna chaitanya chundru

User space tools can't map strings if we use directly, as the string address is internal to kernel.

So add trace point strings for the user space tools to map strings properly.

Applied to mhi-next!

- Mani

Quoted 49 lines
---
 drivers/bus/mhi/host/main.c  | 4 ++--
 drivers/bus/mhi/host/trace.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/bus/mhi/host/main.c +2 -2
index 2d38f6005da6..15d657af9b5b 100644
@@ -1340,7 +1340,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 	enum mhi_cmd_type cmd = MHI_CMD_NOP;
 	int ret;
 
-	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, "Updating");
+	trace_mhi_channel_command_start(mhi_cntrl, mhi_chan, to_state, TPS("Updating"));
 	switch (to_state) {
 	case MHI_CH_STATE_TYPE_RESET:
 		write_lock_irq(&mhi_chan->lock);
@@ -1407,7 +1407,7 @@ static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
 		write_unlock_irq(&mhi_chan->lock);
 	}
 
-	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, "Updated");
+	trace_mhi_channel_command_end(mhi_cntrl, mhi_chan, to_state, TPS("Updated"));
 exit_channel_update:
 	mhi_cntrl->runtime_put(mhi_cntrl);
 	mhi_device_put(mhi_cntrl->mhi_dev);
drivers/bus/mhi/host/trace.h +2 -1
index d12a98d44272..368515dcb22d 100644
@@ -84,6 +84,8 @@ DEV_ST_TRANSITION_LIST
 #define dev_st_trans(a, b)		{ DEV_ST_TRANSITION_##a, b },
 #define dev_st_trans_end(a, b)		{ DEV_ST_TRANSITION_##a, b }
 
+#define TPS(x)	tracepoint_string(x)
+
 TRACE_EVENT(mhi_gen_tre,
 
 	TP_PROTO(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan,
 
---

base-commit: ceeb64f41fe6a1eb9fc56d583983a81f8f3dd058
change-id: 20240218-ftrace_string-7677762aa63c

Best regards,

Signature · 1 line
Krishna chaitanya chundru <[email protected]>
Signature · 1 line
மணிவண்ணன் சதாசிவம்