if device memory(DM) is not supported that the dm flow should be taken. the calltrace as follows: [ 101.064379] Unable to handle kernel paging request at virtual address 0001bc20 [ 101.071589] Mem abort info: [ 101.074370] ESR = 0x96000006 [ 101.077413] Exception class = DABT (current EL), IL = 32 bits [ 101.083321] SET = 0, FnV = 0 [ 101.086364] EA = 0, S1PTW = 0 [ 101.089494] Data abort info: [ 101.092364] ISV = 0, ISS = 0x00000006 [ 101.096189] CM = 0, WnR = 0 [ 101.099146] user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000cb2914c6 [ 101.105749] [000000000001bc20] pgd=00000023ce5ae003, pud=00000023ce058003, pmd=0000000000000000 [ 101.114439] Internal error: Oops: 96000006 [#1] PREEMPT SMP [ 101.119998] Modules linked in: hns_roce_hw_v2 hns_roce rdma_ucm rdma_cm iw_cm ib_uverbs ib_cm ib_core [ 101.129215] CPU: 2 PID: 1994 Comm: ib_send_bw Not tainted 4.17.0-rc1-00028-g87ef120-dirty #3 [ 101.137638] Hardware name: Huawei D06/D06, BIOS Hisilicon D06 UEFI Nemo 2.0 RC0 - B205 04/19/2018 [ 101.146496] pstate: 60400009 (nZCv daif +PAN -UAO) [ 101.151298] pc : ib_dereg_mr+0x12c/0x150 [ib_core] [ 101.156087] lr : ib_dereg_mr+0x124/0x150 [ib_core] [ 101.160863] sp : ffff000015153b70 [ 101.164165] x29: ffff000015153b70 x28: 0000000000000000 [ 101.169465] x27: 000000000000000d x26: ffff000000b3d000 [ 101.174764] x25: ffff8023cbd2ce80 x24: 000000000001bc08 [ 101.180063] x23: ffff000000af4a18 x22: ffff000000af4000 [ 101.185363] x21: ffff000000af1638 x20: ffff000000af1000 [ 101.190662] x19: 0000000000000000 x18: ffff00008924b567 [ 101.195961] x17: 0000ffff8c8636d0 x16: ffff000008229968 [ 101.201260] x15: 00000000fffffffe x14: 0000000000000004 [ 101.206559] x13: ffff00000924b575 x12: ffff00000924d990 [ 101.211858] x11: ffff0000090f1000 x10: 0000000005f5e0ff [ 101.217157] x9 : ffff000015153870 x8 : 3631202c726d5f67 [ 101.222456] x7 : 657265645f62695b x6 : 0000000000000293 [ 101.227756] x5 : 0000000000000000 x4 : 0000000000000000 [ 101.233055] x3 : ffffffffffffffff x2 : 000000000001bc20 [ 101.238354] x1 : 0000000000000000 x0 : 0000000000000019 [ 101.243654] Process ib_send_bw (pid: 1994, stack limit = 0x0000000053eb9878) [ 101.250688] Call trace: [ 101.253134] ib_dereg_mr+0x12c/0x150 [ib_core] [ 101.257572] uverbs_free_mr+0x30/0x40 [ib_uverbs] [ 101.262267] remove_commit_idr_uobject+0x24/0x58 [ib_uverbs] [ 101.267915] _rdma_remove_commit_uobject+0x2c/0xc0 [ib_uverbs] [ 101.273737] rdma_remove_commit_uobject+0x38/0x80 [ib_uverbs] [ 101.279473] ib_uverbs_dereg_mr+0xd4/0x138 [ib_uverbs] [ 101.284601] ib_uverbs_write+0x3b4/0x408 [ib_uverbs] [ 101.289554] __vfs_write+0x34/0x140 [ 101.293029] vfs_write+0xa4/0x1b0 [ 101.296331] ksys_write+0x5c/0xc8 [ 101.299633] sys_write+0xc/0x18 [ 101.302762] el0_svc_naked+0x30/0x34 [ 101.306324] Code: 5280cc02 95d95b1f 91006302 f9800051 (885f7c40) [ 101.312405] ---[ end trace a9e4d13346a1e97f ]--- Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> Tested-by: Lijun Ou <oulijun@xxxxxxxxxx> --- drivers/infiniband/core/uverbs_std_types_dm.c | 7 ++++++- drivers/infiniband/core/verbs.c | 3 --- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/core/uverbs_std_types_dm.c b/drivers/infiniband/core/uverbs_std_types_dm.c index 8b68157..b83ccbd 100644 --- a/drivers/infiniband/core/uverbs_std_types_dm.c +++ b/drivers/infiniband/core/uverbs_std_types_dm.c @@ -37,11 +37,16 @@ static int uverbs_free_dm(struct ib_uobject *uobject, enum rdma_remove_reason why) { struct ib_dm *dm = uobject->object; + int ret; if (why == RDMA_REMOVE_DESTROY && atomic_read(&dm->usecnt)) return -EBUSY; - return dm->device->dealloc_dm(dm); + ret = dm->device->dealloc_dm(dm); + if (!ret) + atomic_dec(&dm->usecnt); + + return ret; } static int UVERBS_HANDLER(UVERBS_METHOD_DM_ALLOC)(struct ib_device *ib_dev, diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 7eff3ae..50a3b20 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1616,15 +1616,12 @@ int ib_resize_cq(struct ib_cq *cq, int cqe) int ib_dereg_mr(struct ib_mr *mr) { struct ib_pd *pd = mr->pd; - struct ib_dm *dm = mr->dm; int ret; rdma_restrack_del(&mr->res); ret = mr->device->dereg_mr(mr); if (!ret) { atomic_dec(&pd->usecnt); - if (dm) - atomic_dec(&dm->usecnt); } return ret; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html