RDMA/hns: Use mutex instead of spinlock for ida allocation
authorYangyang Li <liyangyang20@huawei.com>
Tue, 19 Jan 2021 09:28:33 +0000 (17:28 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 20 Jan 2021 00:20:13 +0000 (20:20 -0400)
commit9293d3fcb70583f2c786f04ca788af026b7c4c5c
treeda27553935e091e3d6d04328119aec4d98ad9521
parent9f206f7398f6f6ec7dd0198c045c2459b4f720b6
RDMA/hns: Use mutex instead of spinlock for ida allocation

GFP_KERNEL may cause ida_alloc_range() to sleep, but the spinlock covering
this function is not allowed to sleep, so the spinlock needs to be changed
to mutex.

As there is a certain chance of memory allocation failure, GFP_ATOMIC is
not suitable for QP allocation scenarios.

Fixes: 71586dd20010 ("RDMA/hns: Create QP with selected QPN for bank load balance")
Link: https://lore.kernel.org/r/1611048513-28663-1-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_qp.c