Patchwork [Open-FCoE] libfc: Fix timer arm debug statement

login
register
mail settings
Submitter Robert Love
Date June 13, 2013, 7:26 p.m.
Message ID <20130613192618.25284.96503.stgit@fritz>
Download mbox | patch
Permalink /patch/63/
State RFC
Headers show

Comments

Robert Love - June 13, 2013, 7:26 p.m.
Logging in the timer arm routine doesn't provide any
context to the user who is debugging. This patch adds
the function who called the arm routine to the log
statement.

The resultant log message looks like this:

kernel: [ 9390.263809] host88: xid  200: Exchange timer armed (fc_exch_seq_send+0x149/0x1c0 [libfc]): 2000 msecs

Signed-off-by: Robert Love <robert.w.love@intel.com>
---
 drivers/scsi/libfc/fc_exch.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Robert Love - June 13, 2013, 7:27 p.m.
> Subject: [Open-FCoE] [PATCH] libfc: Fix timer arm debug statement
> 
> Logging in the timer arm routine doesn't provide any context to the user who
> is debugging. This patch adds the function who called the arm routine to the
> log statement.
> 
> The resultant log message looks like this:
> 
> kernel: [ 9390.263809] host88: xid  200: Exchange timer armed
> (fc_exch_seq_send+0x149/0x1c0 [libfc]): 2000 msecs
> 
> Signed-off-by: Robert Love <robert.w.love@intel.com>

This should have an RFC on it, it still needs testing...

//Rob

Patch

diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 5879929..e686161 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -23,6 +23,7 @@ 
  * Fibre Channel exchange and sequence handling.
  */
 
+#include <linux/kallsyms.h>
 #include <linux/timer.h>
 #include <linux/slab.h>
 #include <linux/err.h>
@@ -357,10 +358,15 @@  static inline void fc_exch_timer_cancel(struct fc_exch *ep)
 static inline void fc_exch_timer_set_locked(struct fc_exch *ep,
 					    unsigned int timer_msec)
 {
+	char symb_name[KSYM_NAME_LEN];
+
 	if (ep->state & (FC_EX_RST_CLEANUP | FC_EX_DONE))
 		return;
 
-	FC_EXCH_DBG(ep, "Exchange timer armed : %d msecs\n", timer_msec);
+	sprint_symbol(symb_name, (unsigned long)__builtin_return_address(0));
+
+	FC_EXCH_DBG(ep, "Exchange timer armed (%s): %d msecs\n",
+		    symb_name, timer_msec);
 
 	if (queue_delayed_work(fc_exch_workqueue, &ep->timeout_work,
 			       msecs_to_jiffies(timer_msec)))