Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jul 2013 22:42:10 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252850 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace
Message-ID:  <201307052242.r65MgA6K010423@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Fri Jul  5 22:42:10 2013
New Revision: 252850
URL: http://svnweb.freebsd.org/changeset/base/252850

Log:
  Hide references to mod_lock. In FreeBSD it is always acquired with the
  provider lock held, so its use has no effect.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/dev/dtrace/dtrace_ioctl.c
  head/sys/cddl/dev/dtrace/dtrace_load.c
  head/sys/cddl/dev/dtrace/dtrace_unload.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Fri Jul  5 22:25:40 2013	(r252849)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c	Fri Jul  5 22:42:10 2013	(r252850)
@@ -278,8 +278,6 @@ static kmutex_t		dtrace_meta_lock;	/* me
 
 #if !defined(sun)
 /* XXX FreeBSD hacks. */
-static kmutex_t		mod_lock;
-
 #define cr_suid		cr_svuid
 #define cr_sgid		cr_svgid
 #define	ipaddr_t	in_addr_t
@@ -7678,7 +7676,9 @@ dtrace_unregister(dtrace_provider_id_t i
 		}
 	} else {
 		mutex_enter(&dtrace_provider_lock);
+#if defined(sun)
 		mutex_enter(&mod_lock);
+#endif
 		mutex_enter(&dtrace_lock);
 	}
 
@@ -7692,7 +7692,9 @@ dtrace_unregister(dtrace_provider_id_t i
 	    dtrace_anon.dta_state->dts_necbs > 0))) {
 		if (!self) {
 			mutex_exit(&dtrace_lock);
+#if defined(sun)
 			mutex_exit(&mod_lock);
+#endif
 			mutex_exit(&dtrace_provider_lock);
 		}
 		return (EBUSY);
@@ -7726,7 +7728,9 @@ dtrace_unregister(dtrace_provider_id_t i
 
 		if (!self) {
 			mutex_exit(&dtrace_lock);
+#if defined(sun)
 			mutex_exit(&mod_lock);
+#endif
 			mutex_exit(&dtrace_provider_lock);
 		}
 
@@ -7808,7 +7812,9 @@ dtrace_unregister(dtrace_provider_id_t i
 
 	if (!self) {
 		mutex_exit(&dtrace_lock);
+#if defined(sun)
 		mutex_exit(&mod_lock);
+#endif
 		mutex_exit(&dtrace_provider_lock);
 	}
 
@@ -8141,6 +8147,7 @@ dtrace_probe_provide(dtrace_probedesc_t 
 		 */
 		prv->dtpv_pops.dtps_provide(prv->dtpv_arg, desc);
 
+#if defined(sun)
 		/*
 		 * Now call the per-module provide operation.  We will grab
 		 * mod_lock to prevent the list from being modified.  Note
@@ -8149,7 +8156,6 @@ dtrace_probe_provide(dtrace_probedesc_t 
 		 */
 		mutex_enter(&mod_lock);
 
-#if defined(sun)
 		ctl = &modules;
 		do {
 			if (ctl->mod_busy || ctl->mod_mp == NULL)
@@ -8158,11 +8164,11 @@ dtrace_probe_provide(dtrace_probedesc_t 
 			prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl);
 
 		} while ((ctl = ctl->mod_next) != &modules);
+
+		mutex_exit(&mod_lock);
 #else
 		(void) linker_file_foreach(dtrace_probe_provide_cb, prv);
 #endif
-
-		mutex_exit(&mod_lock);
 	} while (all && (prv = prv->dtpv_next) != NULL);
 }
 
@@ -15156,7 +15162,9 @@ dtrace_module_loaded(modctl_t *ctl)
 	dtrace_provider_t *prv;
 
 	mutex_enter(&dtrace_provider_lock);
+#if defined(sun)
 	mutex_enter(&mod_lock);
+#endif
 
 	ASSERT(ctl->mod_busy);
 
@@ -15167,7 +15175,9 @@ dtrace_module_loaded(modctl_t *ctl)
 	for (prv = dtrace_provider; prv != NULL; prv = prv->dtpv_next)
 		prv->dtpv_pops.dtps_provide_module(prv->dtpv_arg, ctl);
 
+#if defined(sun)
 	mutex_exit(&mod_lock);
+#endif
 	mutex_exit(&dtrace_provider_lock);
 
 	/*
@@ -15212,7 +15222,9 @@ dtrace_module_unloaded(modctl_t *ctl)
 	template.dtpr_mod = ctl->mod_modname;
 
 	mutex_enter(&dtrace_provider_lock);
+#if defined(sun)
 	mutex_enter(&mod_lock);
+#endif
 	mutex_enter(&dtrace_lock);
 
 	if (dtrace_bymod == NULL) {
@@ -15221,7 +15233,9 @@ dtrace_module_unloaded(modctl_t *ctl)
 		 * we don't have any work to do.
 		 */
 		mutex_exit(&dtrace_provider_lock);
+#if defined(sun)
 		mutex_exit(&mod_lock);
+#endif
 		mutex_exit(&dtrace_lock);
 		return;
 	}
@@ -15230,7 +15244,9 @@ dtrace_module_unloaded(modctl_t *ctl)
 	    probe != NULL; probe = probe->dtpr_nextmod) {
 		if (probe->dtpr_ecb != NULL) {
 			mutex_exit(&dtrace_provider_lock);
+#if defined(sun)
 			mutex_exit(&mod_lock);
+#endif
 			mutex_exit(&dtrace_lock);
 
 			/*
@@ -15293,7 +15309,9 @@ dtrace_module_unloaded(modctl_t *ctl)
 	}
 
 	mutex_exit(&dtrace_lock);
+#if defined(sun)
 	mutex_exit(&mod_lock);
+#endif
 	mutex_exit(&dtrace_provider_lock);
 }
 

Modified: head/sys/cddl/dev/dtrace/dtrace_ioctl.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_ioctl.c	Fri Jul  5 22:25:40 2013	(r252849)
+++ head/sys/cddl/dev/dtrace/dtrace_ioctl.c	Fri Jul  5 22:42:10 2013	(r252850)
@@ -580,19 +580,25 @@ dtrace_ioctl(struct cdev *dev, u_long cm
 			return (EINVAL);
 
 		mutex_enter(&dtrace_provider_lock);
+#if defined(sun)
 		mutex_enter(&mod_lock);
+#endif
 		mutex_enter(&dtrace_lock);
 
 		if (desc->dtargd_id > dtrace_nprobes) {
 			mutex_exit(&dtrace_lock);
+#if defined(sun)
 			mutex_exit(&mod_lock);
+#endif
 			mutex_exit(&dtrace_provider_lock);
 			return (EINVAL);
 		}
 
 		if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) {
 			mutex_exit(&dtrace_lock);
+#if defined(sun)
 			mutex_exit(&mod_lock);
+#endif
 			mutex_exit(&dtrace_provider_lock);
 			return (EINVAL);
 		}
@@ -616,7 +622,9 @@ dtrace_ioctl(struct cdev *dev, u_long cm
 			    probe->dtpr_id, probe->dtpr_arg, desc);
 		}
 
+#if defined(sun)
 		mutex_exit(&mod_lock);
+#endif
 		mutex_exit(&dtrace_provider_lock);
 
 		return (0);

Modified: head/sys/cddl/dev/dtrace/dtrace_load.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_load.c	Fri Jul  5 22:25:40 2013	(r252849)
+++ head/sys/cddl/dev/dtrace/dtrace_load.c	Fri Jul  5 22:42:10 2013	(r252850)
@@ -57,12 +57,6 @@ dtrace_load(void *dummy)
 	dtrace_invop_init();
 
 	/*
-	 * XXX This is a short term hack to avoid having to comment
-	 * out lots and lots of lock/unlock calls.
-	 */
-	mutex_init(&mod_lock,"XXX mod_lock hack", MUTEX_DEFAULT, NULL);
-
-	/*
 	 * Initialise the mutexes without 'witness' because the dtrace
 	 * code is mostly written to wait for memory. To have the
 	 * witness code change a malloc() from M_WAITOK to M_NOWAIT

Modified: head/sys/cddl/dev/dtrace/dtrace_unload.c
==============================================================================
--- head/sys/cddl/dev/dtrace/dtrace_unload.c	Fri Jul  5 22:25:40 2013	(r252849)
+++ head/sys/cddl/dev/dtrace/dtrace_unload.c	Fri Jul  5 22:42:10 2013	(r252850)
@@ -123,9 +123,6 @@ dtrace_unload()
 	mutex_destroy(&dtrace_lock);
 	mutex_destroy(&dtrace_errlock);
 
-	/* XXX Hack */
-	mutex_destroy(&mod_lock);
-
 	/* Reset our hook for exceptions. */
 	dtrace_invop_uninit();
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307052242.r65MgA6K010423>