diff mbox series

RDMA/usnic: use iommu_map_atomic() under spin_lock()

Message ID 20230129093757.637354-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Headers show
Series RDMA/usnic: use iommu_map_atomic() under spin_lock() | expand

Commit Message

Yang Yingliang Jan. 29, 2023, 9:37 a.m. UTC
usnic_uiom_map_sorted_intervals() is called under spin_lock(), iommu_map()
might sleep, use iommu_map_atomic() to avoid potential sleep in atomic
context.

Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/infiniband/hw/usnic/usnic_uiom.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Leon Romanovsky Jan. 30, 2023, 9:39 a.m. UTC | #1
On Sun, 29 Jan 2023 17:37:57 +0800, Yang Yingliang wrote:
> usnic_uiom_map_sorted_intervals() is called under spin_lock(), iommu_map()
> might sleep, use iommu_map_atomic() to avoid potential sleep in atomic
> context.
> 
> 

Applied, thanks!

[1/1] RDMA/usnic: use iommu_map_atomic() under spin_lock()
      https://git.kernel.org/rdma/rdma/c/b7e08a5a63a116

Best regards,
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/hw/usnic/usnic_uiom.c
index c301b3be9f30..a2857accc427 100644
--- a/drivers/infiniband/hw/usnic/usnic_uiom.c
+++ b/drivers/infiniband/hw/usnic/usnic_uiom.c
@@ -276,8 +276,8 @@  static int usnic_uiom_map_sorted_intervals(struct list_head *intervals,
 				size = pa_end - pa_start + PAGE_SIZE;
 				usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x",
 					va_start, &pa_start, size, flags);
-				err = iommu_map(pd->domain, va_start, pa_start,
-							size, flags);
+				err = iommu_map_atomic(pd->domain, va_start,
+						       pa_start, size, flags);
 				if (err) {
 					usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n",
 						va_start, &pa_start, size, err);
@@ -293,8 +293,8 @@  static int usnic_uiom_map_sorted_intervals(struct list_head *intervals,
 				size = pa - pa_start + PAGE_SIZE;
 				usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x\n",
 					va_start, &pa_start, size, flags);
-				err = iommu_map(pd->domain, va_start, pa_start,
-						size, flags);
+				err = iommu_map_atomic(pd->domain, va_start,
+						       pa_start, size, flags);
 				if (err) {
 					usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n",
 						va_start, &pa_start, size, err);