--- old/usr/src/uts/common/io/ib/clients/ibd/ibd.c	Sun Jun 11 17:03:43 2017
+++ new/usr/src/uts/common/io/ib/clients/ibd/ibd.c	Sun Jun 11 17:03:43 2017
@@ -619,365 +619,6 @@
 	va_end(ap);
 }
 
-/*
- * Warlock directives
- */
-
-/*
- * id_lso_lock
- *
- * state->id_lso->bkt_nfree may be accessed without a lock to
- * determine the threshold at which we have to ask the nw layer
- * to resume transmission (see ibd_resume_transmission()).
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_lso_lock,
-    ibd_state_t::id_lso))
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibd_state_t::id_lso))
-_NOTE(SCHEME_PROTECTS_DATA("init", ibd_state_t::id_lso_policy))
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibd_lsobkt_t::bkt_nfree))
-
-/*
- * id_scq_poll_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_scq_poll_lock,
-    ibd_state_t::id_scq_poll_busy))
-
-/*
- * id_txpost_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_txpost_lock,
-    ibd_state_t::id_tx_head))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_txpost_lock,
-    ibd_state_t::id_tx_busy))
-
-/*
- * id_acache_req_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_acache_req_lock, 
-    ibd_state_t::id_acache_req_cv))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_acache_req_lock, 
-    ibd_state_t::id_req_list))
-_NOTE(SCHEME_PROTECTS_DATA("atomic",
-    ibd_acache_s::ac_ref))
-
-/*
- * id_ac_mutex
- *
- * This mutex is actually supposed to protect id_ah_op as well,
- * but this path of the code isn't clean (see update of id_ah_op
- * in ibd_async_acache(), immediately after the call to
- * ibd_async_mcache()). For now, we'll skip this check by
- * declaring that id_ah_op is protected by some internal scheme
- * that warlock isn't aware of.
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_ac_mutex,
-    ibd_state_t::id_ah_active))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_ac_mutex,
-    ibd_state_t::id_ah_free))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_ac_mutex,
-    ibd_state_t::id_ah_addr))
-_NOTE(SCHEME_PROTECTS_DATA("ac mutex should protect this",
-    ibd_state_t::id_ah_op))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_ac_mutex,
-    ibd_state_t::id_ah_error))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_ac_mutex,
-    ibd_state_t::id_ac_hot_ace))
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibd_state_t::id_ah_error))
-
-/*
- * id_mc_mutex
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_mc_mutex,
-    ibd_state_t::id_mc_full))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_mc_mutex,
-    ibd_state_t::id_mc_non))
-
-/*
- * id_trap_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_trap_lock,
-    ibd_state_t::id_trap_cv))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_trap_lock,
-    ibd_state_t::id_trap_stop))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_trap_lock,
-    ibd_state_t::id_trap_inprog))
-
-/*
- * id_prom_op
- */
-_NOTE(SCHEME_PROTECTS_DATA("only by async thread",
-    ibd_state_t::id_prom_op))
-
-/*
- * id_sched_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_sched_lock,
-    ibd_state_t::id_sched_needed))
-
-/*
- * id_link_mutex
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_link_mutex, 
-    ibd_state_t::id_link_state))
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibd_state_t::id_link_state))
-_NOTE(SCHEME_PROTECTS_DATA("only async thr and ibd_m_start",
-    ibd_state_t::id_link_speed))
-_NOTE(DATA_READABLE_WITHOUT_LOCK(ibd_state_t::id_sgid))
-
-/*
- * id_tx_list.dl_mutex
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_tx_list.dl_mutex,
-    ibd_state_t::id_tx_list.dl_head))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_tx_list.dl_mutex,
-    ibd_state_t::id_tx_list.dl_pending_sends))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::id_tx_list.dl_mutex,
-    ibd_state_t::id_tx_list.dl_cnt))
-
-/*
- * id_rx_list.dl_mutex
- */
-_NOTE(SCHEME_PROTECTS_DATA("atomic or dl mutex or single thr",
-    ibd_state_t::id_rx_list.dl_bufs_outstanding))
-_NOTE(SCHEME_PROTECTS_DATA("atomic or dl mutex or single thr",
-    ibd_state_t::id_rx_list.dl_cnt))
-
-/*
- * rc_timeout_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::rc_timeout_lock,
-    ibd_state_t::rc_timeout_start))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_t::rc_timeout_lock,
-    ibd_state_t::rc_timeout))
-
-
-/*
- * Items protected by atomic updates
- */
-_NOTE(SCHEME_PROTECTS_DATA("atomic update only",
-    ibd_state_s::id_brd_rcv
-    ibd_state_s::id_brd_xmt
-    ibd_state_s::id_multi_rcv
-    ibd_state_s::id_multi_xmt
-    ibd_state_s::id_num_intrs
-    ibd_state_s::id_rcv_bytes
-    ibd_state_s::id_rcv_pkt
-    ibd_state_s::id_rx_post_queue_index
-    ibd_state_s::id_tx_short
-    ibd_state_s::id_xmt_bytes
-    ibd_state_s::id_xmt_pkt
-    ibd_state_s::rc_rcv_trans_byte
-    ibd_state_s::rc_rcv_trans_pkt
-    ibd_state_s::rc_rcv_copy_byte
-    ibd_state_s::rc_rcv_copy_pkt
-    ibd_state_s::rc_xmt_bytes
-    ibd_state_s::rc_xmt_small_pkt
-    ibd_state_s::rc_xmt_fragmented_pkt
-    ibd_state_s::rc_xmt_map_fail_pkt
-    ibd_state_s::rc_xmt_map_succ_pkt
-    ibd_rc_chan_s::rcq_invoking))
-
-/*
- * Non-mutex protection schemes for data elements. Almost all of
- * these are non-shared items.
- */
-_NOTE(SCHEME_PROTECTS_DATA("unshared or single-threaded",
-    callb_cpr
-    ib_gid_s
-    ib_header_info
-    ibd_acache_rq
-    ibd_acache_s::ac_mce
-    ibd_acache_s::ac_chan
-    ibd_mcache::mc_fullreap
-    ibd_mcache::mc_jstate
-    ibd_mcache::mc_req
-    ibd_rwqe_s
-    ibd_swqe_s
-    ibd_wqe_s
-    ibt_wr_ds_s::ds_va
-    ibt_wr_lso_s
-    ipoib_mac::ipoib_qpn
-    mac_capab_lso_s
-    msgb::b_next
-    msgb::b_cont
-    msgb::b_rptr
-    msgb::b_wptr
-    ibd_state_s::id_bgroup_created
-    ibd_state_s::id_mac_state
-    ibd_state_s::id_mtu
-    ibd_state_s::id_ud_num_rwqe
-    ibd_state_s::id_ud_num_swqe
-    ibd_state_s::id_qpnum
-    ibd_state_s::id_rcq_hdl
-    ibd_state_s::id_rx_buf_sz
-    ibd_state_s::id_rx_bufs
-    ibd_state_s::id_rx_mr_hdl
-    ibd_state_s::id_rx_wqes
-    ibd_state_s::id_rxwcs
-    ibd_state_s::id_rxwcs_size
-    ibd_state_s::id_rx_nqueues
-    ibd_state_s::id_rx_queues
-    ibd_state_s::id_scope
-    ibd_state_s::id_scq_hdl
-    ibd_state_s::id_tx_buf_sz
-    ibd_state_s::id_tx_bufs
-    ibd_state_s::id_tx_mr_hdl
-    ibd_state_s::id_tx_rel_list.dl_cnt
-    ibd_state_s::id_tx_wqes
-    ibd_state_s::id_txwcs
-    ibd_state_s::id_txwcs_size
-    ibd_state_s::rc_listen_hdl
-    ibd_state_s::rc_listen_hdl_OFED_interop
-    ibd_state_s::rc_srq_size
-    ibd_state_s::rc_srq_rwqes
-    ibd_state_s::rc_srq_rx_bufs
-    ibd_state_s::rc_srq_rx_mr_hdl
-    ibd_state_s::rc_tx_largebuf_desc_base
-    ibd_state_s::rc_tx_mr_bufs
-    ibd_state_s::rc_tx_mr_hdl
-    ipha_s
-    icmph_s
-    ibt_path_info_s::pi_sid
-    ibd_rc_chan_s::ace
-    ibd_rc_chan_s::chan_hdl
-    ibd_rc_chan_s::state
-    ibd_rc_chan_s::chan_state
-    ibd_rc_chan_s::is_tx_chan
-    ibd_rc_chan_s::rcq_hdl
-    ibd_rc_chan_s::rcq_size
-    ibd_rc_chan_s::scq_hdl
-    ibd_rc_chan_s::scq_size
-    ibd_rc_chan_s::rx_bufs
-    ibd_rc_chan_s::rx_mr_hdl
-    ibd_rc_chan_s::rx_rwqes
-    ibd_rc_chan_s::tx_wqes
-    ibd_rc_chan_s::tx_mr_bufs
-    ibd_rc_chan_s::tx_mr_hdl
-    ibd_rc_chan_s::tx_rel_list.dl_cnt
-    ibd_rc_chan_s::is_used
-    ibd_rc_tx_largebuf_s::lb_buf
-    ibd_rc_msg_hello_s
-    ibt_cm_return_args_s))
-
-/*
- * ibd_rc_chan_s::next is protected by two mutexes:
- * 1) ibd_state_s::rc_pass_chan_list.chan_list_mutex
- * 2) ibd_state_s::rc_obs_act_chan_list.chan_list_mutex.
- */
-_NOTE(SCHEME_PROTECTS_DATA("protected by two mutexes",
-    ibd_rc_chan_s::next))
-
-/*
- * ibd_state_s.rc_tx_large_bufs_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_s::rc_tx_large_bufs_lock,
-    ibd_state_s::rc_tx_largebuf_free_head))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_s::rc_tx_large_bufs_lock,
-    ibd_state_s::rc_tx_largebuf_nfree))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_s::rc_tx_large_bufs_lock,
-    ibd_rc_tx_largebuf_s::lb_next))
-
-/*
- * ibd_acache_s.tx_too_big_mutex
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_acache_s::tx_too_big_mutex,
-    ibd_acache_s::tx_too_big_ongoing))
-
-/*
- * tx_wqe_list.dl_mutex
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_rc_chan_s::tx_wqe_list.dl_mutex,
-    ibd_rc_chan_s::tx_wqe_list.dl_head))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_rc_chan_s::tx_wqe_list.dl_mutex,
-    ibd_rc_chan_s::tx_wqe_list.dl_pending_sends))
-_NOTE(MUTEX_PROTECTS_DATA(ibd_rc_chan_s::tx_wqe_list.dl_mutex,
-    ibd_rc_chan_s::tx_wqe_list.dl_cnt))
-
-/*
- * ibd_state_s.rc_ace_recycle_lock
- */
-_NOTE(MUTEX_PROTECTS_DATA(ibd_state_s::rc_ace_recycle_lock,
-    ibd_state_s::rc_ace_recycle))
-
-/*
- * rc_srq_rwqe_list.dl_mutex
- */
-_NOTE(SCHEME_PROTECTS_DATA("atomic or dl mutex or single thr",
-    ibd_state_t::rc_srq_rwqe_list.dl_bufs_outstanding))
-_NOTE(SCHEME_PROTECTS_DATA("atomic or dl mutex or single thr",
-    ibd_state_t::rc_srq_rwqe_list.dl_cnt))
-
-/*
- * Non-mutex protection schemes for data elements. They are counters
- * for problem diagnosis. Don't need be protected.
- */
-_NOTE(SCHEME_PROTECTS_DATA("counters for problem diagnosis",
-    ibd_state_s::rc_rcv_alloc_fail
-    ibd_state_s::rc_rcq_err
-    ibd_state_s::rc_ace_not_found
-    ibd_state_s::rc_xmt_drop_too_long_pkt
-    ibd_state_s::rc_xmt_icmp_too_long_pkt
-    ibd_state_s::rc_xmt_reenter_too_long_pkt
-    ibd_state_s::rc_swqe_short
-    ibd_state_s::rc_swqe_mac_update
-    ibd_state_s::rc_xmt_buf_short
-    ibd_state_s::rc_xmt_buf_mac_update
-    ibd_state_s::rc_scq_no_swqe
-    ibd_state_s::rc_scq_no_largebuf
-    ibd_state_s::rc_conn_succ
-    ibd_state_s::rc_conn_fail
-    ibd_state_s::rc_null_conn
-    ibd_state_s::rc_no_estab_conn
-    ibd_state_s::rc_act_close
-    ibd_state_s::rc_pas_close
-    ibd_state_s::rc_delay_ace_recycle
-    ibd_state_s::rc_act_close_simultaneous
-    ibd_state_s::rc_act_close_not_clean
-    ibd_state_s::rc_pas_close_rcq_invoking
-    ibd_state_s::rc_reset_cnt
-    ibd_state_s::rc_timeout_act
-    ibd_state_s::rc_timeout_pas
-    ibd_state_s::rc_stop_connect))
-
-#ifdef DEBUG
-/*
- * Non-mutex protection schemes for data elements. They are counters
- * for problem diagnosis. Don't need be protected.
- */
-_NOTE(SCHEME_PROTECTS_DATA("counters for problem diagnosis",
-    ibd_state_s::rc_rwqe_short
-    ibd_rc_stat_s::rc_rcv_trans_byte
-    ibd_rc_stat_s::rc_rcv_trans_pkt
-    ibd_rc_stat_s::rc_rcv_copy_byte
-    ibd_rc_stat_s::rc_rcv_copy_pkt
-    ibd_rc_stat_s::rc_rcv_alloc_fail
-    ibd_rc_stat_s::rc_rcq_err 
-    ibd_rc_stat_s::rc_rwqe_short
-    ibd_rc_stat_s::rc_xmt_bytes
-    ibd_rc_stat_s::rc_xmt_small_pkt
-    ibd_rc_stat_s::rc_xmt_fragmented_pkt
-    ibd_rc_stat_s::rc_xmt_map_fail_pkt
-    ibd_rc_stat_s::rc_xmt_map_succ_pkt
-    ibd_rc_stat_s::rc_ace_not_found
-    ibd_rc_stat_s::rc_scq_no_swqe
-    ibd_rc_stat_s::rc_scq_no_largebuf
-    ibd_rc_stat_s::rc_swqe_short
-    ibd_rc_stat_s::rc_swqe_mac_update
-    ibd_rc_stat_s::rc_xmt_buf_short
-    ibd_rc_stat_s::rc_xmt_buf_mac_update
-    ibd_rc_stat_s::rc_conn_succ
-    ibd_rc_stat_s::rc_conn_fail
-    ibd_rc_stat_s::rc_null_conn
-    ibd_rc_stat_s::rc_no_estab_conn
-    ibd_rc_stat_s::rc_act_close
-    ibd_rc_stat_s::rc_pas_close
-    ibd_rc_stat_s::rc_delay_ace_recycle
-    ibd_rc_stat_s::rc_act_close_simultaneous
-    ibd_rc_stat_s::rc_reset_cnt
-    ibd_rc_stat_s::rc_timeout_act
-    ibd_rc_stat_s::rc_timeout_pas))
-#endif
-
 int
 _init()
 {
@@ -1263,11 +904,7 @@
 					break;
 				case IBD_ASYNC_EXIT:
 					mutex_enter(&state->id_acache_req_lock);
-#ifndef __lock_lint
 					CALLB_CPR_EXIT(&cprinfo);
-#else
-					mutex_exit(&state->id_acache_req_lock);
-#endif
 					return;
 				case IBD_ASYNC_RC_TOO_BIG:
 					ibd_async_rc_process_too_big(state,
@@ -1290,7 +927,6 @@
 
 			mutex_enter(&state->id_acache_req_lock);
 		} else {
-#ifndef __lock_lint
 			/*
 			 * Nothing to do: wait till new request arrives.
 			 */
@@ -1299,7 +935,6 @@
 			    &state->id_acache_req_lock);
 			CALLB_CPR_SAFE_END(&cprinfo,
 			    &state->id_acache_req_lock);
-#endif
 		}
 	}
 
@@ -1946,9 +1581,7 @@
 	 * necessary higher level notifications for speed changes.
 	 */
 	if ((opcode == IBD_LINK_UP_ABSENT) || (opcode == IBD_LINK_UP)) {
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*state))
 		state->id_link_speed = ibd_get_portspeed(state);
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*state))
 	}
 
 	/*
@@ -2200,7 +1833,6 @@
 		 * index is the same as before; finally check to see if the
 		 * pkey has been relocated to a different index in the table.
 		 */
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_sgid))
 		if (bcmp(port_infop->p_sgid_tbl,
 		    &state->id_sgid, sizeof (ib_gid_t)) != 0) {
 
@@ -2235,7 +1867,6 @@
 		} else {
 			new_link_state = LINK_STATE_DOWN;
 		}
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_sgid))
 	}
 
 update_link_state:
@@ -2422,8 +2053,6 @@
 	ibt_hca_attr_t hca_attrs;
 	ibt_status_t ibt_status;
 
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*state))
-
 	/*
 	 * Query the HCA and fetch its attributes
 	 */
@@ -2526,8 +2155,6 @@
 	if (hca_attrs.hca_max_chan_sz < state->id_ud_num_swqe)
 		state->id_ud_num_swqe = hca_attrs.hca_max_chan_sz;
 
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(*state))
-
 	return (DDI_SUCCESS);
 }
 
@@ -3417,9 +3044,7 @@
 query_bcast_grp:
 	bzero(&mcg_attr, sizeof (ibt_mcg_attr_t));
 	mcg_attr.mc_pkey = state->id_pkey;
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_mgid))
 	state->id_mgid.gid_guid = IB_MGID_IPV4_LOWGRP_MASK;
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_mgid))
 
 	for (i = 0; i < sizeof (scopes)/sizeof (scopes[0]); i++) {
 		state->id_scope = mcg_attr.mc_scope = scopes[i];
@@ -3427,13 +3052,11 @@
 		/*
 		 * Look for the IPoIB broadcast group.
 		 */
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_mgid))
 		state->id_mgid.gid_prefix =
 		    (((uint64_t)IB_MCGID_IPV4_PREFIX << 32) |
 		    ((uint64_t)state->id_scope << 48) |
 		    ((uint32_t)(state->id_pkey << 16)));
 		mcg_attr.mc_mgid = state->id_mgid;
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_mgid))
 		if (ibt_query_mcg(state->id_sgid, &mcg_attr, 1,
 		    &state->id_mcinfo, &numg) == IBT_SUCCESS) {
 			found = B_TRUE;
@@ -3465,13 +3088,11 @@
 			mcg_attr.mc_flow = 0;
 			mcg_attr.mc_sl = 0;
 			mcg_attr.mc_tclass = 0;
-			_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_mgid))
 			state->id_mgid.gid_prefix =
 			    (((uint64_t)IB_MCGID_IPV4_PREFIX << 32) |
 			    ((uint64_t)IB_MC_SCOPE_SUBNET_LOCAL << 48) |
 			    ((uint32_t)(state->id_pkey << 16)));
 			mcg_attr.mc_mgid = state->id_mgid;
-			_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_mgid))
 
 			if ((ret = ibt_join_mcg(state->id_sgid, &mcg_attr,
 			    &mcg_info, NULL, NULL)) != IBT_SUCCESS) {
@@ -4353,10 +3974,8 @@
 	 * resides. Since ipoib uses GID0 of the port, we just match
 	 * the gids to check whether we need to handle the trap.
 	 */
-	_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_sgid))
 	if (bcmp(&gid, &state->id_sgid, sizeof (ib_gid_t)) != 0)
 		return;
-	_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_sgid))
 
 	DPRINT(10, "ibd_notices_handler : %d\n", code);
 
@@ -5343,9 +4962,7 @@
 			state->id_link_state = LINK_STATE_UP;
 		}
 		state->id_mtu = (128 << port_infop->p_mtu);
-		_NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(state->id_sgid))
 		state->id_sgid = *port_infop->p_sgid_tbl;
-		_NOTE(NOW_VISIBLE_TO_OTHER_THREADS(state->id_sgid))
 		/*
 		 * Now that the port is active, record the port speed
 		 */
