From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 15 17:53:59 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 831E3106564A for ; Mon, 15 Nov 2010 17:53:59 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1A5FE8FC0C for ; Mon, 15 Nov 2010 17:53:58 +0000 (UTC) Received: by eyb7 with SMTP id 7so3085281eyb.13 for ; Mon, 15 Nov 2010 09:53:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=u+flXdrWe/U4Y6f18qnVeviGCwNN1Exkgc8eYVbr1j0=; b=UyB0yQ2fw5Xz7bbhHP6k55bp5N0ny+oFCANm9QMWYOGNMe0Oknruk3zk77eyeacZ3P pBnxL+LWD6+7yD+dFZiyFs+FKRev8xXbYwYURH5ud421ebA+Tnv/IoGRXUgtKERjXu1S uDAcxmAyJEYz7KkYgXQpHZ7mTfSiNbghNDpdc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ieUf98M4LS4DPPzcjXgXsKhxJ+/6VIblEFDXAQoA3/LnXXaTWEUdxvnb/0udqtL1nO c6PzYARRt/cGHSeWSqRpmB20Lq0dgPA4qU3Tv+llfiRv890sX9OZZrgxjesVDnl6sXIz qyLXuaa9IgEUTj67NxrW7m09PYmojiQApSkQo= MIME-Version: 1.0 Received: by 10.216.175.18 with SMTP id y18mr6233647wel.30.1289843637817; Mon, 15 Nov 2010 09:53:57 -0800 (PST) Received: by 10.216.198.27 with HTTP; Mon, 15 Nov 2010 09:53:57 -0800 (PST) Date: Mon, 15 Nov 2010 09:53:57 -0800 Message-ID: From: Garrett Cooper To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Phantom sysctl 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, 15 Nov 2010 17:53:59 -0000 According to SYSCTL_INT(9): The SYSCTL kernel interfaces allow code to statically declare sysctl(8) MIB entries, which will be initialized when the kernel module containing the declaration is initialized. When the module is unloaded, the sysctl will be automatically destroyed. The sysctl should be reaped when the module is unloaded. My dumb test kernel module [1] doesn't seem to do that though (please note that the OID test_int_sysctl is created, and not reaped... FWIW it's kind of bizarre that test_int_sysctl is created in the first place, given what I've seen when SYSCTL_* gets executed): toaster# kldload ./test_int_sysctl.ko toaster# sysctl -a | grep test test_int_sysctl: 0 vfs.nfs_common.realign_test: 0 debug.test_int_sysctl: 0 toaster# sysctl test_int_sysctl sysctl: unknown oid 'test_int_sysctl' toaster# kldunload ./test_int_sysctl.ko toaster# sysctl -a | grep test test_int_sysctl: 0 vfs.nfs_common.realign_test: 0 toaster# sysctl test_int_sysctl sysctl: unknown oid 'test_int_sysctl' I've seen this behavior on 8.1-RELEASE (custom kernel, vanilla sources), and CURRENT r215254. I'm compiling the kernel with SYSCTL_DEBUG (and added some missing error checking in the kern_sysctl.c code) to see if I can track down the resource issue, but in the meantime if someone more knowledgeable has some suggestions for what to do / where I should look, I'm all ears. Thanks! -Garrett 1. http://pastebin.com/n7d9bH8U