mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
RDMA/hns: Fix deadlock on SRQ async events.
[ Upstream commitb46494b6f9] xa_lock for SRQ table may be required in AEQ. Use xa_store_irq()/ xa_erase_irq() to avoid deadlock. Fixes:81fce6291d("RDMA/hns: Add SRQ asynchronous event support") Signed-off-by: Chengchang Tang <tangchengchang@huawei.com> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Link: https://lore.kernel.org/r/20240412091616.370789-5-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
eae28a9e86
commit
72dc542f0d
@@ -37,6 +37,7 @@
|
|||||||
#include <rdma/ib_smi.h>
|
#include <rdma/ib_smi.h>
|
||||||
#include <rdma/ib_user_verbs.h>
|
#include <rdma/ib_user_verbs.h>
|
||||||
#include <rdma/ib_cache.h>
|
#include <rdma/ib_cache.h>
|
||||||
|
#include "hnae3.h"
|
||||||
#include "hns_roce_common.h"
|
#include "hns_roce_common.h"
|
||||||
#include "hns_roce_device.h"
|
#include "hns_roce_device.h"
|
||||||
#include "hns_roce_hem.h"
|
#include "hns_roce_hem.h"
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = xa_err(xa_store(&srq_table->xa, srq->srqn, srq, GFP_KERNEL));
|
ret = xa_err(xa_store_irq(&srq_table->xa, srq->srqn, srq, GFP_KERNEL));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ibdev_err(ibdev, "failed to store SRQC, ret = %d.\n", ret);
|
ibdev_err(ibdev, "failed to store SRQC, ret = %d.\n", ret);
|
||||||
goto err_put;
|
goto err_put;
|
||||||
@@ -136,7 +136,7 @@ static int alloc_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_xa:
|
err_xa:
|
||||||
xa_erase(&srq_table->xa, srq->srqn);
|
xa_erase_irq(&srq_table->xa, srq->srqn);
|
||||||
err_put:
|
err_put:
|
||||||
hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
|
hns_roce_table_put(hr_dev, &srq_table->table, srq->srqn);
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ static void free_srqc(struct hns_roce_dev *hr_dev, struct hns_roce_srq *srq)
|
|||||||
dev_err(hr_dev->dev, "DESTROY_SRQ failed (%d) for SRQN %06lx\n",
|
dev_err(hr_dev->dev, "DESTROY_SRQ failed (%d) for SRQN %06lx\n",
|
||||||
ret, srq->srqn);
|
ret, srq->srqn);
|
||||||
|
|
||||||
xa_erase(&srq_table->xa, srq->srqn);
|
xa_erase_irq(&srq_table->xa, srq->srqn);
|
||||||
|
|
||||||
if (refcount_dec_and_test(&srq->refcount))
|
if (refcount_dec_and_test(&srq->refcount))
|
||||||
complete(&srq->free);
|
complete(&srq->free);
|
||||||
|
|||||||
Reference in New Issue
Block a user