From owner-freebsd-dtrace@FreeBSD.ORG Sun Dec 29 19:29:28 2013 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F25C7891 for ; Sun, 29 Dec 2013 19:29:27 +0000 (UTC) Received: from mail-ie0-x233.google.com (mail-ie0-x233.google.com [IPv6:2607:f8b0:4001:c03::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BB543126A for ; Sun, 29 Dec 2013 19:29:27 +0000 (UTC) Received: by mail-ie0-f179.google.com with SMTP id x13so10957401ief.24 for ; Sun, 29 Dec 2013 11:29:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=lgFdcgNRPBACSqHW1Xd6BOumfqi82WI5HvKr6Qh1x20=; b=w+VS2g4zJZ+EENhujcY+MARMZDAkO7ePkgJBO+vjXL9VaI7oALALbahRFq1pW2jbMX VOrt0kTtM/+PjcA63m9J7YfXpJJovQVBrB5x8SQKRD8Zc3kTl9DThIi41fFJZtnv4U4l grJB+g1ea2+CdpVe5l76BQVOuNZ8Rjlx45L0ReXTl9rgMgnx7NowFiNO5o3IgNP72VEL AJIQ2cUc28ae/LskiSm2l7FPZElb3oaZaGUc/yDDrZo7CRGfvHBNtBOSgYls2GPX2aMe ooz3QpNJfLSYX7OEH7rifAX5dMFsH36Bi6UVQ3hyrbWkBwdCYExGVZd2tNr9dAkqAMBh 2pjg== X-Received: by 10.50.66.208 with SMTP id h16mr34219464igt.0.1388345366529; Sun, 29 Dec 2013 11:29:26 -0800 (PST) Received: from charmander.home ([65.95.185.87]) by mx.google.com with ESMTPSA id d18sm41465479igz.0.2013.12.29.11.29.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Dec 2013 11:29:25 -0800 (PST) Sender: Mark Johnston Date: Sun, 29 Dec 2013 14:28:44 -0500 From: Mark Johnston To: Prashanth Kumar Subject: Re: Please review: dtrace usdt Message-ID: <20131229192844.GA8721@charmander.home> References: <1387107019.65592.YahooMailBasic@web192601.mail.sg3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1387107019.65592.YahooMailBasic@web192601.mail.sg3.yahoo.com> User-Agent: Mutt/1.5.22 (2013-10-16) Cc: freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Dec 2013 19:29:28 -0000 On Sun, Dec 15, 2013 at 07:30:19PM +0800, Prashanth Kumar wrote: > > Dtrace doesn't properly process object file of relocation type SHT_REL, which is type > in FreeBSD i386. The following patch checks for both relocation types SHT_REL and SHT_RELA, and > calls matching update function.Tested usdt example program from (https://wiki.freebsd.org/DTrace/userland) > in FreeBSD -10BETA1 - i386 and it works. Hi Prashanth, Thanks for the patch. I've committed a modified version of it as r260051: http://svnweb.freebsd.org/base?view=revision&revision=260051 -Mark > -------------------------------------------------- > --- dt_link.c 2013-12-15 14:24:37.000000000 +0400 > +++ /usr/src/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c 2013-12-15 14:22:21.000000000 +0400 > @@ -1542,7 +1542,10 @@ > rela.r_offset = 0; > rela.r_info = 0; > rela.r_addend = 0; > - (void) gelf_update_rela(data_rel, i, &rela); > + if (shdr_rel.sh_type == SHT_RELA) > + (void) gelf_update_rela(data_rel, i, &rela); > + else > + (void) gelf_update_rel(data_rel, i, (GElf_Rel *)&rela); > #endif > > mod = 1; > ----------------------------------------------------------- > > prashanth > -------------------------------------------- > On Wed, 4/12/13, Michael Harsch wrote: > > Subject: Re: dtrace usdt > To: "Prashanth Kumar" > Cc: freebsd-dtrace@freebsd.org > Date: Wednesday, 4 December, 2013, 11:13 PM > > Hi Prashanth, > > I've reproduced this on 10.0BETA4.  It appears to be > specific to i386; > the same test works fine on amd64. > > On Wed, Dec 4, 2013 at 3:29 AM, Prashanth Kumar > wrote: > > Hi > > Tried running the dtrace usdt example code from freebsd > dtrace userland wiki page. > > (https://wiki.freebsd.org/DTrace/userland). > > > > If run standalone the program segfaults. > >  # ./db > > Bus error (core dumped) > > > > If run with dtrace > > > >   # dtrace -s db.d -c ./db > > dtrace: script 'db.d' matched 2 probes > > CPU     ID      >               > FUNCTION:NAME > >   0  43245      >         >    main:query-start Query: SELECT * FROM > apples > > > > the program hungs after printing the first probe. > > > > Had to use the following command > >   # env WITH_DTRACE=1 make > > > > to build the program. Is there any other steps that i > have missed to make the program work?. > > This was tested on FreeBSD 10BETA1 - i386. > > > > regards > > Prashanth > > _______________________________________________ > > freebsd-dtrace@freebsd.org > mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" > > > > _______________________________________________ > freebsd-dtrace@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" From owner-freebsd-dtrace@FreeBSD.ORG Mon Dec 30 02:53:24 2013 Return-Path: Delivered-To: dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6333389; Mon, 30 Dec 2013 02:53:24 +0000 (UTC) Received: from mail-ig0-x232.google.com (mail-ig0-x232.google.com [IPv6:2607:f8b0:4001:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7618F1D79; Mon, 30 Dec 2013 02:53:24 +0000 (UTC) Received: by mail-ig0-f178.google.com with SMTP id ut6so26460117igb.5 for ; Sun, 29 Dec 2013 18:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=z6tNr2cfzDyky37M8tASGtWUJFhaYPWIp0eo+uD8XsE=; b=hX70P3RiBWVtuvT+Uy7JvhCj6u641lnmWFr3AK3grJP2lzRpn/DAVSbZBJCp1O22U5 GiCl46eL4eNHUZpyyb6qR7ragV5Y0zYMNCqhIpo+vj/3+GIWPgL8tWZ40V/gqXXrKQo0 y2NnPuaQE3saBqm33mhZ176g+5/fV2cNqnEd1cO2jyns82yNCgp2x8AMlhJANBvKCH+3 p+VlvVc516P5kVgWhraulM1S/58dWOASGwrTb4MTSyfcUO0FE2/7rj1XCb9YxwVRbGYF O4g2EnayCJdm6ih40cWkyoQ/faheB9gAzRNrGiOdfB3X7K+5dDKqDdYtxcQTfF8ebrfM ubYw== X-Received: by 10.43.148.69 with SMTP id kf5mr280995icc.80.1388372003876; Sun, 29 Dec 2013 18:53:23 -0800 (PST) Received: from charmander.home (bas2-toronto08-1176398446.dsl.bell.ca. [70.30.106.110]) by mx.google.com with ESMTPSA id au9sm18485137igc.7.2013.12.29.18.53.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Dec 2013 18:53:23 -0800 (PST) Sender: Mark Johnston Date: Sun, 29 Dec 2013 21:52:32 -0500 From: Mark Johnston To: Mike Ma Subject: Re: [CFT] Use vmem in dtrace Message-ID: <20131230024945.GA23245@charmander.home> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Cc: "dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2013 02:53:24 -0000 On Fri, Dec 13, 2013 at 08:17:03AM +0100, Mike Ma wrote: > Hi there, > > I'm a GSoC student this year, and Pedro guided me to dtrace recently. > > I'm sending my patch for a vmem task listed in the TODO list (12th item), > as there is vmem subsystem in FreeBSD 10/11 available now. > Basically, it is to revert changes from this patch > http://lists.freebsd.org/pipermail/p4-projects/2008-January/023466.html > And the main difference is that vmem_create and vmem_alloc take different > number of parameters on FreeBSD. > > I did run dtrace testsuite on my own machine. > And I hope someone here can try my patch. I've placed a modified form of your patch here: http://people.freebsd.org/~markj/patches/dtrace_vmem.diff I had to changes a few things for it to work for me: - vmem_alloc returns resources in its last argument, which cannot be NULL (else one invariably gets a page fault on line 1130 of subr_vmem.c). - the probe id arena should be created before the kld_* event handlers are registered, since they call dtrace_probe_create(), which uses the arena. - for some reason, the snprintf in dtrace_state_create() was placed under an #ifdef sun, which is not correct. If the modified patch looks ok to you, I will commit it. -Mark > > Any comments are appreciated. > Thanks. > > Cheers, > Mike > > > -- > Cheers, > Mike > Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c > =================================================================== > --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 257743) > +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) > @@ -211,7 +211,7 @@ > static vmem_t *dtrace_minor; /* minor number arena */ > #else > static taskq_t *dtrace_taskq; /* task queue */ > -static struct unrhdr *dtrace_arena; /* Probe ID number. */ > +static vmem_t *dtrace_arena; /* probe ID arena */ > #endif > static dtrace_probe_t **dtrace_probes; /* array of all probes */ > static int dtrace_nprobes; /* number of probes */ > @@ -7829,11 +7829,7 @@ > kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1); > kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); > kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); > -#if defined(sun) > - vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1); > -#else > - free_unr(dtrace_arena, probe->dtpr_id); > -#endif > + vmem_free(dtrace_arena, (vmem_addr_t)(probe->dtpr_id), 1); > kmem_free(probe, sizeof (dtrace_probe_t)); > } > > @@ -7950,11 +7946,7 @@ > kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); > kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); > kmem_free(probe, sizeof (dtrace_probe_t)); > -#if defined(sun) > - vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1); > -#else > - free_unr(dtrace_arena, i + 1); > -#endif > + vmem_free(dtrace_arena, (vmem_addr_t)i + 1, 1); > } > > mutex_exit(&dtrace_lock); > @@ -7990,12 +7982,8 @@ > mutex_enter(&dtrace_lock); > } > > -#if defined(sun) > - id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1, > - VM_BESTFIT | VM_SLEEP); > -#else > - id = alloc_unr(dtrace_arena); > -#endif > + id = (dtrace_id_t)vmem_alloc(dtrace_arena, 1, > + M_BESTFIT | M_WAITOK, NULL); > probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP); > > probe->dtpr_id = id; > @@ -10184,7 +10172,8 @@ > aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, > VM_BESTFIT | VM_SLEEP); > #else > - aggid = alloc_unr(state->dts_aggid_arena); > + aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, > + M_BESTFIT | M_WAITOK, NULL); > #endif > > if (aggid - 1 >= state->dts_naggregations) { > @@ -10237,7 +10226,7 @@ > #if defined(sun) > vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1); > #else > - free_unr(state->dts_aggid_arena, aggid); > + vmem_free(state->dts_aggid_arena, (vmem_addr_t)aggid, 1); > #endif > > ASSERT(state->dts_aggregations[aggid - 1] == agg); > @@ -13211,10 +13200,10 @@ > state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP); > #endif > > +#if defined(sun) > state->dts_epid = DTRACE_EPIDNONE + 1; > > (void) snprintf(c, sizeof (c), "dtrace_aggid_%d", m); > -#if defined(sun) > state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, > NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); > > @@ -13229,9 +13218,10 @@ > if (devp != NULL) > *devp = state->dts_dev; > #else > - state->dts_aggid_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); > + state->dts_aggid_arena = vmem_create(c, (vmem_addr_t)1, UINT32_MAX, 1, > + 0, M_WAITOK); > state->dts_dev = dev; > -#endif > +#endif > > /* > * We allocate NCPU buffers. On the one hand, this can be quite > @@ -14036,11 +14026,7 @@ > dtrace_format_destroy(state); > > if (state->dts_aggid_arena != NULL) { > -#if defined(sun) > vmem_destroy(state->dts_aggid_arena); > -#else > - delete_unrhdr(state->dts_aggid_arena); > -#endif > state->dts_aggid_arena = NULL; > } > #if defined(sun) > @@ -15375,7 +15361,7 @@ > #if defined(sun) > vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); > #else > - free_unr(dtrace_arena, probe->dtpr_id); > + vmem_free(dtrace_arena, (vmem_addr_t)probe->dtpr_id, 1); > #endif > kmem_free(probe, sizeof (dtrace_probe_t)); > } > Index: sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h > =================================================================== > --- sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h (revision 257743) > +++ sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h (working copy) > @@ -1139,11 +1139,7 @@ > int dts_nspeculations; /* number of speculations */ > int dts_naggregations; /* number of aggregations */ > dtrace_aggregation_t **dts_aggregations; /* aggregation array */ > -#if defined(sun) > vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ > -#else > - struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ > -#endif > uint64_t dts_errors; /* total number of errors */ > uint32_t dts_speculations_busy; /* number of spec. busy */ > uint32_t dts_speculations_unavail; /* number of spec unavail */ > Index: sys/cddl/dev/dtrace/dtrace_load.c > =================================================================== > --- sys/cddl/dev/dtrace/dtrace_load.c (revision 257743) > +++ sys/cddl/dev/dtrace/dtrace_load.c (working copy) > @@ -84,9 +84,9 @@ > mutex_enter(&cpu_lock); > > ASSERT(MUTEX_HELD(&cpu_lock)); > + dtrace_arena = vmem_create("dtrace", (vmem_addr_t)1, > + UINT32_MAX, 1, 0, M_WAITOK | M_BESTFIT); > > - dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); > - > dtrace_state_cache = kmem_cache_create("dtrace_state_cache", > sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, > NULL, NULL, NULL, NULL, NULL, 0); > Index: sys/cddl/dev/dtrace/dtrace_unload.c > =================================================================== > --- sys/cddl/dev/dtrace/dtrace_unload.c (revision 257743) > +++ sys/cddl/dev/dtrace/dtrace_unload.c (working copy) > @@ -104,7 +104,7 @@ > > kmem_cache_destroy(dtrace_state_cache); > > - delete_unrhdr(dtrace_arena); > + vmem_destroy(dtrace_arena); > > if (dtrace_toxrange != NULL) { > kmem_free(dtrace_toxrange, 0); > _______________________________________________ > freebsd-dtrace@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace > To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" From owner-freebsd-dtrace@FreeBSD.ORG Mon Dec 30 10:31:17 2013 Return-Path: Delivered-To: dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 225F9624; Mon, 30 Dec 2013 10:31:17 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5BF431E22; Mon, 30 Dec 2013 10:31:16 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id bz8so11429584wib.17 for ; Mon, 30 Dec 2013 02:31:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=M+mGhqA6/81XrzfDYExbdW/7FP7U7G9dLuj1A9WnPAs=; b=T5OiskiDBGar3e+WurbYS+sjOwv5sj8OPOFc1Eq6Cml1LtTolRXcoTiaze8GlPOdZK YvK0CgK5A7ZIgq/vjM68YHC8CwVs0ExFdmmkY0UHbRQTRcoW6iBof+8TcYlDMR69CIp0 Fw6TMT5BzPOD0npDetyDspP4CLCE0GlcibYTpWH9H/wsl2guUaKKTkGylajzb2YlcO4o utBaJIEjY7SThpVuYaB4BEHGU5GWMjv1ZqT0g5T91E+UnKpOuzEPUlUQgECrJksp6M4F Dj3EDEyO0TmarXbjqVz+OR+cXzyRo39qaJOFd4VMQ+nbibhCBDiUP1gmlx+Ml9I/TJxe 7aEQ== MIME-Version: 1.0 X-Received: by 10.180.77.49 with SMTP id p17mr42822058wiw.30.1388399474700; Mon, 30 Dec 2013 02:31:14 -0800 (PST) Received: by 10.216.189.7 with HTTP; Mon, 30 Dec 2013 02:31:14 -0800 (PST) In-Reply-To: <20131230024945.GA23245@charmander.home> References: <20131230024945.GA23245@charmander.home> Date: Mon, 30 Dec 2013 11:31:14 +0100 Message-ID: Subject: Re: [CFT] Use vmem in dtrace From: Mike Ma To: Mark Johnston Content-Type: text/plain; charset=ISO-8859-1 Cc: "dtrace@freebsd.org" X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Dec 2013 10:31:17 -0000 Hi Mark, Thanks a lot for your help. It works fine for me now as well. Please commit it then. Thanks a lot. On Mon, Dec 30, 2013 at 3:52 AM, Mark Johnston wrote: > On Fri, Dec 13, 2013 at 08:17:03AM +0100, Mike Ma wrote: >> Hi there, >> >> I'm a GSoC student this year, and Pedro guided me to dtrace recently. >> >> I'm sending my patch for a vmem task listed in the TODO list (12th item), >> as there is vmem subsystem in FreeBSD 10/11 available now. >> Basically, it is to revert changes from this patch >> http://lists.freebsd.org/pipermail/p4-projects/2008-January/023466.html >> And the main difference is that vmem_create and vmem_alloc take different >> number of parameters on FreeBSD. >> >> I did run dtrace testsuite on my own machine. >> And I hope someone here can try my patch. > > I've placed a modified form of your patch here: > http://people.freebsd.org/~markj/patches/dtrace_vmem.diff > > I had to changes a few things for it to work for me: > - vmem_alloc returns resources in its last argument, which cannot be > NULL (else one invariably gets a page fault on line 1130 of subr_vmem.c). > - the probe id arena should be created before the kld_* event handlers > are registered, since they call dtrace_probe_create(), which uses the > arena. > - for some reason, the snprintf in dtrace_state_create() was placed > under an #ifdef sun, which is not correct. > > If the modified patch looks ok to you, I will commit it. > > -Mark > >> >> Any comments are appreciated. >> Thanks. >> >> Cheers, >> Mike >> >> >> -- >> Cheers, >> Mike > >> Index: sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c >> =================================================================== >> --- sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (revision 257743) >> +++ sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c (working copy) >> @@ -211,7 +211,7 @@ >> static vmem_t *dtrace_minor; /* minor number arena */ >> #else >> static taskq_t *dtrace_taskq; /* task queue */ >> -static struct unrhdr *dtrace_arena; /* Probe ID number. */ >> +static vmem_t *dtrace_arena; /* probe ID arena */ >> #endif >> static dtrace_probe_t **dtrace_probes; /* array of all probes */ >> static int dtrace_nprobes; /* number of probes */ >> @@ -7829,11 +7829,7 @@ >> kmem_free(probe->dtpr_mod, strlen(probe->dtpr_mod) + 1); >> kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); >> kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); >> -#if defined(sun) >> - vmem_free(dtrace_arena, (void *)(uintptr_t)(probe->dtpr_id), 1); >> -#else >> - free_unr(dtrace_arena, probe->dtpr_id); >> -#endif >> + vmem_free(dtrace_arena, (vmem_addr_t)(probe->dtpr_id), 1); >> kmem_free(probe, sizeof (dtrace_probe_t)); >> } >> >> @@ -7950,11 +7946,7 @@ >> kmem_free(probe->dtpr_func, strlen(probe->dtpr_func) + 1); >> kmem_free(probe->dtpr_name, strlen(probe->dtpr_name) + 1); >> kmem_free(probe, sizeof (dtrace_probe_t)); >> -#if defined(sun) >> - vmem_free(dtrace_arena, (void *)((uintptr_t)i + 1), 1); >> -#else >> - free_unr(dtrace_arena, i + 1); >> -#endif >> + vmem_free(dtrace_arena, (vmem_addr_t)i + 1, 1); >> } >> >> mutex_exit(&dtrace_lock); >> @@ -7990,12 +7982,8 @@ >> mutex_enter(&dtrace_lock); >> } >> >> -#if defined(sun) >> - id = (dtrace_id_t)(uintptr_t)vmem_alloc(dtrace_arena, 1, >> - VM_BESTFIT | VM_SLEEP); >> -#else >> - id = alloc_unr(dtrace_arena); >> -#endif >> + id = (dtrace_id_t)vmem_alloc(dtrace_arena, 1, >> + M_BESTFIT | M_WAITOK, NULL); >> probe = kmem_zalloc(sizeof (dtrace_probe_t), KM_SLEEP); >> >> probe->dtpr_id = id; >> @@ -10184,7 +10172,8 @@ >> aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, >> VM_BESTFIT | VM_SLEEP); >> #else >> - aggid = alloc_unr(state->dts_aggid_arena); >> + aggid = (dtrace_aggid_t)(uintptr_t)vmem_alloc(state->dts_aggid_arena, 1, >> + M_BESTFIT | M_WAITOK, NULL); >> #endif >> >> if (aggid - 1 >= state->dts_naggregations) { >> @@ -10237,7 +10226,7 @@ >> #if defined(sun) >> vmem_free(state->dts_aggid_arena, (void *)(uintptr_t)aggid, 1); >> #else >> - free_unr(state->dts_aggid_arena, aggid); >> + vmem_free(state->dts_aggid_arena, (vmem_addr_t)aggid, 1); >> #endif >> >> ASSERT(state->dts_aggregations[aggid - 1] == agg); >> @@ -13211,10 +13200,10 @@ >> state = kmem_zalloc(sizeof(dtrace_state_t), KM_SLEEP); >> #endif >> >> +#if defined(sun) >> state->dts_epid = DTRACE_EPIDNONE + 1; >> >> (void) snprintf(c, sizeof (c), "dtrace_aggid_%d", m); >> -#if defined(sun) >> state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, >> NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); >> >> @@ -13229,9 +13218,10 @@ >> if (devp != NULL) >> *devp = state->dts_dev; >> #else >> - state->dts_aggid_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); >> + state->dts_aggid_arena = vmem_create(c, (vmem_addr_t)1, UINT32_MAX, 1, >> + 0, M_WAITOK); >> state->dts_dev = dev; >> -#endif >> +#endif >> >> /* >> * We allocate NCPU buffers. On the one hand, this can be quite >> @@ -14036,11 +14026,7 @@ >> dtrace_format_destroy(state); >> >> if (state->dts_aggid_arena != NULL) { >> -#if defined(sun) >> vmem_destroy(state->dts_aggid_arena); >> -#else >> - delete_unrhdr(state->dts_aggid_arena); >> -#endif >> state->dts_aggid_arena = NULL; >> } >> #if defined(sun) >> @@ -15375,7 +15361,7 @@ >> #if defined(sun) >> vmem_free(dtrace_arena, (void *)(uintptr_t)probe->dtpr_id, 1); >> #else >> - free_unr(dtrace_arena, probe->dtpr_id); >> + vmem_free(dtrace_arena, (vmem_addr_t)probe->dtpr_id, 1); >> #endif >> kmem_free(probe, sizeof (dtrace_probe_t)); >> } >> Index: sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h >> =================================================================== >> --- sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h (revision 257743) >> +++ sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h (working copy) >> @@ -1139,11 +1139,7 @@ >> int dts_nspeculations; /* number of speculations */ >> int dts_naggregations; /* number of aggregations */ >> dtrace_aggregation_t **dts_aggregations; /* aggregation array */ >> -#if defined(sun) >> vmem_t *dts_aggid_arena; /* arena for aggregation IDs */ >> -#else >> - struct unrhdr *dts_aggid_arena; /* arena for aggregation IDs */ >> -#endif >> uint64_t dts_errors; /* total number of errors */ >> uint32_t dts_speculations_busy; /* number of spec. busy */ >> uint32_t dts_speculations_unavail; /* number of spec unavail */ >> Index: sys/cddl/dev/dtrace/dtrace_load.c >> =================================================================== >> --- sys/cddl/dev/dtrace/dtrace_load.c (revision 257743) >> +++ sys/cddl/dev/dtrace/dtrace_load.c (working copy) >> @@ -84,9 +84,9 @@ >> mutex_enter(&cpu_lock); >> >> ASSERT(MUTEX_HELD(&cpu_lock)); >> + dtrace_arena = vmem_create("dtrace", (vmem_addr_t)1, >> + UINT32_MAX, 1, 0, M_WAITOK | M_BESTFIT); >> >> - dtrace_arena = new_unrhdr(1, INT_MAX, &dtrace_unr_mtx); >> - >> dtrace_state_cache = kmem_cache_create("dtrace_state_cache", >> sizeof (dtrace_dstate_percpu_t) * NCPU, DTRACE_STATE_ALIGN, >> NULL, NULL, NULL, NULL, NULL, 0); >> Index: sys/cddl/dev/dtrace/dtrace_unload.c >> =================================================================== >> --- sys/cddl/dev/dtrace/dtrace_unload.c (revision 257743) >> +++ sys/cddl/dev/dtrace/dtrace_unload.c (working copy) >> @@ -104,7 +104,7 @@ >> >> kmem_cache_destroy(dtrace_state_cache); >> >> - delete_unrhdr(dtrace_arena); >> + vmem_destroy(dtrace_arena); >> >> if (dtrace_toxrange != NULL) { >> kmem_free(dtrace_toxrange, 0); > >> _______________________________________________ >> freebsd-dtrace@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-dtrace >> To unsubscribe, send any mail to "freebsd-dtrace-unsubscribe@freebsd.org" > -- Cheers, Mike