Skip to content

Commit 7936422

Browse files
rolandddledford
authored andcommitted
IB/core: Add might_sleep() annotation to ib_init_ah_from_wc()
For RoCE, ib_init_ah_from_wc() can follow the path ib_init_ah_from_wc() -> rdma_addr_find_l2_eth_by_grh() -> rdma_resolve_ip() and rdma_resolve_ip() will sleep in kzalloc() and wait_for_completion(). However, developers will not see any warnings if they use ib_init_ah_from_wc() in an atomic context and test only on IB, because the function doesn't sleep in that case. Add a might_sleep() so that lockdep will catch bugs no matter what hardware is used to test. Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent c761611 commit 7936422

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/infiniband/core/verbs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
468468
union ib_gid dgid;
469469
union ib_gid sgid;
470470

471+
might_sleep();
472+
471473
memset(ah_attr, 0, sizeof *ah_attr);
472474
ah_attr->type = rdma_ah_find_type(device, port_num);
473475
if (rdma_cap_eth_ah(device, port_num)) {

0 commit comments

Comments
 (0)