From owner-freebsd-dtrace@FreeBSD.ORG Thu Feb 27 14:50:28 2014 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 1D82DFFE; Thu, 27 Feb 2014 14:50:28 +0000 (UTC) Received: from mail-qa0-x22f.google.com (mail-qa0-x22f.google.com [IPv6:2607:f8b0:400d:c00::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA4261215; Thu, 27 Feb 2014 14:50:27 +0000 (UTC) Received: by mail-qa0-f47.google.com with SMTP id w5so3936644qac.20 for ; Thu, 27 Feb 2014 06:50:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=+EECZ/m1+tM9Lzr/mkRd4cqoAXxmqhEFLhjJAsklp58=; b=Zi24WgNViEQrgTLVkoVR34QKG+aM56k8fXWivewBV8tUr2ocuGqQUY/+6KVy/3O8Go VTxNxaS1TFm+QU3obbqkfEuwBXaZWIqS3SzIoNtmUUT30PI26hsncs1docj8gDNNH4n7 rBt8Y+GUGoD/NKPJaFUbC2GK7ryJWB6b/wzPK+YE2nfHoyWEZDR/OBYDnHeAeZv9oYuI EgvPi58MmyvrnY1We5Rj+ufpGcWQNbfHiJGjWK24Yh74c+T/IpG9h+1peamZgevJiDIj wWaTwbThdGLEhbxn5zIu4G8YPL9rZrVBlJR7j8y6kyHASSjfTMzJBxqeZecsE3uxdJzI NRCQ== X-Received: by 10.140.83.203 with SMTP id j69mr7878458qgd.42.1393512626686; Thu, 27 Feb 2014 06:50:26 -0800 (PST) MIME-Version: 1.0 Sender: fedor.indutny@gmail.com Received: by 10.96.127.74 with HTTP; Thu, 27 Feb 2014 06:50:06 -0800 (PST) In-Reply-To: References: <20140227050136.GB28089@raichu> From: Fedor Indutny Date: Thu, 27 Feb 2014 18:50:06 +0400 X-Google-Sender-Auth: fz2VX5XMY1zVr0oqZ60RPaEj7NM Message-ID: Subject: Re: DTrace fixes for node.js To: Mark Johnston Content-Type: text/plain; charset=ISO-8859-1 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: Thu, 27 Feb 2014 14:50:28 -0000 Update sent, thank you! On Thu, Feb 27, 2014 at 6:39 PM, Mark Johnston wrote: > On Thu, Feb 27, 2014 at 3:30 AM, Fedor Indutny wrote: >> Mark, >> >> Thanks for looking into this. I just tried your patch and it (no >> surprise) builds fine. Node.js DOF symbols seems to be resolving >> properly too! >> >> Do you want me to squash this changes into my patch, and post them on >> that ticket? >> > > That would be good, thanks. When I have some time I'll do more testing > and commit the change. > > -Mark > >> On Thu, Feb 27, 2014 at 9:01 AM, Mark Johnston wrote: >>> On Tue, Feb 25, 2014 at 06:16:15PM +0400, Fedor Indutny wrote: >>>> Hello devs! >>>> >>>> I have made some fixes to fix DTrace support for node.js in FreeBSD: >>>> >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=186821 >>>> * http://www.freebsd.org/cgi/query-pr.cgi?pr=187027 >>>> >>>> Here is a blog post with a bit of explanation of why this is needed >>>> and what is fixed: https://blog.indutny.com/7.freebsd-dtrace >>>> >>>> Please let me know if I could be any help in reviewing it. >>> >>> Hi Fedor, >>> >>> The DOF limit change looks fine to me. I note that the illumos guys have >>> just pushed a change to illumos-gate which bumps dtrace_dof_maxsize, but >>> it's good to have the sysctl as well. >>> >>> The drti change looks mostly good to me. The real problem there is that >>> our linker doesn't know how to merge DOF, so it just concatenates the >>> tables into one SUNW_dof section. So we should really fix our linker, >>> but it doesn't hurt to also handle the problem in drti.o. >>> >>> There are a couple of bugs in the patch. First, the "break" added after >>> finding the DOF section causes problems if we haven't yet seen the >>> symbol table. Second, fixedprobes needs to be reset at the beginning of >>> each iteration of the while loop that you added, else we may not try >>> searching the dynamic symbol table when fixing the probe addresses. I've >>> pasted a patch below; could you test it and make sure things still work >>> properly with node? >>> >>> Thanks for the detailed blog post and problem description, they were >>> very helpful. :) >>> >>> -Mark >>> >>> diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c >>> index e47cfb4d..bb02d8c 100644 >>> --- a/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c >>> +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c >>> @@ -162,7 +162,7 @@ dtrace_dof_init(void) >>> char *dofstrtabraw; >>> size_t shstridx, symtabidx = 0, dynsymidx = 0; >>> unsigned char *buf; >>> - int fixedprobes = 0; >>> + int fixedprobes; >>> #endif >>> >>> if (getenv("DTRACE_DOF_INIT_DISABLE") != NULL) >>> @@ -214,7 +214,6 @@ dtrace_dof_init(void) >>> if (s && strcmp(s, ".SUNW_dof") == 0) { >>> dofdata = elf_getdata(scn, NULL); >>> dof = dofdata->d_buf; >>> - break; >>> } >>> } >>> } >>> @@ -226,6 +225,7 @@ dtrace_dof_init(void) >>> } >>> >>> while ((char *) dof < (char *) dofdata->d_buf + dofdata->d_size) { >>> + fixedprobes = 0; >>> dof_next = (void *) ((char *) dof + dof->dofh_filesz); >>> #endif >>>