From owner-freebsd-dtrace@FreeBSD.ORG Sat Jul 27 02:27:00 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 ESMTP id 86B1D417; Sat, 27 Jul 2013 02:27:00 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qa0-x232.google.com (mail-qa0-x232.google.com [IPv6:2607:f8b0:400d:c00::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2AC352C2B; Sat, 27 Jul 2013 02:27:00 +0000 (UTC) Received: by mail-qa0-f50.google.com with SMTP id f14so730795qak.2 for ; Fri, 26 Jul 2013 19:26:59 -0700 (PDT) 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=1vOJVEUDUW5wPKp/QAEbMr36pTzOgY8kryMwVGJk6cU=; b=rPykUw3cGSUuWA1AMCpcbTclab0lZjd17pPMg6/l4Xw5bzwwwzYzlTE0I+nNoJ8nb0 vJiYKmAff0MPaiSWjRD/VMEOCt620npyZlu7ICrAthB5Qr2QfnveADTa4Th6S0VfUj0o apInAlUI5BGPbTC34UgRIh3bn54gJStPHPZz5wNDz/D80rAZOZoRpJZHtc7Fze5ynNak oVRSipqpnFqeDoPhM1QVt4EsdHRjvkg7Z7EjBu916Z1KlGDCQtIas0j+QntIvnlF/4SU E14Tqz6YBaY4krnnJcQ2WLogte9gFiqre7QjXHlqNrps6CUmUZio0fmMRLUO0gwWhyaD Ncsg== X-Received: by 10.229.52.1 with SMTP id f1mr13540944qcg.100.1374892019286; Fri, 26 Jul 2013 19:26:59 -0700 (PDT) Received: from raichu (24-212-218-13.cable.teksavvy.com. [24.212.218.13]) by mx.google.com with ESMTPSA id a8sm4430374qae.11.2013.07.26.19.26.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Jul 2013 19:26:58 -0700 (PDT) Sender: Mark Johnston Date: Fri, 26 Jul 2013 22:26:56 -0400 From: Mark Johnston To: Andriy Gapon Subject: Re: [RFC] reworking FreeBSD's SDT implementation Message-ID: <20130727022656.GB67227@raichu> References: <20130703041023.GA82673@raichu> <20130711024500.GA67976@raichu> <20130711210215.GB7506@gmail.com> <20130713234200.GA40803@raichu> <20130714075634.GC2832@gmail.com> <20130722022811.GA14288@raichu> <51F14150.7000509@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51F14150.7000509@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-dtrace@FreeBSD.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 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: Sat, 27 Jul 2013 02:27:00 -0000 On Thu, Jul 25, 2013 at 06:16:32PM +0300, Andriy Gapon wrote: > on 22/07/2013 05:28 markj@freebsd.org said the following: > > http://people.freebsd.org/~markj/patches/sdt-module-info/20130721-sdt-module-info.diff > > Mark, > > this is a minor suggestion only partially related to your patch. > I think that it would be nice if module loading and unloading events were posted > via EVENTHANDLER(9) mechanism. Then instead of introducing yet more DTrace > related hooks in the kernel code, DTrace modules could just subscribe to those > events. Also, those events could be potentially useful to other consumers > beyond DTrace. > What do you think? Hm, now that I look at this, I'm not sure if it can work. The unload hooks need to be able to veto a module unload in the case that one of its probes is enabled. This is done by checking whether lf->nenabled > 0, and it needs to be done with the dtrace lock held to prevent races. I've done this by having the unload hooks return a non-zero value if there are probes enabled, but EVENTHANDLER(9) doesn't give me a way to look at a handler's return value. Do you see a way to get around this? Thanks, -Mark