From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 6 16:18:53 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFBA21065672; Mon, 6 Dec 2010 16:18:53 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id A14E78FC13; Mon, 6 Dec 2010 16:18:53 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 5470E46B2E; Mon, 6 Dec 2010 11:18:53 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8AE8A8A027; Mon, 6 Dec 2010 11:18:52 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 6 Dec 2010 09:48:54 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20101102; KDE/4.4.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201012060948.54126.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 06 Dec 2010 11:18:52 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: mdf@freebsd.org Subject: Re: coretemp(4)/amdtemp(4) and sysctl nodes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2010 16:18:53 -0000 On Friday, December 03, 2010 1:05:02 pm mdf@freebsd.org wrote: > There are very few uses in FreeBSD mainline code of > sysctl_remove_oid(), and I was looking at potentially removing them. > However, the use in coretemp/amdtemp has me slightly stumped. > > Each device provides a device_get_sysctl_ctx sysctl_ctx that is > automatically cleaned up when the device goes away. Yet the sysctl > nodes for both amdtemp and coretemp use the context of other devices, > rather than their own. I can't quite figure out why, though the two > are slightly different enough that they may have different reasons. > > For coretmp(4) I don't see how the parent device can be removed first, > since we are a child device. So from my understanding it makes no > sense to have an explicit sysctl_remove_oid() and attach in the > parent's sysctl_ctx. Well, you would want 'kldunload coretemp.ko' to remove the sysctl node even though the parent device is still around. I suspect the same case is true for amdtemp. Probably these drivers should use a separate sysctl context. I'm not sure how the sysctl code handles removing a node that has an active context though. -- John Baldwin