Message ID | 20181014070445.4130-4-shamir.rabinovitch@oracle.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | convey ib_ucontext via ib_udata | expand |
Hi Shamir,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on rdma/for-next]
[also build test ERROR on v4.19-rc7 next-20181012]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Shamir-Rabinovitch/convey-ib_ucontext-via-ib_udata/20181015-021539
base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/infiniband//hw/hns/hns_roce_main.c: In function 'hns_roce_register_device':
>> drivers/infiniband//hw/hns/hns_roce_main.c:498:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
ib_dev->dealloc_pd = hns_roce_dealloc_pd;
^
cc1: some warnings being treated as errors
vim +498 drivers/infiniband//hw/hns/hns_roce_main.c
9a4435375 oulijun 2016-07-21 442
9a4435375 oulijun 2016-07-21 443 static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
9a4435375 oulijun 2016-07-21 444 {
9a4435375 oulijun 2016-07-21 445 int ret;
9a4435375 oulijun 2016-07-21 446 struct hns_roce_ib_iboe *iboe = NULL;
9a4435375 oulijun 2016-07-21 447 struct ib_device *ib_dev = NULL;
13ca970e3 Wei Hu(Xavier 2017-08-30 448) struct device *dev = hr_dev->dev;
9a4435375 oulijun 2016-07-21 449
9a4435375 oulijun 2016-07-21 450 iboe = &hr_dev->iboe;
49fdf6bb0 Lijun Ou 2016-09-20 451 spin_lock_init(&iboe->lock);
9a4435375 oulijun 2016-07-21 452
9a4435375 oulijun 2016-07-21 453 ib_dev = &hr_dev->ib_dev;
9a4435375 oulijun 2016-07-21 454
9a4435375 oulijun 2016-07-21 455 ib_dev->owner = THIS_MODULE;
9a4435375 oulijun 2016-07-21 456 ib_dev->node_type = RDMA_NODE_IB_CA;
fecd02eb2 Bart Van Assche 2017-01-20 457 ib_dev->dev.parent = dev;
9a4435375 oulijun 2016-07-21 458
9a4435375 oulijun 2016-07-21 459 ib_dev->phys_port_cnt = hr_dev->caps.num_ports;
9a4435375 oulijun 2016-07-21 460 ib_dev->local_dma_lkey = hr_dev->caps.reserved_lkey;
9a4435375 oulijun 2016-07-21 461 ib_dev->num_comp_vectors = hr_dev->caps.num_comp_vectors;
9a4435375 oulijun 2016-07-21 462 ib_dev->uverbs_abi_ver = 1;
9a4435375 oulijun 2016-07-21 463 ib_dev->uverbs_cmd_mask =
9a4435375 oulijun 2016-07-21 464 (1ULL << IB_USER_VERBS_CMD_GET_CONTEXT) |
9a4435375 oulijun 2016-07-21 465 (1ULL << IB_USER_VERBS_CMD_QUERY_DEVICE) |
9a4435375 oulijun 2016-07-21 466 (1ULL << IB_USER_VERBS_CMD_QUERY_PORT) |
9a4435375 oulijun 2016-07-21 467 (1ULL << IB_USER_VERBS_CMD_ALLOC_PD) |
9a4435375 oulijun 2016-07-21 468 (1ULL << IB_USER_VERBS_CMD_DEALLOC_PD) |
9a4435375 oulijun 2016-07-21 469 (1ULL << IB_USER_VERBS_CMD_REG_MR) |
9a4435375 oulijun 2016-07-21 470 (1ULL << IB_USER_VERBS_CMD_DEREG_MR) |
9a4435375 oulijun 2016-07-21 471 (1ULL << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
9a4435375 oulijun 2016-07-21 472 (1ULL << IB_USER_VERBS_CMD_CREATE_CQ) |
9a4435375 oulijun 2016-07-21 473 (1ULL << IB_USER_VERBS_CMD_DESTROY_CQ) |
9a4435375 oulijun 2016-07-21 474 (1ULL << IB_USER_VERBS_CMD_CREATE_QP) |
9a4435375 oulijun 2016-07-21 475 (1ULL << IB_USER_VERBS_CMD_MODIFY_QP) |
9a4435375 oulijun 2016-07-21 476 (1ULL << IB_USER_VERBS_CMD_QUERY_QP) |
9a4435375 oulijun 2016-07-21 477 (1ULL << IB_USER_VERBS_CMD_DESTROY_QP);
9a4435375 oulijun 2016-07-21 478
df0651079 Lijun Ou 2018-07-25 479 ib_dev->uverbs_ex_cmd_mask |=
df0651079 Lijun Ou 2018-07-25 480 (1ULL << IB_USER_VERBS_EX_CMD_MODIFY_CQ);
df0651079 Lijun Ou 2018-07-25 481
9a4435375 oulijun 2016-07-21 482 /* HCA||device||port */
9a4435375 oulijun 2016-07-21 483 ib_dev->modify_device = hns_roce_modify_device;
9a4435375 oulijun 2016-07-21 484 ib_dev->query_device = hns_roce_query_device;
9a4435375 oulijun 2016-07-21 485 ib_dev->query_port = hns_roce_query_port;
9a4435375 oulijun 2016-07-21 486 ib_dev->modify_port = hns_roce_modify_port;
9a4435375 oulijun 2016-07-21 487 ib_dev->get_link_layer = hns_roce_get_link_layer;
2eefca272 Lijun Ou 2016-09-15 488 ib_dev->get_netdev = hns_roce_get_netdev;
825474697 Shaobo Xu 2016-11-23 489 ib_dev->add_gid = hns_roce_add_gid;
825474697 Shaobo Xu 2016-11-23 490 ib_dev->del_gid = hns_roce_del_gid;
9a4435375 oulijun 2016-07-21 491 ib_dev->query_pkey = hns_roce_query_pkey;
9a4435375 oulijun 2016-07-21 492 ib_dev->alloc_ucontext = hns_roce_alloc_ucontext;
9a4435375 oulijun 2016-07-21 493 ib_dev->dealloc_ucontext = hns_roce_dealloc_ucontext;
9a4435375 oulijun 2016-07-21 494 ib_dev->mmap = hns_roce_mmap;
9a4435375 oulijun 2016-07-21 495
9a4435375 oulijun 2016-07-21 496 /* PD */
9a4435375 oulijun 2016-07-21 497 ib_dev->alloc_pd = hns_roce_alloc_pd;
9a4435375 oulijun 2016-07-21 @498 ib_dev->dealloc_pd = hns_roce_dealloc_pd;
9a4435375 oulijun 2016-07-21 499
9a4435375 oulijun 2016-07-21 500 /* AH */
9a4435375 oulijun 2016-07-21 501 ib_dev->create_ah = hns_roce_create_ah;
9a4435375 oulijun 2016-07-21 502 ib_dev->query_ah = hns_roce_query_ah;
9a4435375 oulijun 2016-07-21 503 ib_dev->destroy_ah = hns_roce_destroy_ah;
9a4435375 oulijun 2016-07-21 504
9a4435375 oulijun 2016-07-21 505 /* QP */
9a4435375 oulijun 2016-07-21 506 ib_dev->create_qp = hns_roce_create_qp;
9a4435375 oulijun 2016-07-21 507 ib_dev->modify_qp = hns_roce_modify_qp;
9a4435375 oulijun 2016-07-21 508 ib_dev->query_qp = hr_dev->hw->query_qp;
9a4435375 oulijun 2016-07-21 509 ib_dev->destroy_qp = hr_dev->hw->destroy_qp;
9a4435375 oulijun 2016-07-21 510 ib_dev->post_send = hr_dev->hw->post_send;
9a4435375 oulijun 2016-07-21 511 ib_dev->post_recv = hr_dev->hw->post_recv;
9a4435375 oulijun 2016-07-21 512
9a4435375 oulijun 2016-07-21 513 /* CQ */
9a4435375 oulijun 2016-07-21 514 ib_dev->create_cq = hns_roce_ib_create_cq;
b156269d8 oulijun 2017-10-19 515 ib_dev->modify_cq = hr_dev->hw->modify_cq;
9a4435375 oulijun 2016-07-21 516 ib_dev->destroy_cq = hns_roce_ib_destroy_cq;
9a4435375 oulijun 2016-07-21 517 ib_dev->req_notify_cq = hr_dev->hw->req_notify_cq;
9a4435375 oulijun 2016-07-21 518 ib_dev->poll_cq = hr_dev->hw->poll_cq;
9a4435375 oulijun 2016-07-21 519
9a4435375 oulijun 2016-07-21 520 /* MR */
9a4435375 oulijun 2016-07-21 521 ib_dev->get_dma_mr = hns_roce_get_dma_mr;
9a4435375 oulijun 2016-07-21 522 ib_dev->reg_user_mr = hns_roce_reg_user_mr;
9a4435375 oulijun 2016-07-21 523 ib_dev->dereg_mr = hns_roce_dereg_mr;
a2c80b7b4 Wei Hu(Xavier 2017-10-26 524) if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_REREG_MR) {
a2c80b7b4 Wei Hu(Xavier 2017-10-26 525) ib_dev->rereg_user_mr = hns_roce_rereg_user_mr;
a2c80b7b4 Wei Hu(Xavier 2017-10-26 526) ib_dev->uverbs_cmd_mask |= (1ULL << IB_USER_VERBS_CMD_REREG_MR);
a2c80b7b4 Wei Hu(Xavier 2017-10-26 527) }
9a4435375 oulijun 2016-07-21 528
c7c281914 Yixian Liu 2018-09-23 529 /* MW */
c7c281914 Yixian Liu 2018-09-23 530 if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_MW) {
c7c281914 Yixian Liu 2018-09-23 531 ib_dev->alloc_mw = hns_roce_alloc_mw;
c7c281914 Yixian Liu 2018-09-23 532 ib_dev->dealloc_mw = hns_roce_dealloc_mw;
c7c281914 Yixian Liu 2018-09-23 533 ib_dev->uverbs_cmd_mask |=
c7c281914 Yixian Liu 2018-09-23 534 (1ULL << IB_USER_VERBS_CMD_ALLOC_MW) |
c7c281914 Yixian Liu 2018-09-23 535 (1ULL << IB_USER_VERBS_CMD_DEALLOC_MW);
c7c281914 Yixian Liu 2018-09-23 536 }
c7c281914 Yixian Liu 2018-09-23 537
9a4435375 oulijun 2016-07-21 538 /* OTHERS */
9a4435375 oulijun 2016-07-21 539 ib_dev->get_port_immutable = hns_roce_port_immutable;
fedc3abe7 Wei Hu(Xavier 2018-05-28 540) ib_dev->disassociate_ucontext = hns_roce_disassociate_ucontext;
9a4435375 oulijun 2016-07-21 541
0ede73bc0 Matan Barak 2018-03-19 542 ib_dev->driver_id = RDMA_DRIVER_HNS;
e349f858d Jason Gunthorpe 2018-09-25 543 ret = ib_register_device(ib_dev, "hns_%d", NULL);
9a4435375 oulijun 2016-07-21 544 if (ret) {
9a4435375 oulijun 2016-07-21 545 dev_err(dev, "ib_register_device failed!\n");
9a4435375 oulijun 2016-07-21 546 return ret;
9a4435375 oulijun 2016-07-21 547 }
9a4435375 oulijun 2016-07-21 548
825474697 Shaobo Xu 2016-11-23 549 ret = hns_roce_setup_mtu_mac(hr_dev);
9a4435375 oulijun 2016-07-21 550 if (ret) {
825474697 Shaobo Xu 2016-11-23 551 dev_err(dev, "setup_mtu_mac failed!\n");
825474697 Shaobo Xu 2016-11-23 552 goto error_failed_setup_mtu_mac;
9a4435375 oulijun 2016-07-21 553 }
9a4435375 oulijun 2016-07-21 554
9a4435375 oulijun 2016-07-21 555 iboe->nb.notifier_call = hns_roce_netdev_event;
9a4435375 oulijun 2016-07-21 556 ret = register_netdevice_notifier(&iboe->nb);
9a4435375 oulijun 2016-07-21 557 if (ret) {
9a4435375 oulijun 2016-07-21 558 dev_err(dev, "register_netdevice_notifier failed!\n");
825474697 Shaobo Xu 2016-11-23 559 goto error_failed_setup_mtu_mac;
9a4435375 oulijun 2016-07-21 560 }
9a4435375 oulijun 2016-07-21 561
cb7a94c9c Wei Hu(Xavier 2018-05-28 562) hr_dev->active = true;
9a4435375 oulijun 2016-07-21 563 return 0;
9a4435375 oulijun 2016-07-21 564
825474697 Shaobo Xu 2016-11-23 565 error_failed_setup_mtu_mac:
9a4435375 oulijun 2016-07-21 566 ib_unregister_device(ib_dev);
9a4435375 oulijun 2016-07-21 567
9a4435375 oulijun 2016-07-21 568 return ret;
9a4435375 oulijun 2016-07-21 569 }
9a4435375 oulijun 2016-07-21 570
:::::: The code at line 498 was first introduced by commit
:::::: 9a4435375cd151e07c0c38fa601b00115986091b IB/hns: Add driver files for hns RoCE driver
:::::: TO: oulijun <oulijun@huawei.com>
:::::: CC: Doug Ledford <dledford@redhat.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Shamir, Thank you for the patch! Yet something to improve: [auto build test ERROR on rdma/for-next] [also build test ERROR on v4.19-rc8 next-20181016] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Shamir-Rabinovitch/convey-ib_ucontext-via-ib_udata/20181015-021539 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next config: i386-randconfig-j2-10140915 (attached as .config) compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/infiniband/core/verbs.c: In function 'ib_dealloc_pd': >> drivers/infiniband/core/verbs.c:340:2: error: implicit declaration of function 'rdma_is_user_pd' [-Werror=implicit-function-declaration] WARN_ON(rdma_is_user_pd(pd)); ^ cc1: some warnings being treated as errors vim +/rdma_is_user_pd +340 drivers/infiniband/core/verbs.c 327 328 /** 329 * ib_dealloc_pd - Deallocates a protection domain. 330 * @pd: The protection domain to deallocate. 331 * 332 * It is an error to call this function while any resources in the pd still 333 * exist. The caller is responsible to synchronously destroy them and 334 * guarantee no new allocations will happen. 335 * 336 * NOTE: Never call this function from uverbs! 337 */ 338 void ib_dealloc_pd(struct ib_pd *pd) 339 { > 340 WARN_ON(rdma_is_user_pd(pd)); 341 ib_dealloc_pd_user(pd, NULL); 342 } 343 EXPORT_SYMBOL(ib_dealloc_pd); 344 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index cfe35ba0b619..ef72b535de97 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c @@ -389,7 +389,7 @@ ssize_t ib_uverbs_alloc_pd(struct ib_uverbs_file *file, return uobj_alloc_commit(uobj, in_len); err_copy: - ib_dealloc_pd(pd); + ib_dealloc_pd_user(pd, &udata); err: uobj_alloc_abort(uobj); diff --git a/drivers/infiniband/core/uverbs_std_types.c b/drivers/infiniband/core/uverbs_std_types.c index 203cc96ac6f5..00338551778c 100644 --- a/drivers/infiniband/core/uverbs_std_types.c +++ b/drivers/infiniband/core/uverbs_std_types.c @@ -181,13 +181,17 @@ static int uverbs_free_pd(struct ib_uobject *uobject, enum rdma_remove_reason why) { struct ib_pd *pd = uobject->object; + struct ib_udata udata = {0}; int ret; ret = ib_destroy_usecnt(&pd->usecnt, why, uobject); if (ret) return ret; - ib_dealloc_pd((struct ib_pd *)uobject->object); + ib_uverbs_init_udata_buf_or_null(&udata, NULL, NULL, 0, 0, + uobject->context); + + ib_dealloc_pd_user((struct ib_pd *)uobject->object, &udata); return 0; } diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 02788950b9d5..93f11eab67b3 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -295,14 +295,15 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags, EXPORT_SYMBOL(__ib_alloc_pd); /** - * ib_dealloc_pd - Deallocates a protection domain. + * ib_dealloc_pd_user - Deallocates a protection domain. * @pd: The protection domain to deallocate. + * @udata: User data (if any) * * It is an error to call this function while any resources in the pd still * exist. The caller is responsible to synchronously destroy them and * guarantee no new allocations will happen. */ -void ib_dealloc_pd(struct ib_pd *pd) +void ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata) { int ret; @@ -319,9 +320,26 @@ void ib_dealloc_pd(struct ib_pd *pd) rdma_restrack_del(&pd->res); /* Making delalloc_pd a void return is a WIP, no driver should return an error here. */ - ret = pd->device->dealloc_pd(pd); + ret = pd->device->dealloc_pd(pd, udata); WARN_ONCE(ret, "Infiniband HW driver failed dealloc_pd"); } +EXPORT_SYMBOL(ib_dealloc_pd_user); + +/** + * ib_dealloc_pd - Deallocates a protection domain. + * @pd: The protection domain to deallocate. + * + * It is an error to call this function while any resources in the pd still + * exist. The caller is responsible to synchronously destroy them and + * guarantee no new allocations will happen. + * + * NOTE: Never call this function from uverbs! + */ +void ib_dealloc_pd(struct ib_pd *pd) +{ + WARN_ON(rdma_is_user_pd(pd)); + ib_dealloc_pd_user(pd, NULL); +} EXPORT_SYMBOL(ib_dealloc_pd); /* Address handles */ diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index d9778c794494..4f6b9a9b1216 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -563,7 +563,7 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) } /* Protection Domains */ -int bnxt_re_dealloc_pd(struct ib_pd *ib_pd) +int bnxt_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata) { struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd); struct bnxt_re_dev *rdev = pd->rdev; diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.h b/drivers/infiniband/hw/bnxt_re/ib_verbs.h index aa33e7b82c84..a8fd5703cc58 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.h +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.h @@ -166,7 +166,7 @@ enum rdma_link_layer bnxt_re_get_link_layer(struct ib_device *ibdev, struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev, struct ib_ucontext *context, struct ib_udata *udata); -int bnxt_re_dealloc_pd(struct ib_pd *pd); +int bnxt_re_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata); struct ib_ah *bnxt_re_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr, struct ib_udata *udata); diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index 39530cc15f95..793643b6b571 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c @@ -370,7 +370,7 @@ static int iwch_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) return ret; } -static int iwch_deallocate_pd(struct ib_pd *pd) +static int iwch_deallocate_pd(struct ib_pd *pd, struct ib_udata *udata) { struct iwch_dev *rhp; struct iwch_pd *php; @@ -407,7 +407,7 @@ static struct ib_pd *iwch_allocate_pd(struct ib_device *ibdev, struct iwch_alloc_pd_resp resp = {.pdid = php->pdid}; if (ib_copy_to_udata(udata, &resp, sizeof(resp))) { - iwch_deallocate_pd(&php->ibpd); + iwch_deallocate_pd(&php->ibpd, udata); return ERR_PTR(-EFAULT); } } diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c index 416f8d1af610..347a8428ef69 100644 --- a/drivers/infiniband/hw/cxgb4/provider.c +++ b/drivers/infiniband/hw/cxgb4/provider.c @@ -209,7 +209,7 @@ static int c4iw_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) return ret; } -static int c4iw_deallocate_pd(struct ib_pd *pd) +static int c4iw_deallocate_pd(struct ib_pd *pd, struct ib_udata *udata) { struct c4iw_dev *rhp; struct c4iw_pd *php; @@ -249,7 +249,7 @@ static struct ib_pd *c4iw_allocate_pd(struct ib_device *ibdev, struct c4iw_alloc_pd_resp uresp = {.pdid = php->pdid}; if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) { - c4iw_deallocate_pd(&php->ibpd); + c4iw_deallocate_pd(&php->ibpd, udata); return ERR_PTR(-EFAULT); } } diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c index dd1c3c0c6353..c0d8ba640b89 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c @@ -373,7 +373,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev, * i40iw_dealloc_pd - deallocate pd * @ibpd: ptr of pd to be deallocated */ -static int i40iw_dealloc_pd(struct ib_pd *ibpd) +static int i40iw_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) { struct i40iw_pd *iwpd = to_iwpd(ibpd); struct i40iw_device *iwdev = to_iwdev(ibpd->device); diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index fa5d20eccc21..3c432a50bfe6 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c @@ -1210,7 +1210,7 @@ static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev, return &pd->ibpd; } -static int mlx4_ib_dealloc_pd(struct ib_pd *pd) +static int mlx4_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) { mlx4_pd_free(to_mdev(pd->device)->dev, to_mpd(pd)->pdn); kfree(pd); diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index b3294a7e3ff9..09a298a5043f 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -2284,7 +2284,7 @@ static struct ib_pd *mlx5_ib_alloc_pd(struct ib_device *ibdev, return &pd->ibpd; } -static int mlx5_ib_dealloc_pd(struct ib_pd *pd) +static int mlx5_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) { struct mlx5_ib_dev *mdev = to_mdev(pd->device); struct mlx5_ib_pd *mpd = to_mpd(pd); @@ -4665,7 +4665,7 @@ static int create_dev_resources(struct mlx5_ib_resources *devr) error2: mlx5_ib_destroy_cq(devr->c0); error1: - mlx5_ib_dealloc_pd(devr->p0); + mlx5_ib_dealloc_pd(devr->p0, NULL); error0: return ret; } @@ -4681,7 +4681,7 @@ static void destroy_dev_resources(struct mlx5_ib_resources *devr) mlx5_ib_dealloc_xrcd(devr->x0); mlx5_ib_dealloc_xrcd(devr->x1); mlx5_ib_destroy_cq(devr->c0); - mlx5_ib_dealloc_pd(devr->p0); + mlx5_ib_dealloc_pd(devr->p0, NULL); /* Make sure no change P_Key work items are still executing */ for (port = 0; port < dev->num_ports; ++port) diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 124bf9e7c981..9763484716b5 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -402,7 +402,7 @@ static struct ib_pd *mthca_alloc_pd(struct ib_device *ibdev, return &pd->ibpd; } -static int mthca_dealloc_pd(struct ib_pd *pd) +static int mthca_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) { mthca_pd_free(to_mdev(pd->device), to_mpd(pd)); kfree(pd); diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index daae1b528520..8487aeaec462 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -725,7 +725,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev, /** * nes_dealloc_pd */ -static int nes_dealloc_pd(struct ib_pd *ibpd) +static int nes_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) { struct nes_ucontext *nesucontext; struct nes_pd *nespd = to_nespd(ibpd); diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index d70ebd14df87..d23fb6e6b32b 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -714,7 +714,7 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev, return ERR_PTR(status); } -int ocrdma_dealloc_pd(struct ib_pd *ibpd) +int ocrdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) { struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device); diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h index b69cfdce7970..36e89f373dd4 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h @@ -72,7 +72,7 @@ int ocrdma_mmap(struct ib_ucontext *, struct vm_area_struct *vma); struct ib_pd *ocrdma_alloc_pd(struct ib_device *, struct ib_ucontext *, struct ib_udata *); -int ocrdma_dealloc_pd(struct ib_pd *pd); +int ocrdma_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata); struct ib_cq *ocrdma_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c index cf4785a5a844..3a163f36939e 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -511,7 +511,7 @@ struct ib_pd *qedr_alloc_pd(struct ib_device *ibdev, return ERR_PTR(rc); } -int qedr_dealloc_pd(struct ib_pd *ibpd) +int qedr_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) { struct qedr_dev *dev = get_qedr_dev(ibpd->device); struct qedr_pd *pd = get_qedr_pd(ibpd); diff --git a/drivers/infiniband/hw/qedr/verbs.h b/drivers/infiniband/hw/qedr/verbs.h index 0b7d0124b16c..9c5055e3e013 100644 --- a/drivers/infiniband/hw/qedr/verbs.h +++ b/drivers/infiniband/hw/qedr/verbs.h @@ -49,7 +49,7 @@ int qedr_dealloc_ucontext(struct ib_ucontext *); int qedr_mmap(struct ib_ucontext *, struct vm_area_struct *vma); struct ib_pd *qedr_alloc_pd(struct ib_device *, struct ib_ucontext *, struct ib_udata *); -int qedr_dealloc_pd(struct ib_pd *pd); +int qedr_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata); struct ib_cq *qedr_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index 0b91ff36768a..67343791e054 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -477,7 +477,7 @@ struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev, return &pd->ibpd; } -int usnic_ib_dealloc_pd(struct ib_pd *pd) +int usnic_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) { usnic_info("freeing domain 0x%p\n", pd); diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h index 2a2c9beb715f..0e5de8876c50 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.h +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.h @@ -54,7 +54,7 @@ int usnic_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, struct ib_pd *usnic_ib_alloc_pd(struct ib_device *ibdev, struct ib_ucontext *context, struct ib_udata *udata); -int usnic_ib_dealloc_pd(struct ib_pd *pd); +int usnic_ib_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata); struct ib_qp *usnic_ib_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *init_attr, struct ib_udata *udata); diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c index b65d10b0a875..8a4c713b4968 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c @@ -484,7 +484,7 @@ struct ib_pd *pvrdma_alloc_pd(struct ib_device *ibdev, if (ib_copy_to_udata(udata, &pd_resp, sizeof(pd_resp))) { dev_warn(&dev->pdev->dev, "failed to copy back protection domain\n"); - pvrdma_dealloc_pd(&pd->ibpd); + pvrdma_dealloc_pd(&pd->ibpd, udata); return ERR_PTR(-EFAULT); } } @@ -505,7 +505,7 @@ struct ib_pd *pvrdma_alloc_pd(struct ib_device *ibdev, * * @return: 0 on success, otherwise errno. */ -int pvrdma_dealloc_pd(struct ib_pd *pd) +int pvrdma_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata) { struct pvrdma_dev *dev = to_vdev(pd->device); union pvrdma_cmd_req req; diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h index b2e3ab50cb08..b674714d51b4 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h @@ -402,7 +402,7 @@ int pvrdma_dealloc_ucontext(struct ib_ucontext *context); struct ib_pd *pvrdma_alloc_pd(struct ib_device *ibdev, struct ib_ucontext *context, struct ib_udata *udata); -int pvrdma_dealloc_pd(struct ib_pd *ibpd); +int pvrdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata); struct ib_mr *pvrdma_get_dma_mr(struct ib_pd *pd, int acc); struct ib_mr *pvrdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt_addr, int access_flags, diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c index e4da5b671e4a..8f2d9d0d1f9f 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -214,7 +214,7 @@ static struct ib_pd *rxe_alloc_pd(struct ib_device *dev, return pd ? &pd->ibpd : ERR_PTR(-ENOMEM); } -static int rxe_dealloc_pd(struct ib_pd *ibpd) +static int rxe_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) { struct rxe_pd *pd = to_rpd(ibpd); diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 46fe51d0c6d1..11804f63fb8f 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2393,7 +2393,8 @@ struct ib_device { struct ib_pd * (*alloc_pd)(struct ib_device *device, struct ib_ucontext *context, struct ib_udata *udata); - int (*dealloc_pd)(struct ib_pd *pd); + int (*dealloc_pd)(struct ib_pd *pd, + struct ib_udata *udata); struct ib_ah * (*create_ah)(struct ib_pd *pd, struct rdma_ah_attr *ah_attr, struct ib_udata *udata); @@ -3183,6 +3184,7 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags, const char *caller); #define ib_alloc_pd(device, flags) \ __ib_alloc_pd((device), (flags), KBUILD_MODNAME) +void ib_dealloc_pd_user(struct ib_pd *pd, struct ib_udata *udata); void ib_dealloc_pd(struct ib_pd *pd); /**
Prepare the code for shared ib_x model. Some flows in the code that involve dealloc_pd verb rely on ucontext from the ib_pd. Future patch will remove the information from ib_pd. Convey the ib_ucontext via ib_udata. Signed-off-by: Shamir Rabinovitch <shamir.rabinovitch@oracle.com> --- drivers/infiniband/core/uverbs_cmd.c | 2 +- drivers/infiniband/core/uverbs_std_types.c | 6 ++++- drivers/infiniband/core/verbs.c | 24 ++++++++++++++++--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 2 +- drivers/infiniband/hw/cxgb3/iwch_provider.c | 4 ++-- drivers/infiniband/hw/cxgb4/provider.c | 4 ++-- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/infiniband/hw/mlx5/main.c | 6 ++--- drivers/infiniband/hw/mthca/mthca_provider.c | 2 +- drivers/infiniband/hw/nes/nes_verbs.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 2 +- drivers/infiniband/hw/ocrdma/ocrdma_verbs.h | 2 +- drivers/infiniband/hw/qedr/verbs.c | 2 +- drivers/infiniband/hw/qedr/verbs.h | 2 +- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 2 +- drivers/infiniband/hw/usnic/usnic_ib_verbs.h | 2 +- .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 4 ++-- .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- include/rdma/ib_verbs.h | 4 +++- 22 files changed, 53 insertions(+), 29 deletions(-)