Date: Sun, 27 Jan 2008 04:52:25 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 134183 for review Message-ID: <200801270452.m0R4qP4F020617@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134183 Change 134183 by jb@jb_freebsd1 on 2008/01/27 04:51:24 Use a mtx rather than an sx lock. Affected files ... .. //depot/projects/dtrace/src/sys/kern/kern_sdt.c#7 edit Differences ... ==== //depot/projects/dtrace/src/sys/kern/kern_sdt.c#7 (text+ko) ==== @@ -39,8 +39,8 @@ #include <sys/kernel.h> #include <sys/linker.h> #include <sys/lock.h> +#include <sys/mutex.h> #include <sys/proc.h> -#include <sys/sx.h> #include <sys/sdt.h> /* @@ -51,7 +51,8 @@ /* * Mutex to serialise access to the SDT provider list. */ -static struct sx sdt_sx; +static struct mtx sdt_mtx; +MTX_SYSINIT(&sdt_mtx, "Statically Defined Tracing", NULL, MTX_DEF); /* * Hook for the DTrace probe function. The 'sdt' provider will set this @@ -79,13 +80,13 @@ { struct sdt_provider *prov = arg; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_INSERT_TAIL(&sdt_provider_list, prov, prov_entry); TAILQ_INIT(&prov->probe_list); - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } /* @@ -96,11 +97,11 @@ { struct sdt_provider *prov = arg; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_REMOVE(&sdt_provider_list, prov, prov_entry); - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } /* @@ -120,7 +121,7 @@ return; } - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_INSERT_TAIL(&probe->prov->probe_list, probe, probe_entry); @@ -128,7 +129,7 @@ probe->state = SDT_INIT; - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } /* @@ -139,14 +140,14 @@ { struct sdt_probe *probe = arg; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); if (probe->state == SDT_INIT) { TAILQ_REMOVE(&probe->prov->probe_list, probe, probe_entry); probe->state = SDT_UNINIT; } - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } /* @@ -157,13 +158,13 @@ { struct sdt_argtype *argtype = arg; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_INSERT_TAIL(&argtype->probe->argtype_list, argtype, argtype_entry); argtype->probe->n_args++; - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } /* @@ -174,17 +175,17 @@ { struct sdt_argtype *argtype = arg; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_REMOVE(&argtype->probe->argtype_list, argtype, argtype_entry); - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); } static void sdt_init(void *arg) { - sx_init(&sdt_sx, "Statically Defined Tracing"); + sx_init(&sdt_mtx, "Statically Defined Tracing"); TAILQ_INIT(&sdt_provider_list); } @@ -194,7 +195,7 @@ static void sdt_uninit(void *arg) { - sx_destroy(&sdt_sx); + sx_destroy(&sdt_mtx); } SYSUNINIT(sdt, SI_SUB_KDTRACE, SI_ORDER_FIRST, sdt_uninit, NULL); @@ -208,14 +209,14 @@ int error = 0; struct sdt_provider *prov; - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_FOREACH(prov, &sdt_provider_list, prov_entry) { if ((error = callback_func(prov, arg)) != 0) break; } - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); return (error); } @@ -231,9 +232,9 @@ int locked; struct sdt_probe *probe; - locked = sx_xlocked(&sdt_sx); + locked = mtx_locked(&sdt_mtx); if (!locked) - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_FOREACH(probe, &prov->probe_list, probe_entry) { if ((error = callback_func(probe, arg)) != 0) @@ -241,7 +242,7 @@ } if (!locked) - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); return (error); } @@ -257,9 +258,9 @@ int locked; struct sdt_argtype *argtype; - locked = sx_xlocked(&sdt_sx); + locked = mtx_locked(&sdt_mtx); if (!locked) - sx_xlock(&sdt_sx); + mtx_lock(&sdt_mtx); TAILQ_FOREACH(argtype, &probe->argtype_list, argtype_entry) { if ((error = callback_func(argtype, arg)) != 0) @@ -267,7 +268,7 @@ } if (!locked) - sx_xunlock(&sdt_sx); + mtx_unlock(&sdt_mtx); return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801270452.m0R4qP4F020617>