提交 b65c2045 编写于 作者: G Grzegorz Morys 提交者: Doug Ledford

IB/hfi1: Correct unnecessary acquisition of HW mutex

Avoid acquiring already acquired hardware mutex and releasing
the unacquired one as these are redundant operations.
Add printouts for such situations to help detect potential errors
within the driver.
Reviewed-by: NMike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: NGrzegorz Morys <grzegorz.morys@intel.com>
Signed-off-by: NDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 621515da
...@@ -1387,7 +1387,14 @@ int acquire_hw_mutex(struct hfi1_devdata *dd) ...@@ -1387,7 +1387,14 @@ int acquire_hw_mutex(struct hfi1_devdata *dd)
unsigned long timeout; unsigned long timeout;
int try = 0; int try = 0;
u8 mask = 1 << dd->hfi1_id; u8 mask = 1 << dd->hfi1_id;
u8 user; u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
if (user == mask) {
dd_dev_info(dd,
"Hardware mutex already acquired, mutex mask %u\n",
(u32)mask);
return 0;
}
retry: retry:
timeout = msecs_to_jiffies(HM_TIMEOUT) + jiffies; timeout = msecs_to_jiffies(HM_TIMEOUT) + jiffies;
...@@ -1418,6 +1425,14 @@ int acquire_hw_mutex(struct hfi1_devdata *dd) ...@@ -1418,6 +1425,14 @@ int acquire_hw_mutex(struct hfi1_devdata *dd)
void release_hw_mutex(struct hfi1_devdata *dd) void release_hw_mutex(struct hfi1_devdata *dd)
{ {
u8 mask = 1 << dd->hfi1_id;
u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
if (user != mask)
dd_dev_warn(dd,
"Unable to release hardware mutex, mutex mask %u, my mask %u\n",
(u32)user, (u32)mask);
else
write_csr(dd, ASIC_CFG_MUTEX, 0); write_csr(dd, ASIC_CFG_MUTEX, 0);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册