Skip to contentSkip to conversation

ipmi: add ipmi tracepoints

PATCH New Hushan Jia 1 participant 1 message Oct 30, 2013

Subsystems (2)
lore
Share & tools
lore

Hushan Jia

author
#0 lore raw

PATCH 1/1 ipmi: add ipmi tracepoints

From: Hushan Jia <[email protected]>

Sometimes it's essential to tracing ipmi communications when doing platform related work, including the commands and messages between user spaces and the system interface. This patch add 5 tracepoints to ipmi driver, and remove old debugging output code:

ipmi_cmd_request
ipmi_smi_msg_send
ipmi_smi_msg_invalidcmd
ipmi_smi_msg_recv
ipmi_smi_msg_resend

---
 drivers/char/ipmi/ipmi_msghandler.c |   44 +++++-------------
 include/trace/events/ipmi.h         |   86 +++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 33 deletions(-)
 create mode 100644 include/trace/events/ipmi.h
drivers/char/ipmi/ipmi_msghandler.c +11 -33
index ec4e10f..d89dd78 100644
@@ -431,6 +431,9 @@ struct ipmi_smi {
 };
 #define to_si_intf_from_dev(device) container_of(device, struct ipmi_smi, dev)
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/ipmi.h>
+
 /**
  * The driver model view of the IPMI messaging driver.
  */
@@ -1458,6 +1461,7 @@ static int i_ipmi_request(ipmi_user_t          user,
 	unsigned long            flags;
 	struct ipmi_smi_handlers *handlers;
 
+	trace_ipmi_cmd_request(intf, msg);
 
 	if (supplied_recv)
 		recv_msg = supplied_recv;
@@ -1806,14 +1810,7 @@ static int i_ipmi_request(ipmi_user_t          user,
 		goto out_err;
 	}
 
-#ifdef DEBUG_MSGING
-	{
-		int m;
-		for (m = 0; m < smi_msg->data_size; m++)
-			printk(" %2.2x", smi_msg->data[m]);
-		printk("\n");
-	}
-#endif
+	trace_ipmi_smi_msg_send(smi_msg);
 
 	handlers->sender(intf->send_info, smi_msg, priority);
 	rcu_read_unlock();
@@ -3132,15 +3129,8 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t          intf,
 		msg->data[10] = ipmb_checksum(&(msg->data[6]), 4);
 		msg->data_size = 11;
 
-#ifdef DEBUG_MSGING
-	{
-		int m;
-		printk("Invalid command:");
-		for (m = 0; m < msg->data_size; m++)
-			printk(" %2.2x", msg->data[m]);
-		printk("\n");
-	}
-#endif
+		trace_ipmi_smi_msg_invalidcmd(msg);
+
 		rcu_read_lock();
 		handlers = intf->handlers;
 		if (handlers) {
@@ -3647,13 +3637,8 @@ static int handle_one_recv_msg(ipmi_smi_t          intf,
 	int requeue;
 	int chan;
 
-#ifdef DEBUG_MSGING
-	int m;
-	printk("Recv:");
-	for (m = 0; m < msg->rsp_size; m++)
-		printk(" %2.2x", msg->rsp[m]);
-	printk("\n");
-#endif
+	trace_ipmi_smi_msg_recv(msg);
+
 	if (msg->rsp_size < 2) {
 		/* Message is too small to be correct. */
 		printk(KERN_WARNING PFX "BMC returned to small a message"
@@ -3951,15 +3936,8 @@ smi_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
 	smi_msg->data_size = recv_msg->msg.data_len;
 	smi_msg->msgid = STORE_SEQ_IN_MSGID(seq, seqid);
 
-#ifdef DEBUG_MSGING
-	{
-		int m;
-		printk("Resend: ");
-		for (m = 0; m < smi_msg->data_size; m++)
-			printk(" %2.2x", smi_msg->data[m]);
-		printk("\n");
-	}
-#endif
+	trace_ipmi_smi_msg_resend(smi_msg);
+
 	return smi_msg;
 }
 
include/trace/events/ipmi.h new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
1.7.7