From owner-svn-src-all@FreeBSD.ORG Tue Aug 24 11:48:22 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23D5C106564A; Tue, 24 Aug 2010 11:48:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id AB6CA8FC0C; Tue, 24 Aug 2010 11:48:20 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o7OBmJbS069954 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 24 Aug 2010 14:48:19 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o7OBmIMc026379; Tue, 24 Aug 2010 14:48:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o7OBmIfU026378; Tue, 24 Aug 2010 14:48:18 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 24 Aug 2010 14:48:18 +0300 From: Kostik Belousov To: Rui Paulo Message-ID: <20100824114818.GJ2396@deviant.kiev.zoral.com.ua> References: <201008241111.o7OBBwvn074031@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rkKICwW9XwtbZ5OV" Content-Disposition: inline In-Reply-To: <201008241111.o7OBBwvn074031@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211738 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2010 11:48:22 -0000 --rkKICwW9XwtbZ5OV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 24, 2010 at 11:11:58AM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Tue Aug 24 11:11:58 2010 > New Revision: 211738 > URL: http://svn.freebsd.org/changeset/base/211738 >=20 > Log: > Port the fasttrap provider to FreeBSD. This provider is responsible for > injecting debugging probes in the userland programs and is the basis for > the pid provider and the usdt provider. > =20 > Sponsored by: The FreeBSD Foundation >=20 > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c >=20 > Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Tue Au= g 24 09:57:06 2010 (r211737) > +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Tue Au= g 24 11:11:58 2010 (r211738) > @@ -17,6 +17,10 @@ > * information: Portions Copyright [yyyy] [name of copyright owner] > * > * CDDL HEADER END > + * > + * Portions Copyright 2010 The FreeBSD Foundation > + * > + * $FreeBSD$ > */ > =20 > /* > @@ -24,7 +28,9 @@ > * Use is subject to license terms. > */ > =20 > +#if defined(sun) > #pragma ident "%Z%%M% %I% %E% SMI" > +#endif > =20 > #include > #include > @@ -32,11 +38,15 @@ > #include > #include > #include > +#if defined(sun) > #include > +#endif > #include > #include > #include > +#if defined(sun) > #include > +#endif > #include > #include > #include > @@ -44,9 +54,17 @@ > #include > #include > #include > -#include > #include > +#if defined(sun) > #include > +#endif > +#include > +#include > +#if !defined(sun) > +#include > +#include > +#include > +#endif > =20 > /* > * User-Land Trap-Based Tracing > @@ -125,11 +143,20 @@ > * never hold the provider lock and creation lock simultaneously > */ > =20 > -static dev_info_t *fasttrap_devi; > +static d_open_t fasttrap_open; > +static d_ioctl_t fasttrap_ioctl; > + > +static struct cdevsw fasttrap_cdevsw =3D { > + .d_version =3D D_VERSION, > + .d_open =3D fasttrap_open, > + .d_ioctl =3D fasttrap_ioctl, > + .d_name =3D "fasttrap", > +}; > +static struct cdev *fasttrap_cdev; > static dtrace_meta_provider_id_t fasttrap_meta_id; > =20 > -static timeout_id_t fasttrap_timeout; > -static kmutex_t fasttrap_cleanup_mtx; > +static struct callout fasttrap_timeout; > +static struct mtx fasttrap_cleanup_mtx; > static uint_t fasttrap_cleanup_work; > =20 > /* > @@ -229,6 +256,7 @@ fasttrap_hash_str(const char *p) > void > fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc) > { > +#if defined(sun) > sigqueue_t *sqp =3D kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP); > =20 > sqp->sq_info.si_signo =3D SIGTRAP; > @@ -241,6 +269,17 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t > =20 > if (t !=3D NULL) > aston(t); > +#else > + ksiginfo_t *ksi =3D kmem_zalloc(sizeof (ksiginfo_t), KM_SLEEP); > + > + ksiginfo_init(ksi); > + ksi->ksi_signo =3D SIGTRAP; > + ksi->ksi_code =3D TRAP_DTRACE; > + ksi->ksi_addr =3D (caddr_t)pc; > + PROC_LOCK(p); > + (void) pksignal(p, SIGTRAP, ksi); > + PROC_UNLOCK(p); > +#endif =46rom the quick look at the solaris part of the code, I think that the signal should be posted to the specific thread, and not to the process. > } > =20 > /* > @@ -250,17 +289,24 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t > static void > fasttrap_mod_barrier(uint64_t gen) > { > +#if defined(sun) > int i; > +#endif > =20 > if (gen < fasttrap_mod_gen) > return; > =20 > fasttrap_mod_gen++; > =20 > +#if defined(sun) > for (i =3D 0; i < NCPU; i++) { > mutex_enter(&cpu_core[i].cpuc_pid_lock); > mutex_exit(&cpu_core[i].cpuc_pid_lock); > } > +#else > + /* XXX */ > + __asm __volatile("": : :"memory"); Indeed XXX. Semantic of acquiring/releasing a mutex, even on Solaris, is much stricter then performing compiler-level memory barrier. --rkKICwW9XwtbZ5OV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkxzsYIACgkQC3+MBN1Mb4hPTQCfXTK0rzPjPNaWxkA9chaufUH/ 6mUAoMIvXOY2syzVf2NhYBANbbwj4tjs =Nfyt -----END PGP SIGNATURE----- --rkKICwW9XwtbZ5OV--