Unverified Commit 013ea2f2 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8243 【OLK 5.10】RDMA/hns some bugfix

Merge Pull Request from: @huwentao0417 
 
| commitID     | commit message                                                      | 冲突   |
|--------------|---------------------------------------------------------------------|------|
| 349e85995228 | RDMA/hns: Modify the print level of CQE error                       | N/A  |
| 9a84848dcee2 | RDMA/hns: Add mutex_destroy()                                       | 冲突解决 |
| ee0454932834 | RDMA/hns: Fix GMV table pagesize                                    | 冲突解决 |
| dc3bda6e568e | RDMA/hns: Fix mismatch exception rollback                           | N/A  |
| a942ec2745ca | RDMA/hns: Fix UAF for cq async event                                | 冲突解决 |
| b46494b6f9c1 | RDMA/hns: Fix deadlock on SRQ async events.                         | 冲突解决 |
| 203b70fda634 | RDMA/hns: Fix return value in hns_roce_map_mr_sg                    | N/A  |
| 2ce384307f2d | RDMA/hns: Add max_ah and cq moderation capacities in query_device() | 冲突解决 | 
 
Link:https://gitee.com/openeuler/kernel/pulls/8243

 

Reviewed-by: default avatarChengchang Tang <tangchengchang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 5b53f32e 2df2c39a
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
		return ret;
	}

	ret = xa_err(xa_store(&cq_table->array, hr_cq->cqn, hr_cq, GFP_KERNEL));
	ret = xa_err(xa_store_irq(&cq_table->array, hr_cq->cqn, hr_cq, GFP_KERNEL));
	if (ret) {
		ibdev_err(ibdev, "failed to xa_store CQ, ret = %d.\n", ret);
		goto err_put;
@@ -163,7 +163,7 @@ static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
	return 0;

err_xa:
	xa_erase(&cq_table->array, hr_cq->cqn);
	xa_erase_irq(&cq_table->array, hr_cq->cqn);
err_put:
	hns_roce_table_put(hr_dev, &cq_table->table, hr_cq->cqn);

@@ -184,7 +184,7 @@ static void free_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
	if (ret == -EBUSY)
		hr_cq->delayed_destroy_flag = true;

	xa_erase(&cq_table->array, hr_cq->cqn);
	xa_erase_irq(&cq_table->array, hr_cq->cqn);

	/* Waiting interrupt process procedure carried out */
	synchronize_irq(hr_dev->eq_table.eq[hr_cq->vector].irq);
@@ -621,7 +621,16 @@ void hns_roce_cq_event(struct hns_roce_dev *hr_dev, u32 cqn, int event_type)
		return;
	}

	xa_lock(&hr_dev->cq_table.array);
	hr_cq = xa_load(&hr_dev->cq_table.array,
			cqn & (hr_dev->caps.num_cqs - 1));
	if (hr_cq)
		refcount_inc(&hr_cq->refcount);
	xa_unlock(&hr_dev->cq_table.array);
	if (!hr_cq) {
		dev_warn(dev, "async event for bogus CQ 0x%06x\n", cqn);
		return;
	}

	ibcq = &hr_cq->ib_cq;
	if (ibcq->event_handler) {
@@ -664,4 +673,5 @@ 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);
	mutex_destroy(&hr_dev->cq_table.bank_mutex);
}
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@
#define HNS_ROCE_MEM_BAR 2
#define CQ_BANKID_MASK GENMASK(1, 0)

#define HNS_ROCE_MAX_CQ_COUNT 0xFFFF
#define HNS_ROCE_MAX_CQ_PERIOD 0xFFFF

enum {
	SERV_TYPE_RC,
	SERV_TYPE_UC,
+3 −1
Original line number Diff line number Diff line
@@ -308,7 +308,7 @@ static struct hns_roce_hem *hns_roce_alloc_hem(struct hns_roce_dev *hr_dev,
	return hem;

fail:
	hns_roce_free_hem(hr_dev, hem);
	kfree(hem);
	return NULL;
}

@@ -934,6 +934,7 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,

	if (hns_roce_check_whether_mhop(hr_dev, table->type)) {
		hns_roce_cleanup_mhop_hem_table(hr_dev, table);
		mutex_destroy(&table->mutex);
		return;
	}

@@ -948,6 +949,7 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev,
			hns_roce_free_hem(hr_dev, table->hem[i]);
		}

	mutex_destroy(&table->mutex);
	kfree(table->hem);
}

+13 −7
Original line number Diff line number Diff line
@@ -2421,7 +2421,8 @@ static void apply_func_caps(struct hns_roce_dev *hr_dev)
		caps->gid_table_len[0] = min_t(u32, MAX_GID_TBL_LEN,
					 caps->gmv_bt_num *
					 (HNS_HW_PAGE_SIZE / caps->gmv_entry_sz));
		caps->gmv_entry_num = caps->gmv_bt_num * (PAGE_SIZE /

		caps->gmv_entry_num = caps->gmv_bt_num * (HNS_HW_PAGE_SIZE /
							  caps->gmv_entry_sz);
	} else {
		u32 func_num = max_t(u32, 1, hr_dev->func_num);
@@ -3069,6 +3070,8 @@ static void free_mr_exit(struct hns_roce_dev *hr_dev)

	free_mr_uninit_cq(hr_dev);
	free_mr_uninit_pd(hr_dev);

	mutex_destroy(&free_mr->mutex);
}

static int free_mr_alloc_res(struct hns_roce_dev *hr_dev)
@@ -3207,8 +3210,10 @@ static int free_mr_init(struct hns_roce_dev *hr_dev)
	mutex_init(&free_mr->mutex);

	ret = free_mr_alloc_res(hr_dev);
	if (ret)
	if (ret) {
		mutex_destroy(&free_mr->mutex);
		return ret;
	}

	ret = free_mr_modify_qp(hr_dev);
	if (ret)
@@ -4191,8 +4196,9 @@ static void get_cqe_status(struct hns_roce_dev *hr_dev, struct hns_roce_qp *qp,
		   wc->status == IB_WC_WR_FLUSH_ERR))
		return;

	ibdev_err(&hr_dev->ib_dev, "error cqe status 0x%x:\n", cqe_status);
	print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 4, cqe,
	ibdev_err_ratelimited(&hr_dev->ib_dev, "error cqe status 0x%x:\n",
			      cqe_status);
	print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_NONE, 16, 4, cqe,
		       cq->cqe_size, false);
	wc->vendor_err = hr_reg_read(cqe, CQE_SUB_STATUS);

@@ -6449,7 +6455,7 @@ static int hns_roce_v2_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period)
			dev_info(hr_dev->dev,
				 "cq_period(%u) reached the upper limit, adjusted to 65.\n",
				 cq_period);
			cq_period = HNS_ROCE_MAX_CQ_PERIOD;
			cq_period = HNS_ROCE_MAX_CQ_PERIOD_HIP08;
		}
		cq_period *= HNS_ROCE_CLOCK_ADJUST;
	}
+6 −6
Original line number Diff line number Diff line
@@ -1452,7 +1452,7 @@ struct fmea_ram_ecc {

/* only for RNR timeout issue of HIP08 */
#define HNS_ROCE_CLOCK_ADJUST 1000
#define HNS_ROCE_MAX_CQ_PERIOD	65
#define HNS_ROCE_MAX_CQ_PERIOD_HIP08 65
#define HNS_ROCE_MAX_EQ_PERIOD 65
#define HNS_ROCE_RNR_TIMER_10NS 1
#define HNS_ROCE_1US_CFG 999
Loading