@@ -99,7 +99,6 @@ btl_portals4_init_interface(void)
9999
100100 /* Create recv_idx portal table entry */
101101 ret = PtlPTAlloc (portals4_btl -> portals_ni_h ,
102- PTL_PT_ONLY_USE_ONCE |
103102 PTL_PT_ONLY_TRUNCATE ,
104103 portals4_btl -> recv_eq_h ,
105104 REQ_BTL_TABLE_ID ,
@@ -429,7 +428,7 @@ mca_btl_portals4_add_procs(struct mca_btl_base_module_t* btl_base,
429428 opal_bitmap_set_bit (reachable , i );
430429
431430 OPAL_OUTPUT_VERBOSE ((90 , opal_btl_base_framework .framework_output ,
432- "add_procs: rank=%x nid=%x pid=%x for NI %d\n " ,
431+ "add_procs: rank=%lx nid=%x pid=%x for NI %d" ,
433432 i ,
434433 btl_peer_data [i ]-> ptl_proc .phys .nid ,
435434 btl_peer_data [i ]-> ptl_proc .phys .pid ,
@@ -591,7 +590,7 @@ mca_btl_portals4_prepare_src(struct mca_btl_base_module_t* btl_base,
591590 ret = opal_convertor_pack (convertor , & iov , & iov_count , & max_data );
592591
593592 * size = max_data ;
594- if ( ret < 0 ) {
593+ if (ret < 0 ) {
595594 mca_btl_portals4_free (btl_base , (mca_btl_base_descriptor_t * ) frag );
596595 return NULL ;
597596 }
@@ -624,65 +623,75 @@ mca_btl_portals4_register_mem(mca_btl_base_module_t *btl_base,
624623 }
625624
626625 handle -> key = OPAL_THREAD_ADD64 (& (portals4_btl -> portals_rdma_key ), 1 );
626+ handle -> remote_offset = 0 ;
627627
628628 OPAL_OUTPUT_VERBOSE ((90 , opal_btl_base_framework .framework_output ,
629- "mca_btl_portals4_register_mem NI=%d base=%p size=%ld handle=%p key=%ld\n" ,
630- portals4_btl -> interface_num , base , size , (void * )handle , handle -> key ));
631-
632- if (MCA_BTL_FLAGS_PUT == flags ) {
633- /* create a match entry */
634- me .start = base ;
635- me .length = size ;
636- me .ct_handle = PTL_CT_NONE ;
637- me .min_free = 0 ;
638- me .uid = PTL_UID_ANY ;
639- me .options = PTL_ME_OP_GET | PTL_ME_USE_ONCE |
640- PTL_ME_EVENT_LINK_DISABLE |
641- PTL_ME_EVENT_COMM_DISABLE |
642- PTL_ME_EVENT_UNLINK_DISABLE ;
643-
644- if (mca_btl_portals4_component .use_logical ) {
645- me .match_id .rank = endpoint -> ptl_proc .rank ;
646- } else {
647- me .match_id .phys .nid = endpoint -> ptl_proc .phys .nid ;
648- me .match_id .phys .pid = endpoint -> ptl_proc .phys .pid ;
649- }
650- me .match_bits = handle -> key ;
651- me .ignore_bits = BTL_PORTALS4_PROTOCOL_MASK |
652- BTL_PORTALS4_CONTEXT_MASK |
653- BTL_PORTALS4_SOURCE_MASK ;
654- me .ignore_bits = 0 ;
629+ "mca_btl_portals4_register_mem NI=%d base=%p size=%ld handle=%p key=%ld flags=%d" ,
630+ portals4_btl -> interface_num , base , size , (void * )handle , handle -> key , flags ));
631+
632+ /* create a match entry */
633+ me .start = base ;
634+ me .length = size ;
635+ me .ct_handle = PTL_CT_NONE ;
636+ me .min_free = 0 ;
637+ me .uid = PTL_UID_ANY ;
638+ me .options = PTL_ME_OP_GET |
639+ PTL_ME_EVENT_LINK_DISABLE |
640+ PTL_ME_EVENT_COMM_DISABLE |
641+ PTL_ME_EVENT_UNLINK_DISABLE ;
642+
643+ if (mca_btl_portals4_component .use_logical ) {
644+ me .match_id .rank = endpoint -> ptl_proc .rank ;
645+ } else {
646+ me .match_id .phys .nid = endpoint -> ptl_proc .phys .nid ;
647+ me .match_id .phys .pid = endpoint -> ptl_proc .phys .pid ;
648+ }
649+ me .match_bits = handle -> key ;
650+ me .ignore_bits = BTL_PORTALS4_PROTOCOL_MASK |
651+ BTL_PORTALS4_CONTEXT_MASK |
652+ BTL_PORTALS4_SOURCE_MASK ;
653+ me .ignore_bits = 0 ;
655654
656- ret = PtlMEAppend (portals4_btl -> portals_ni_h ,
657- portals4_btl -> recv_idx ,
658- & me ,
659- PTL_PRIORITY_LIST ,
660- handle ,
661- & (handle -> me_h ));
662- if (PTL_OK != ret ) {
663- opal_output_verbose (1 , opal_btl_base_framework .framework_output ,
664- "%s:%d: PtlMEAppend failed: %d\n" ,
665- __FILE__ , __LINE__ , ret );
666- OPAL_THREAD_ADD32 (& portals4_btl -> portals_outstanding_ops , -1 );
667- return NULL ;
668- }
669- OPAL_OUTPUT_VERBOSE ((90 , opal_btl_base_framework .framework_output ,
670- "PtlMEAppend (mca_btl_portals4_register_mem) handle=%p, me_h=%d start=%p length=%ld rank=%x nid=%x pid=%x match_bits=%lx\n" ,
671- (void * )handle , handle -> me_h , me .start , me .length ,
672- me .match_id .rank , me .match_id .phys .nid , me .match_id .phys .pid , me .match_bits ));
655+ ret = PtlMEAppend (portals4_btl -> portals_ni_h ,
656+ portals4_btl -> recv_idx ,
657+ & me ,
658+ PTL_PRIORITY_LIST ,
659+ handle ,
660+ & (handle -> me_h ));
661+ if (PTL_OK != ret ) {
662+ opal_output_verbose (1 , opal_btl_base_framework .framework_output ,
663+ "%s:%d: PtlMEAppend failed: %d\n" ,
664+ __FILE__ , __LINE__ , ret );
665+ OPAL_THREAD_ADD32 (& portals4_btl -> portals_outstanding_ops , -1 );
666+ return NULL ;
673667 }
668+ OPAL_OUTPUT_VERBOSE ((90 , opal_btl_base_framework .framework_output ,
669+ "PtlMEAppend (mca_btl_portals4_register_mem) handle=%p, me_h=%d start=%p length=%ld rank=%x nid=%x pid=%x match_bits=%lx\n" ,
670+ (void * )handle , handle -> me_h , me .start , me .length ,
671+ me .match_id .rank , me .match_id .phys .nid , me .match_id .phys .pid , me .match_bits ));
674672 return handle ;
675673}
676674
677675int
678676mca_btl_portals4_deregister_mem (mca_btl_base_module_t * btl_base ,
679677 mca_btl_base_registration_handle_t * handle )
680678{
679+ int ret ;
681680 struct mca_btl_portals4_module_t * portals4_btl = (struct mca_btl_portals4_module_t * ) btl_base ;
682681
683682 OPAL_OUTPUT_VERBOSE ((90 , opal_btl_base_framework .framework_output ,
684- "mca_btl_portals4_deregister_mem NI=%d handle=%p key=%ld\n" ,
685- portals4_btl -> interface_num , (void * )handle , handle -> key ));
683+ "mca_btl_portals4_deregister_mem NI=%d handle=%p key=%ld me_h=%d\n" ,
684+ portals4_btl -> interface_num , (void * )handle , handle -> key , handle -> me_h ));
685+
686+ if (!PtlHandleIsEqual (handle -> me_h , PTL_INVALID_HANDLE )) {
687+ ret = PtlMEUnlink (handle -> me_h );
688+ if (PTL_OK != ret ) {
689+ opal_output_verbose (1 , opal_btl_base_framework .framework_output ,
690+ "%s:%d: PtlMEUnlink failed: %d\n" ,__FILE__ , __LINE__ , ret );
691+ return OPAL_ERROR ;
692+ }
693+ handle -> me_h = PTL_INVALID_HANDLE ;
694+ }
686695
687696 free (handle );
688697
0 commit comments