From owner-svn-src-all@FreeBSD.ORG Wed Aug 14 18:14:55 2013 Return-Path: Delivered-To: svn-src-all@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 ESMTP id 69D7AC69; Wed, 14 Aug 2013 18:14:55 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-vc0-x22d.google.com (mail-vc0-x22d.google.com [IPv6:2607:f8b0:400c:c03::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E41B62BFC; Wed, 14 Aug 2013 18:14:54 +0000 (UTC) Received: by mail-vc0-f173.google.com with SMTP id id13so5368688vcb.4 for ; Wed, 14 Aug 2013 11:14:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=/MN+s0ON/M7nubbRoO1nmZTDLFnPJRGTTjqzv4zKVXI=; b=hHXT6jwEZKuHY6a2Ul7W//DFVbkmePcbVNYJ44bfANoc2RNihh84uvC43lqqRI2S2O kZnaXoKiI7IeV7MgZiH8ikuFCJrXdCqb6b5zdgM/mIDlE68GXiiDOSSKtQu3FE167yfE eJ3tMW0zyQUtZ236PYp2kIySW02pKybv+piwrXwaq5ocsut3Wz2uhCysK75oVKPDXBLN gmDAE6hGc9UAkvqeBcqDs7iaK84a1IH/8dHvICewZ3Xeco+A2zEsgwSY6lj9UAEXOkcI n05GnAid2i7wVGHULr6Ys2H4hkzijJqJkm9MFvwgMa6i8pEeupR2zTftID9YM/dm9q0Z /jLA== MIME-Version: 1.0 X-Received: by 10.52.34.209 with SMTP id b17mr9837vdj.111.1376504094037; Wed, 14 Aug 2013 11:14:54 -0700 (PDT) Sender: markjdb@gmail.com Received: by 10.220.65.4 with HTTP; Wed, 14 Aug 2013 11:14:53 -0700 (PDT) In-Reply-To: <201308140819.13854.jhb@freebsd.org> References: <201308140042.r7E0gMtf054550@svn.freebsd.org> <201308140819.13854.jhb@freebsd.org> Date: Wed, 14 Aug 2013 14:14:53 -0400 X-Google-Sender-Auth: v7L2t5m7b3MQeKZAMLEG-wvP-Fg Message-ID: Subject: Re: svn commit: r254309 - in head: share/man/man9 sys/cddl/contrib/opensolaris/uts/common/dtrace sys/cddl/dev/dtrace sys/cddl/dev/sdt sys/kern sys/sys From: Mark Johnston To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Wed, 14 Aug 2013 18:14:55 -0000 On Wed, Aug 14, 2013 at 8:19 AM, John Baldwin wrote: > On Tuesday, August 13, 2013 8:42:22 pm Mark Johnston wrote: > > Author: markj > > Date: Wed Aug 14 00:42:21 2013 > > New Revision: 254309 > > URL: http://svnweb.freebsd.org/changeset/base/254309 > > > > Log: > > Use kld_{load,unload} instead of mod_{load,unload} for the linker file > load > > and unload event handlers added in r254266. > > > > Reported by: jhb > > X-MFC with: r254266 > > Thanks! BTW, it would be really nice to replace HWPMC_HOOKS in > kern_linker.c with > EVENTHANDLER calls. I think kld_load would just work (though you might > need to > downgrade the lock before you run it). For kld_unload it seems you want > two events, > a kld_unload_try for your newly added event (since it can reject a > kld_unload), and > perhaps kld_unload at the end where the current HWPMC_HOOK is. Just an > idea if > someone is looking for something to do. I know there are other modules > that need > to hook into linker events like this, and making HWPMC_HOOKS more generic > would be > a big help. > I will look into doing this. The DTrace SDT kld_load handler will not work properly if the linker lock is downgraded first because of the following code in linker_file_lookup_set(): locked = KLD_LOCK(); if (!locked) KLD_LOCK(); In particular, it checks to see if the kld lock is exclusively held and locks it if not, which obviously causes problems if the thread holds the shared lock. The answer might be to just run the hwpmc handler with the exclusive lock held. Or perhaps we just need a linker_file_lookup_set_locked(), assuming that it's ok to look up a linker set with the shared lock held. -Mark