|
19 | 19 | * Copyright (c) 2009 IBM Corporation. All rights reserved.
|
20 | 20 | * Copyright (c) 2013-2015 Intel, Inc. All rights reserved
|
21 | 21 | * Copyright (c) 2013-2015 NVIDIA Corporation. All rights reserved.
|
22 |
| - * Copyright (c) 2014-2015 Research Organization for Information Science |
23 |
| - * and Technology (RIST). All rights reserved. |
| 22 | + * Copyright (c) 2014-2018 Research Organization for Information Science |
| 23 | + * and Technology (RIST). All rights reserved. |
24 | 24 | * Copyright (c) 2014 Bull SAS. All rights reserved
|
25 | 25 | * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
|
26 | 26 | * $COPYRIGHT$
|
@@ -1042,6 +1042,14 @@ int mca_btl_openib_add_procs(
|
1042 | 1042 | int btl_rank = 0;
|
1043 | 1043 | volatile mca_btl_base_endpoint_t* endpoint;
|
1044 | 1044 |
|
| 1045 | + |
| 1046 | + if (! openib_btl->allowed) { |
| 1047 | + opal_bitmap_clear_all_bits(reachable); |
| 1048 | + opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", |
| 1049 | + true, opal_process_info.nodename, |
| 1050 | + ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); |
| 1051 | + } |
| 1052 | + |
1045 | 1053 | btl_rank = get_openib_btl_params(openib_btl, &lcl_subnet_id_port_cnt);
|
1046 | 1054 | if( 0 > btl_rank ){
|
1047 | 1055 | return OPAL_ERR_NOT_FOUND;
|
@@ -1641,75 +1649,77 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl)
|
1641 | 1649 | return OPAL_SUCCESS;
|
1642 | 1650 | }
|
1643 | 1651 |
|
1644 |
| - /* Release all QPs */ |
1645 |
| - if (NULL != openib_btl->device->endpoints) { |
1646 |
| - for (ep_index=0; |
1647 |
| - ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); |
1648 |
| - ep_index++) { |
1649 |
| - endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, |
| 1652 | + if (openib_btl->allowed) { |
| 1653 | + /* Release all QPs */ |
| 1654 | + if (NULL != openib_btl->device->endpoints) { |
| 1655 | + for (ep_index=0; |
| 1656 | + ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); |
| 1657 | + ep_index++) { |
| 1658 | + endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, |
1650 | 1659 | ep_index);
|
1651 |
| - if(!endpoint) { |
1652 |
| - BTL_VERBOSE(("In finalize, got another null endpoint")); |
1653 |
| - continue; |
1654 |
| - } |
1655 |
| - if(endpoint->endpoint_btl != openib_btl) { |
1656 |
| - continue; |
1657 |
| - } |
1658 |
| - for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { |
1659 |
| - if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { |
1660 |
| - openib_btl->device->eager_rdma_buffers[i] = NULL; |
1661 |
| - OBJ_RELEASE(endpoint); |
| 1660 | + if(!endpoint) { |
| 1661 | + BTL_VERBOSE(("In finalize, got another null endpoint")); |
| 1662 | + continue; |
1662 | 1663 | }
|
| 1664 | + if(endpoint->endpoint_btl != openib_btl) { |
| 1665 | + continue; |
| 1666 | + } |
| 1667 | + for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { |
| 1668 | + if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { |
| 1669 | + openib_btl->device->eager_rdma_buffers[i] = NULL; |
| 1670 | + OBJ_RELEASE(endpoint); |
| 1671 | + } |
| 1672 | + } |
| 1673 | + opal_pointer_array_set_item(openib_btl->device->endpoints, |
| 1674 | + ep_index, NULL); |
| 1675 | + assert(((opal_object_t*)endpoint)->obj_reference_count == 1); |
| 1676 | + OBJ_RELEASE(endpoint); |
1663 | 1677 | }
|
1664 |
| - opal_pointer_array_set_item(openib_btl->device->endpoints, |
1665 |
| - ep_index, NULL); |
1666 |
| - assert(((opal_object_t*)endpoint)->obj_reference_count == 1); |
1667 |
| - OBJ_RELEASE(endpoint); |
1668 | 1678 | }
|
1669 |
| - } |
1670 |
| - |
1671 |
| - /* Release SRQ resources */ |
1672 |
| - for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { |
1673 |
| - if(!BTL_OPENIB_QP_TYPE_PP(qp)) { |
1674 |
| - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( |
1675 |
| - &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); |
1676 |
| - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( |
1677 |
| - &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); |
1678 |
| - if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { |
1679 |
| - opal_mutex_t *lock = |
1680 |
| - &mca_btl_openib_component.srq_manager.lock; |
1681 | 1679 |
|
1682 |
| - opal_hash_table_t *srq_addr_table = |
1683 |
| - &mca_btl_openib_component.srq_manager.srq_addr_table; |
1684 |
| - |
1685 |
| - opal_mutex_lock(lock); |
1686 |
| - if (OPAL_SUCCESS != |
1687 |
| - opal_hash_table_remove_value_ptr(srq_addr_table, |
1688 |
| - &openib_btl->qps[qp].u.srq_qp.srq, |
1689 |
| - sizeof(struct ibv_srq *))) { |
1690 |
| - BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); |
1691 |
| - rc = OPAL_ERROR; |
1692 |
| - } |
1693 |
| - opal_mutex_unlock(lock); |
1694 |
| - if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { |
1695 |
| - BTL_VERBOSE(("Failed to close SRQ %d", qp)); |
1696 |
| - rc = OPAL_ERROR; |
| 1680 | + /* Release SRQ resources */ |
| 1681 | + for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { |
| 1682 | + if(!BTL_OPENIB_QP_TYPE_PP(qp)) { |
| 1683 | + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( |
| 1684 | + &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); |
| 1685 | + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( |
| 1686 | + &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); |
| 1687 | + if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { |
| 1688 | + opal_mutex_t *lock = |
| 1689 | + &mca_btl_openib_component.srq_manager.lock; |
| 1690 | + |
| 1691 | + opal_hash_table_t *srq_addr_table = |
| 1692 | + &mca_btl_openib_component.srq_manager.srq_addr_table; |
| 1693 | + |
| 1694 | + opal_mutex_lock(lock); |
| 1695 | + if (OPAL_SUCCESS != |
| 1696 | + opal_hash_table_remove_value_ptr(srq_addr_table, |
| 1697 | + &openib_btl->qps[qp].u.srq_qp.srq, |
| 1698 | + sizeof(struct ibv_srq *))) { |
| 1699 | + BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); |
| 1700 | + rc = OPAL_ERROR; |
| 1701 | + } |
| 1702 | + opal_mutex_unlock(lock); |
| 1703 | + if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { |
| 1704 | + BTL_VERBOSE(("Failed to close SRQ %d", qp)); |
| 1705 | + rc = OPAL_ERROR; |
| 1706 | + } |
1697 | 1707 | }
|
1698 |
| - } |
1699 | 1708 |
|
1700 |
| - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); |
1701 |
| - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); |
| 1709 | + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); |
| 1710 | + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); |
| 1711 | + } |
1702 | 1712 | }
|
1703 |
| - } |
1704 | 1713 |
|
1705 |
| - /* Finalize the CPC modules on this openib module */ |
1706 |
| - for (i = 0; i < openib_btl->num_cpcs; ++i) { |
1707 |
| - if (NULL != openib_btl->cpcs[i]->cbm_finalize) { |
1708 |
| - openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); |
| 1714 | + /* Finalize the CPC modules on this openib module */ |
| 1715 | + for (i = 0; i < openib_btl->num_cpcs; ++i) { |
| 1716 | + if (NULL != openib_btl->cpcs[i]->cbm_finalize) { |
| 1717 | + openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); |
| 1718 | + } |
| 1719 | + free(openib_btl->cpcs[i]); |
1709 | 1720 | }
|
1710 |
| - free(openib_btl->cpcs[i]); |
| 1721 | + free(openib_btl->cpcs); |
1711 | 1722 | }
|
1712 |
| - free(openib_btl->cpcs); |
1713 | 1723 |
|
1714 | 1724 | /* Release device if there are no more users */
|
1715 | 1725 | if(!(--openib_btl->device->btls)) {
|
|
0 commit comments