Unverified Commit 59401c6f authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!15603 Mainline patch merged into OLK-6.6

Merge Pull Request from: @ci-robot 
 
PR sync from: Junxian Huang <huangjunxian6@hisilicon.com>
https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/KH4F3MXVUIOZAFOBFLWJRVNOLJADFCFW/ 
From: Xinghai Cen <cenxinghai@h-partners.com>

Mainline patch merged into OLK-6.6:

Junxian Huang (6):
  RDMA/hns: Fix soft lockup during bt pages loop
  RDMA/hns: Fix unmatched condition in error path of alloc_user_qp_db()
  RDMA/hns: Fix invalid sq params not being blocked
  RDMA/hns: Fix a missing rollback in error path of
    hns_roce_create_qp_common()
  RDMA/hns: Fix wrong value of max_sge_rd
  RDMA/hns: Fix missing xa_destroy()

 
https://gitee.com/openeuler/kernel/issues/IBV0G0 
 
Link:https://gitee.com/openeuler/kernel/pulls/15603

 

Reviewed-by: default avatarZhang Peng <zhangpeng362@huawei.com>
Signed-off-by: default avatarZhang Peng <zhangpeng362@huawei.com>
parents 1579902a f78cf185
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -175,8 +175,10 @@ void hns_roce_cleanup_bitmap(struct hns_roce_dev *hr_dev)
	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)
		ida_destroy(&hr_dev->xrcd_ida.ida);

	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ)
	if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) {
		ida_destroy(&hr_dev->srq_table.srq_ida.ida);
		xa_destroy(&hr_dev->srq_table.xa);
	}
	hns_roce_cleanup_qp_table(hr_dev);
	hns_roce_cleanup_cq_table(hr_dev);
	ida_destroy(&hr_dev->mr_table.mtpt_ida.ida);
+1 −0
Original line number Diff line number Diff line
@@ -616,5 +616,6 @@ void hns_roce_cleanup_cq_table(struct hns_roce_dev *hr_dev)

	for (i = 0; i < HNS_ROCE_CQ_BANK_NUM; i++)
		ida_destroy(&hr_dev->cq_table.bank[i].ida);
	xa_destroy(&hr_dev->cq_table.array);
	mutex_destroy(&hr_dev->cq_table.bank_mutex);
}
+15 −1
Original line number Diff line number Diff line
@@ -1362,6 +1362,11 @@ static int hem_list_alloc_root_bt(struct hns_roce_dev *hr_dev,
	return ret;
}

/* This is the bottom bt pages number of a 100G MR on 4K OS, assuming
 * the bt page size is not expanded by cal_best_bt_pg_sz()
 */
#define RESCHED_LOOP_CNT_THRESHOLD_ON_4K 12800

/* construct the base address table and link them by address hop config */
int hns_roce_hem_list_request(struct hns_roce_dev *hr_dev,
			      struct hns_roce_hem_list *hem_list,
@@ -1370,6 +1375,7 @@ int hns_roce_hem_list_request(struct hns_roce_dev *hr_dev,
{
	const struct hns_roce_buf_region *r;
	int ofs, end;
	int loop;
	int unit;
	int ret;
	int i;
@@ -1387,7 +1393,10 @@ int hns_roce_hem_list_request(struct hns_roce_dev *hr_dev,
			continue;

		end = r->offset + r->count;
		for (ofs = r->offset; ofs < end; ofs += unit) {
		for (ofs = r->offset, loop = 1; ofs < end; ofs += unit, loop++) {
			if (!(loop % RESCHED_LOOP_CNT_THRESHOLD_ON_4K))
				cond_resched();

			ret = hem_list_alloc_mid_bt(hr_dev, r, unit, ofs,
						    hem_list->mid_bt[i],
						    &hem_list->btm_bt);
@@ -1444,9 +1453,14 @@ void *hns_roce_hem_list_find_mtt(struct hns_roce_dev *hr_dev,
	struct list_head *head = &hem_list->btm_bt;
	struct hns_roce_hem_item *hem, *temp_hem;
	void *cpu_base = NULL;
	int loop = 1;
	int nr = 0;

	list_for_each_entry_safe(hem, temp_hem, head, sibling) {
		if (!(loop % RESCHED_LOOP_CNT_THRESHOLD_ON_4K))
			cond_resched();
		loop++;

		if (hem_list_page_is_in_range(hem, offset)) {
			nr = offset - hem->start;
			cpu_base = hem->addr + nr * BA_BYTE_LEN;
+1 −1
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ static int hns_roce_query_device(struct ib_device *ib_dev,
				  IB_DEVICE_RC_RNR_NAK_GEN;
	props->max_send_sge = hr_dev->caps.max_sq_sg;
	props->max_recv_sge = hr_dev->caps.max_rq_sg;
	props->max_sge_rd = 1;
	props->max_sge_rd = hr_dev->caps.max_sq_sg;
	props->max_cq = hr_dev->caps.num_cqs;
	props->max_cqe = hr_dev->caps.max_cqes;
	props->max_mr = hr_dev->caps.num_mtpts;
+11 −9
Original line number Diff line number Diff line
@@ -1017,12 +1017,14 @@ static int alloc_user_qp_db(struct hns_roce_dev *hr_dev,
			    struct hns_roce_ib_create_qp *ucmd,
			    struct hns_roce_ib_create_qp_resp *resp)
{
	bool has_sdb = user_qp_has_sdb(hr_dev, init_attr, udata, resp, ucmd);
	struct hns_roce_ucontext *uctx = rdma_udata_to_drv_context(udata,
		struct hns_roce_ucontext, ibucontext);
	bool has_rdb = user_qp_has_rdb(hr_dev, init_attr, udata, resp);
	struct ib_device *ibdev = &hr_dev->ib_dev;
	int ret;

	if (user_qp_has_sdb(hr_dev, init_attr, udata, resp, ucmd)) {
	if (has_sdb) {
		ret = hns_roce_db_map_user(uctx, ucmd->sdb_addr, &hr_qp->sdb);
		if (ret) {
			ibdev_err(ibdev,
@@ -1033,7 +1035,7 @@ static int alloc_user_qp_db(struct hns_roce_dev *hr_dev,
		hr_qp->en_flags |= HNS_ROCE_QP_CAP_SQ_RECORD_DB;
	}

	if (user_qp_has_rdb(hr_dev, init_attr, udata, resp)) {
	if (has_rdb) {
		ret = hns_roce_db_map_user(uctx, ucmd->db_addr, &hr_qp->rdb);
		if (ret) {
			ibdev_err(ibdev,
@@ -1047,7 +1049,7 @@ static int alloc_user_qp_db(struct hns_roce_dev *hr_dev,
	return 0;

err_sdb:
	if (hr_qp->en_flags & HNS_ROCE_QP_CAP_SQ_RECORD_DB)
	if (has_sdb)
		hns_roce_db_unmap_user(uctx, &hr_qp->sdb, false);
err_out:
	return ret;
@@ -1270,24 +1272,23 @@ static int set_qp_param(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp,
						 ibucontext);
		hr_qp->config = uctx->config;
		ret = set_user_sq_size(hr_dev, &init_attr->cap, hr_qp, ucmd);
		if (ret)
		if (ret) {
			ibdev_err(ibdev,
				  "failed to set user SQ size, ret = %d.\n",
				  ret);
			return ret;
		}

		ret = set_congest_param(hr_dev, hr_qp, ucmd);
		if (ret)
			return ret;
	} else {
		if (hr_dev->pci_dev->revision >= PCI_REVISION_ID_HIP09)
			hr_qp->config = HNS_ROCE_EXSGE_FLAGS;
		default_congest_type(hr_dev, hr_qp);
		ret = set_kernel_sq_size(hr_dev, &init_attr->cap, hr_qp);
		if (ret)
			ibdev_err(ibdev,
				  "failed to set kernel SQ size, ret = %d.\n",
				  ret);

		default_congest_type(hr_dev, hr_qp);
	}

	return ret;
@@ -1367,7 +1368,7 @@ static int hns_roce_create_qp_common(struct hns_roce_dev *hr_dev,
				       min(udata->outlen, sizeof(resp)));
		if (ret) {
			ibdev_err(ibdev, "copy qp resp failed!\n");
			goto err_store;
			goto err_flow_ctrl;
		}
	}

@@ -1780,6 +1781,7 @@ void hns_roce_cleanup_qp_table(struct hns_roce_dev *hr_dev)
	for (i = 0; i < HNS_ROCE_QP_BANK_NUM; i++)
		ida_destroy(&hr_dev->qp_table.bank[i].ida);
	xa_destroy(&hr_dev->qp_table.dip_xa);
	xa_destroy(&hr_dev->qp_table_xa);
	mutex_destroy(&hr_dev->qp_table.bank_mutex);
	mutex_destroy(&hr_dev->qp_table.scc_mutex);
}