Skip to content

Commit 0a834a3

Browse files
davidgraham-inteldavem330
authored andcommitted
e1000e: Remove mutex_trylock and associated WARN on failure.
Single-thread access must be ensured for ICH8 NVM and PHY operations. This synchronization is provided by the nvm_mutex. To assist in understanding the contexts from which this code could be reached, a WARN was output if the mutex was not going to be immediately acquirable (if !mutex_trylock()). The code has now been optimized, and we have verified that the few remaining mutex contentions are reasonable and non-blocking, and it is time to remove the mutex_trylock() and WARN messages. Signed-off-by: dave graham <david.graham@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5e30589 commit 0a834a3

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

drivers/net/e1000e/ich8lan.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
390390
}
391391

392392
static DEFINE_MUTEX(nvm_mutex);
393-
static pid_t nvm_owner_pid = -1;
394-
static char nvm_owner_name[TASK_COMM_LEN] = "";
395393

396394
/**
397395
* e1000_acquire_swflag_ich8lan - Acquire software control flag
@@ -408,16 +406,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
408406

409407
might_sleep();
410408

411-
if (!mutex_trylock(&nvm_mutex)) {
412-
WARN(1, KERN_ERR "e1000e mutex contention. Owned by process "
413-
"%s (pid %d), required by process %s (pid %d)\n",
414-
nvm_owner_name, nvm_owner_pid,
415-
current->comm, current->pid);
416-
417-
mutex_lock(&nvm_mutex);
418-
}
419-
nvm_owner_pid = current->pid;
420-
strncpy(nvm_owner_name, current->comm, TASK_COMM_LEN);
409+
mutex_lock(&nvm_mutex);
421410

422411
while (timeout) {
423412
extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -435,8 +424,6 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
435424
hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
436425
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
437426
ew32(EXTCNF_CTRL, extcnf_ctrl);
438-
nvm_owner_pid = -1;
439-
strcpy(nvm_owner_name, "");
440427
mutex_unlock(&nvm_mutex);
441428
return -E1000_ERR_CONFIG;
442429
}
@@ -460,8 +447,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
460447
extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
461448
ew32(EXTCNF_CTRL, extcnf_ctrl);
462449

463-
nvm_owner_pid = -1;
464-
strcpy(nvm_owner_name, "");
465450
mutex_unlock(&nvm_mutex);
466451
}
467452

0 commit comments

Comments
 (0)