--- old/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_ti.c	Sun Jun 11 17:03:59 2017
+++ new/usr/src/uts/common/io/ib/mgt/ibcm/ibcm_ti.c	Sun Jun 11 17:03:59 2017
@@ -40,8 +40,6 @@
 	void			*arg;
 } ibcm_taskq_recycle_arg_t;
 
-_NOTE(READ_ONLY_DATA(ibcm_taskq_recycle_arg_s))
-
 static ibt_status_t	ibcm_init_reply_addr(ibcm_hca_info_t *hcap,
     ibcm_mad_addr_t *reply_addr, ibt_chan_open_args_t *chan_args,
     ibt_chan_open_flags_t flags, ib_time_t *cm_pkt_lt, ib_lid_t prim_slid);
@@ -78,21 +76,7 @@
 		    ibcm_mad_addr_t *cm_reply_addr);
 #endif
 
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibcm_port_info_s::{port_ibmf_hdl}))
-
-/* access is controlled between ibcm_sm.c and ibcm_ti.c by CVs */
-_NOTE(SCHEME_PROTECTS_DATA("Serialized access by CV", {ibt_rc_returns_t
-    ibt_ud_returns_t ibt_ap_returns_t ibt_ar_t}))
-
 /*
- * Typically, clients initialize these args in one api call, and use in
- * another api
- */
-_NOTE(SCHEME_PROTECTS_DATA("Expected usage of ibtl api by client",
-    {ibt_path_info_s ibt_cep_path_s ibt_adds_vect_s ibt_mcg_info_s ib_gid_s
-    ibt_ud_dest_attr_s ibt_ud_dest_s ibt_srv_data_s ibt_redirect_info_s}))
-
-/*
  * ibt_open_rc_channel()
  *	ibt_open_rc_channel opens a communication channel on the specified
  *	channel to the specified service. For connection service type qp's
@@ -576,8 +560,6 @@
 	/* Once a resource created on hca, no need to hold the acc cnt */
 	ibcm_dec_hca_acc_cnt(hcap);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*statep))
-
 	statep->timerid = 0;
 	statep->local_hca_guid = hca_guid;
 	statep->local_qpn = local_qpn;
@@ -593,8 +575,6 @@
 	statep->stored_msg = ibmf_msg;
 	statep->dreq_msg = ibmf_msg_dreq;
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*req_msgp))
-
 	/* Start filling in the REQ MAD */
 	req_msgp = (ibcm_req_msg_t *)IBCM_OUT_MSGP(statep->stored_msg);
 	req_msgp->req_local_comm_id = h2b32(local_comid);
@@ -810,8 +790,6 @@
 	if ((len > 0) && chan_args->oc_priv_data)
 		bcopy(chan_args->oc_priv_data, req_msgp->req_private_data, len);
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*req_msgp))
-
 	/* return_data is filled up in the state machine code */
 	if (ret_args != NULL) {
 		statep->open_return_data = ret_args;
@@ -871,8 +849,6 @@
 	    h2b64(ibcm_generate_tranid(IBCM_INCOMING_REQ, statep->local_comid,
 	    0));
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*statep))
-
 	ibtl_cm_chan_is_opening(channel);
 
 	ibcm_open_enqueue(statep);
@@ -940,8 +916,6 @@
 
 	IBTF_DPRINTF_L5(cmlog, "ibcm_init_reply_addr:");
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*reply_addr))
-
 	/*
 	 * sending side CM lid/gid/port num are not based on any redirect
 	 * params. These values are set to primary RC path lid/gid/port num.
@@ -1106,8 +1080,6 @@
 	reply_addr->rcvd_addr.ia_service_level =
 	    cm_adds->av_srvl;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*reply_addr))
-
 	return (IBT_SUCCESS);
 }
 
@@ -1334,7 +1306,6 @@
 {
 	ibcm_hca_info_t		*hcap;
 
-	_NOTE(LOCK_RELEASED_AS_SIDE_EFFECT(&statep->state_mutex));
 	ASSERT(MUTEX_HELD(&statep->state_mutex));
 
 	IBTF_DPRINTF_L3(cmlog, "ibcm_close_rc_channel: chan 0x%p statep %p",
@@ -1653,8 +1624,6 @@
 	if (qp_attr.qp_info.qp_state != IBT_STATE_ERROR)
 		return (IBT_CHAN_STATE_INVALID);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ibcm_tq_recycle_arg))
-
 	ibcm_tq_recycle_arg = kmem_alloc(sizeof (ibcm_taskq_recycle_arg_t),
 	    KM_SLEEP);
 
@@ -1664,8 +1633,6 @@
 	ibcm_tq_recycle_arg->func		= func;
 	ibcm_tq_recycle_arg->arg		= arg;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*ibcm_tq_recycle_arg))
-
 	IBCM_GET_CHAN_PRIVATE(rc_chan, statep);
 
 	/*
@@ -1674,9 +1641,7 @@
 	 */
 	if ((func != NULL) && (statep != NULL)) {
 		IBCM_RELEASE_CHAN_PRIVATE(rc_chan);
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(statep->recycle_arg))
 		statep->recycle_arg = ibcm_tq_recycle_arg;
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(statep->recycle_arg))
 		return (IBT_SUCCESS);
 	}
 
@@ -1802,8 +1767,6 @@
 	ibt_ud_dest_t		*dest_hdl;
 } ibcm_local_handler_t;
 
-_NOTE(READ_ONLY_DATA(ibcm_local_handler_s))
-
 /*
  * Local UD CM Handler, used when ibt_alloc_ud_dest() is issued in
  * NON-Blocking mode.
@@ -1973,8 +1936,6 @@
 		return (retval);
 	}
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(sidr_entry))
-
 	/* Allocate a new request id */
 	if (ibcm_alloc_reqid(hcap, &sidr_entry.srch_req_id) == IBCM_FAILURE) {
 		IBTF_DPRINTF_L2(cmlog, "ibcm_ud_get_dqpn: "
@@ -2016,8 +1977,6 @@
 	sidr_entry.srch_grh_exists = attr->ud_addr->av_send_grh;
 	sidr_entry.srch_mode = IBCM_ACTIVE_MODE;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(sidr_entry))
-
 	/* do various allocations needed here */
 	rw_enter(&hcap->hca_sidr_list_lock, RW_WRITER);
 
@@ -2031,8 +1990,6 @@
 	/* After a resource created on hca, no need to hold the acc cnt */
 	ibcm_dec_hca_acc_cnt(hcap);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*ud_statep))
-
 	/* Initialize some ud_statep fields */
 	ud_statep->ud_stored_msg = ibmf_msg;
 	ud_statep->ud_svc_id = attr->ud_sid;
@@ -2085,8 +2042,6 @@
 	 */
 	ud_statep->ud_stored_reply_addr.rcvd_addr.ia_remote_qno = 1;
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*sidr_req_msgp))
-
 	/* Initialize the SIDR REQ message fields */
 	sidr_req_msgp =
 	    (ibcm_sidr_req_msg_t *)IBCM_OUT_MSGP(ud_statep->ud_stored_msg);
@@ -2116,9 +2071,6 @@
 	IBTF_DPRINTF_L4(cmlog, "ibcm_ud_get_dqpn: timer_value in HZ = %x",
 	    ud_statep->ud_timer_value);
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*ud_statep))
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*sidr_req_msgp))
-
 	ibcm_post_ud_mad(ud_statep, ud_statep->ud_stored_msg,
 	    ibcm_post_sidr_req_complete, ud_statep);
 
@@ -2213,14 +2165,10 @@
 		local_handler_priv =
 		    kmem_alloc(sizeof (*local_handler_priv), KM_SLEEP);
 
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*local_handler_priv))
-
 		local_handler_priv->actual_cm_handler = attr->ud_cm_handler;
 		local_handler_priv->actual_cm_private = attr->ud_cm_private;
 		local_handler_priv->dest_hdl = ud_destp;
 
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*local_handler_priv))
-
 		attr->ud_cm_handler = ibcm_local_cm_handler;
 		attr->ud_cm_private = local_handler_priv;
 	}
@@ -2345,8 +2293,6 @@
 		}
 	}
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mra_msgp))
-
 	mra_msgp = (ibcm_mra_msg_t *)IBCM_OUT_MSGP(statep->mra_msg);
 	mra_msgp->mra_local_comm_id = h2b32(statep->local_comid);
 	mra_msgp->mra_remote_comm_id = h2b32(statep->remote_comid);
@@ -2370,8 +2316,6 @@
 	IBCM_OUT_HDRP(statep->mra_msg)->AttributeID =
 	    h2b16(IBCM_INCOMING_MRA + IBCM_ATTR_BASE_ID);
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*mra_msgp))
-
 	mutex_enter(&statep->state_mutex);
 
 	if ((statep->mode == IBCM_ACTIVE_MODE) &&
@@ -2465,8 +2409,6 @@
 	    ibt_hdl, ibtl_cm_get_clnt_name(ibt_hdl), srv, (longlong_t)sid,
 	    num_sids);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*svcinfop))
-
 	*srv_hdl = NULL;
 
 	if (num_sids <= 0) {
@@ -2516,8 +2458,6 @@
 	IBTF_DPRINTF_L2(cmlog, "ibt_register_service: done (%p, %llX)",
 	    svcinfop, sid);
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*svcinfop))
-
 	return (IBT_SUCCESS);
 }
 
@@ -2629,12 +2569,8 @@
 			 * attributes are already filled-in.
 			 */
 
-			 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(srec->ServiceID))
-
 			srec->ServiceID = srv_resp->ServiceID;
 
-			 _NOTE(NOW_VISIBLE_TO_OTHER_THREADS(srec->ServiceID))
-
 			(void) ibcm_write_service_record(saa_handle, srec,
 			    IBMF_SAA_DELETE);
 		}
@@ -2697,8 +2633,6 @@
 	IBTF_DPRINTF_L2(cmlog, "ibt_bind_service: srv_hdl %p, gid (%llX:%llX)",
 	    srv_hdl, (longlong_t)gid.gid_prefix, (longlong_t)gid.gid_guid);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*sbindp))
-
 	/* Call ibtl_cm_get_hca_port to get the port number and the HCA GUID. */
 	if ((status = ibtl_cm_get_hca_port(gid, 0, &port)) != IBT_SUCCESS) {
 		IBTF_DPRINTF_L2(cmlog, "ibt_bind_service: "
@@ -2892,8 +2826,6 @@
 	if (sb_hdl_p != NULL)
 		*sb_hdl_p = sbindp;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*sbindp))
-
 	return (IBT_SUCCESS);
 }
 
@@ -3066,9 +2998,6 @@
 	IBTF_DPRINTF_L3(cmlog, "ibt_deregister_service: SID 0x%llX, numsids %d",
 	    srv_hdl->svc_id, srv_hdl->svc_num_sids);
 
-#ifdef __lock_lint
-	ibcm_svc_compare(NULL, NULL);
-#endif
 	svcp = avl_find(&ibcm_svc_avl_tree, &svc, NULL);
 	if (svcp != srv_hdl) {
 		mutex_exit(&ibcm_svc_info_lock);
@@ -4011,8 +3940,6 @@
 	statep->clnt_proceed = IBCM_FAIL;
 	mutex_exit(&statep->state_mutex);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*proceed_targs))
-
 	/* the state machine processing is done in a separate thread */
 
 	/* proceed_targs is freed in ibcm_proceed_via_taskq */
@@ -4029,8 +3956,6 @@
 	bcopy(cm_event_data, &proceed_targs->tst.rc.rc_cm_event_data,
 	    sizeof (ibt_cm_proceed_reply_t));
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*proceed_targs))
-
 	(void) taskq_dispatch(ibcm_taskq, ibcm_proceed_via_taskq,
 	    proceed_targs, TQ_SLEEP);
 
@@ -4176,8 +4101,6 @@
 	ud_statep->ud_clnt_proceed = IBCM_FAIL;
 	mutex_exit(&ud_statep->ud_state_mutex);
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*proceed_targs))
-
 	/* the state machine processing is done in a separate thread */
 
 	/* proceed_targs is freed in ibcm_proceed_via_taskq */
@@ -4202,8 +4125,6 @@
 		bcopy(redirect_infop, &proceed_targs->tst.ud.ud_redirect_info,
 		    sizeof (ibt_redirect_info_t));
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*proceed_targs))
-
 	(void) taskq_dispatch(ibcm_taskq, ibcm_ud_proceed_via_taskq,
 	    proceed_targs, TQ_SLEEP);
 
@@ -4444,8 +4365,6 @@
 	IBTF_DPRINTF_L5(cmlog, "ibt_set_alt_path:"
 	    " statep's mad addr = 0x%p", IBCM_OUT_HDRP(statep->lapr_msg));
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lap_msgp))
-
 	lap_msgp = (ibcm_lap_msg_t *)IBCM_OUT_MSGP(statep->lapr_msg);
 
 	lap_msgp->lap_alt_l_port_lid = h2b16(alternate_slid);
@@ -4497,15 +4416,11 @@
 	}
 
 	/* only rc_alt_pkt_lt and ap_return_data fields are initialized */
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*statep))
-
 	statep->rc_alt_pkt_lt = ibt_ib2usec(alt_path->ap_alt_pkt_lt);
 
 	/* return_data is filled up in the state machine code */
 	statep->ap_return_data = ret_args;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*statep))
-
 	IBCM_OUT_HDRP(statep->lapr_msg)->AttributeID =
 	    h2b16(IBCM_INCOMING_LAP + IBCM_ATTR_BASE_ID);
 
@@ -4515,8 +4430,6 @@
 	IBTF_DPRINTF_L3(cmlog, "ibt_set_alt_path: statep %p, tid %llx",
 	    statep, IBCM_OUT_HDRP(statep->lapr_msg)->TransactionID);
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*lap_msgp))
-
 	/* Send LAP */
 	ibcm_post_rc_mad(statep, statep->lapr_msg, ibcm_post_lap_complete,
 	    statep);
@@ -4667,9 +4580,6 @@
 
 ibcm_mcg_list_t	*ibcm_mcglist = NULL;
 
-_NOTE(MUTEX_PROTECTS_DATA(ibcm_mcglist_lock, ibcm_mcg_list_s))
-_NOTE(MUTEX_PROTECTS_DATA(ibcm_mcglist_lock, ibcm_mcglist))
-
 typedef struct ibcm_join_mcg_tqarg_s {
 	ib_gid_t		rgid;
 	ibt_mcg_attr_t		mcg_attr;
@@ -4678,8 +4588,6 @@
 	void			*arg;
 } ibcm_join_mcg_tqarg_t;
 
-_NOTE(READ_ONLY_DATA(ibcm_join_mcg_tqarg_s))
-
 void
 ibcm_add_incr_mcg_entry(sa_mcmember_record_t *mcg_req,
     sa_mcmember_record_t *mcg_resp)
@@ -4876,8 +4784,6 @@
 		return (IBT_INVALID_PARAM);
 	}
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*mcg_tq))
-
 	mcg_tq = kmem_alloc(sizeof (ibcm_join_mcg_tqarg_t), flag);
 	if (mcg_tq == NULL) {
 		IBTF_DPRINTF_L2(cmlog, "ibt_join_mcg: "
@@ -4891,8 +4797,6 @@
 	mcg_tq->func = func;
 	mcg_tq->arg = arg;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*mcg_tq))
-
 	if (func != NULL) {	/* Non-Blocking */
 		IBTF_DPRINTF_L3(cmlog, "ibt_join_mcg: Non-Blocking Call");
 		if (taskq_dispatch(ibcm_taskq, ibcm_process_async_join_mcg,
@@ -5829,9 +5733,6 @@
 
 				IBCM_DUMP_NODE_REC(nr_resp);
 
-				_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(
-				    *node_info_p))
-
 				node_info_p->n_sys_img_guid =
 				    nr_resp->NodeInfo.SystemImageGUID;
 				node_info_p->n_node_guid =
@@ -5853,9 +5754,6 @@
 				(void) strncpy(node_info_p->n_description,
 				    (char *)&nr_resp->NodeDescription, 64);
 
-				_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(
-				    *node_info_p))
-
 				/*
 				 * Deallocate the memory allocated by SA for
 				 * 'nr_resp'.
@@ -6027,9 +5925,6 @@
 
 				IBCM_DUMP_NODE_REC(nr_resp);
 
-				_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(
-				    *node_info_p))
-
 				node_info_p->n_sys_img_guid =
 				    nr_resp->NodeInfo.SystemImageGUID;
 				node_info_p->n_node_guid =
@@ -6051,9 +5946,6 @@
 				(void) strncpy(node_info_p->n_description,
 				    (char *)&nr_resp->NodeDescription, 64);
 
-				_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(
-				    *node_info_p))
-
 				/*
 				 * Deallocate the memory allocated by SA for
 				 * 'nr_resp'.
@@ -6572,9 +6464,7 @@
 				    (sattr->sip_zoneid != ipp->ip_zoneid))
 					continue;
 
-				_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*s_ip))
 				s_ip[j].ip_addr.family = ipp->ip_inet_family;
-				_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*s_ip))
 				if (s_ip[j].ip_addr.family == AF_INET) {
 					bcopy(&ipp->ip_cm_sin.sin_addr,
 					    &s_ip[j].ip_addr.un.ip4addr,
@@ -6684,9 +6574,6 @@
 	return (sid & IB_SID_IPADDR_PORTNUM_MASK);
 }
 
-_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibt_ip_cm_info_t))
-_NOTE(SCHEME_PROTECTS_DATA("Unshared data", ibcm_ip_pvtdata_t))
-
 ibt_status_t
 ibt_format_ip_private_data(ibt_ip_cm_info_t *ip_cm_info,
     ibt_priv_data_len_t priv_data_len, void *priv_data_p)
@@ -6776,77 +6663,4 @@
 	IBCM_PRINT_IP("ibt_get_ip_data: dst", &ip_cm_infop->dst_addr);
 
 	return (IBT_SUCCESS);
-}
-
-
-/* Routines for warlock */
-
-/* ARGSUSED */
-static void
-ibcm_dummy_mcg_handler(void *arg, ibt_status_t retval, ibt_mcg_info_t *minfo)
-{
-	ibcm_join_mcg_tqarg_t	dummy_mcg;
-
-	dummy_mcg.func = ibcm_dummy_mcg_handler;
-
-	IBTF_DPRINTF_L5(cmlog, "ibcm_dummy_mcg_handler: "
-	    "dummy_mcg.func %p", dummy_mcg.func);
-}
-
-
-/* ARGSUSED */
-static void
-ibcm_dummy_recycle_rc_handler(ibt_status_t retval, void *arg)
-{
-	ibcm_taskq_recycle_arg_t	dummy_rc_recycle;
-
-	dummy_rc_recycle.func = ibcm_dummy_recycle_rc_handler;
-
-	IBTF_DPRINTF_L5(cmlog, "ibcm_dummy_recycle_rc_handler: "
-	    "dummy_rc_recycle.func %p", dummy_rc_recycle.func);
-}
-
-
-/* ARGSUSED */
-static ibt_cm_status_t
-ibcm_dummy_ud_handler(void *priv, ibt_cm_ud_event_t *event,
-    ibt_cm_ud_return_args_t *ret_args,
-    void *priv_data, ibt_priv_data_len_t len)
-{
-	/*
-	 * Let warlock see that ibcm_local_handler_s::actual_cm_handler
-	 * points to this routine.
-	 */
-	ibcm_local_handler_t	p;
-	ibcm_ud_state_data_t	dummy_ud;
-
-	p.actual_cm_handler = ibcm_dummy_ud_handler;
-	dummy_ud.ud_cm_handler = ibcm_dummy_ud_handler;
-
-	IBTF_DPRINTF_L5(cmlog, "ibcm_dummy_ud_handler: p.actual_cm_handler %p"
-	    "dummy_ud.ud_cm_handler %p", p.actual_cm_handler,
-	    dummy_ud.ud_cm_handler);
-	/*
-	 * Call all routines that the client's callback routine could call.
-	 */
-
-	return (IBT_CM_ACCEPT);
-}
-
-/* ARGSUSED */
-static ibt_cm_status_t
-ibcm_dummy_rc_handler(void *priv, ibt_cm_event_t *event,
-    ibt_cm_return_args_t *ret_args, void *priv_data, ibt_priv_data_len_t len)
-{
-	ibcm_state_data_t	dummy_rc;
-
-	dummy_rc.cm_handler = ibcm_dummy_rc_handler;
-
-	IBTF_DPRINTF_L5(cmlog, "ibcm_dummy_rc_handler: "
-	    "dummy_ud.ud_cm_handler %p", dummy_rc.cm_handler);
-	/*
-	 * Call all routines that the client's callback routine could call.
-	 */
-
-	return (IBT_CM_ACCEPT);
 }
