changeset 10902:f2a954d6028e

6889384 x86 rootnex bottleneck maintaining perf counters with atomics
author Mark Johnson <Mark.Johnson@Sun.COM>
date Wed, 28 Oct 2009 15:30:45 -0700
parents fb88c4bfd3ae
children 65dc46bd2696
files usr/src/uts/i86pc/io/rootnex.c usr/src/uts/i86pc/sys/rootnex.h
diffstat 2 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/i86pc/io/rootnex.c	Wed Oct 28 16:16:37 2009 -0600
+++ b/usr/src/uts/i86pc/io/rootnex.c	Wed Oct 28 15:30:45 2009 -0700
@@ -1729,8 +1729,8 @@
 
 	*handlep = (ddi_dma_handle_t)hp;
 
-	ROOTNEX_PROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
-	DTRACE_PROBE1(rootnex__alloc__handle, uint64_t,
+	ROOTNEX_DPROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
+	ROOTNEX_DPROBE1(rootnex__alloc__handle, uint64_t,
 	    rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
 
 	return (DDI_SUCCESS);
@@ -1788,8 +1788,8 @@
 	mutex_destroy(&dma->dp_mutex);
 	kmem_cache_free(rootnex_state->r_dmahdl_cache, hp);
 
-	ROOTNEX_PROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
-	DTRACE_PROBE1(rootnex__free__handle, uint64_t,
+	ROOTNEX_DPROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
+	ROOTNEX_DPROBE1(rootnex__free__handle, uint64_t,
 	    rootnex_cnt[ROOTNEX_CNT_ACTIVE_HDLS]);
 
 	if (rootnex_state->r_dvma_call_list_id)
@@ -2008,9 +2008,9 @@
 		hp->dmai_cookie++;
 		hp->dmai_rflags &= ~DDI_DMA_PARTIAL;
 		hp->dmai_nwin = 1;
-		ROOTNEX_PROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
-		DTRACE_PROBE3(rootnex__bind__fast, dev_info_t *, rdip, uint64_t,
-		    rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS], uint_t,
+		ROOTNEX_DPROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
+		ROOTNEX_DPROBE3(rootnex__bind__fast, dev_info_t *, rdip,
+		    uint64_t, rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS], uint_t,
 		    dma->dp_dma.dmao_size);
 		return (DDI_DMA_MAPPED);
 	}
@@ -2062,8 +2062,8 @@
 	*cookiep = dma->dp_cookies[0];
 	hp->dmai_cookie++;
 
-	ROOTNEX_PROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
-	DTRACE_PROBE3(rootnex__bind__slow, dev_info_t *, rdip, uint64_t,
+	ROOTNEX_DPROF_INC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
+	ROOTNEX_DPROBE3(rootnex__bind__slow, dev_info_t *, rdip, uint64_t,
 	    rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS], uint_t,
 	    dma->dp_dma.dmao_size);
 	return (e);
@@ -2161,8 +2161,8 @@
 	if (rootnex_state->r_dvma_call_list_id)
 		ddi_run_callback(&rootnex_state->r_dvma_call_list_id);
 
-	ROOTNEX_PROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
-	DTRACE_PROBE1(rootnex__unbind, uint64_t,
+	ROOTNEX_DPROF_DEC(&rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
+	ROOTNEX_DPROBE1(rootnex__unbind, uint64_t,
 	    rootnex_cnt[ROOTNEX_CNT_ACTIVE_BINDS]);
 
 	return (DDI_SUCCESS);
--- a/usr/src/uts/i86pc/sys/rootnex.h	Wed Oct 28 16:16:37 2009 -0600
+++ b/usr/src/uts/i86pc/sys/rootnex.h	Wed Oct 28 15:30:45 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -35,6 +35,7 @@
 #include <sys/modctl.h>
 #include <sys/sunddi.h>
 #include <sys/iommulib.h>
+#include <sys/sdt.h>
 
 #ifdef	__cplusplus
 extern "C" {
@@ -49,6 +50,19 @@
 #define	VEC_MAX			255
 
 /* atomic increment/decrement to keep track of outstanding binds, etc */
+#ifdef DEBUG
+#define	ROOTNEX_DPROF_INC(addr)		atomic_inc_64(addr)
+#define	ROOTNEX_DPROF_DEC(addr)		atomic_add_64(addr, -1)
+#define	ROOTNEX_DPROBE1(name, type1, arg1) \
+	DTRACE_PROBE1(name, type1, arg1)
+#define	ROOTNEX_DPROBE3(name, type1, arg1, type2, arg2, type3, arg3) \
+	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
+#else
+#define	ROOTNEX_DPROF_INC(addr)
+#define	ROOTNEX_DPROF_DEC(addr)
+#define	ROOTNEX_DPROBE1(name, type1, arg1)
+#define	ROOTNEX_DPROBE3(name, type1, arg1, type2, arg2, type3, arg3)
+#endif
 #define	ROOTNEX_PROF_INC(addr)		atomic_inc_64(addr)
 #define	ROOTNEX_PROF_DEC(addr)		atomic_add_64(addr, -1)