All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e1000e: Add process name to WARN message when detecting Mutex contention
@ 2009-01-09  2:03 Jeff Kirsher
  2009-01-10  7:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Kirsher @ 2009-01-09  2:03 UTC (permalink / raw)
  To: davem; +Cc: jeff, netdev, David Graham, Bruce Allan, Jeff Kirsher

From: David Graham <david.graham@intel.com>

Adds process name of the current mutex holder to the WARN message output
when the e1000e driver attempts to acquire the nvm_mutex and finds that
it is already being held. With this patch the WARN message indicates
both the process name of the current mutex holder and the process name of
the attempted acquisition, which together will help to identify the
contending codepaths.

Signed-off-by: David Graham <david.graham@intel.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---

 drivers/net/e1000e/ich8lan.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c
index f2a5963..e415e81 100644
--- a/drivers/net/e1000e/ich8lan.c
+++ b/drivers/net/e1000e/ich8lan.c
@@ -390,7 +390,8 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
 }
 
 static DEFINE_MUTEX(nvm_mutex);
-static pid_t nvm_owner = -1;
+static pid_t nvm_owner_pid = -1;
+static char nvm_owner_name[TASK_COMM_LEN] = "";
 
 /**
  *  e1000_acquire_swflag_ich8lan - Acquire software control flag
@@ -408,11 +409,15 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 	might_sleep();
 
 	if (!mutex_trylock(&nvm_mutex)) {
-		WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",
-		     nvm_owner);
+		WARN(1, KERN_ERR "e1000e mutex contention. Owned by process "
+		     "%s (pid %d), required by process %s (pid %d)\n",
+		     nvm_owner_name, nvm_owner_pid,
+		     current->comm, current->pid);
+
 		mutex_lock(&nvm_mutex);
 	}
-	nvm_owner = current->pid;
+	nvm_owner_pid = current->pid;
+	strncpy(nvm_owner_name, current->comm, TASK_COMM_LEN);
 
 	while (timeout) {
 		extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -430,7 +435,8 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 		hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
 		extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
 		ew32(EXTCNF_CTRL, extcnf_ctrl);
-		nvm_owner = -1;
+		nvm_owner_pid = -1;
+		strcpy(nvm_owner_name, "");
 		mutex_unlock(&nvm_mutex);
 		return -E1000_ERR_CONFIG;
 	}
@@ -454,7 +460,8 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
 	extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
 	ew32(EXTCNF_CTRL, extcnf_ctrl);
 
-	nvm_owner = -1;
+	nvm_owner_pid = -1;
+	strcpy(nvm_owner_name, "");
 	mutex_unlock(&nvm_mutex);
 }
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] e1000e: Add process name to WARN message when detecting Mutex contention
  2009-01-09  2:03 [PATCH] e1000e: Add process name to WARN message when detecting Mutex contention Jeff Kirsher
@ 2009-01-10  7:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-01-10  7:07 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: jeff, netdev, david.graham, bruce.w.allan

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 08 Jan 2009 18:03:29 -0800

> From: David Graham <david.graham@intel.com>
> 
> Adds process name of the current mutex holder to the WARN message output
> when the e1000e driver attempts to acquire the nvm_mutex and finds that
> it is already being held. With this patch the WARN message indicates
> both the process name of the current mutex holder and the process name of
> the attempted acquisition, which together will help to identify the
> contending codepaths.
> 
> Signed-off-by: David Graham <david.graham@intel.com>
> Acked-by: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-10  7:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09  2:03 [PATCH] e1000e: Add process name to WARN message when detecting Mutex contention Jeff Kirsher
2009-01-10  7:07 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.