From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 15 20:04:06 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 5B2F31065675 for ; Mon, 15 Nov 2010 20:04:06 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1ED928FC12 for ; Mon, 15 Nov 2010 20:04:05 +0000 (UTC) Received: by iwn39 with SMTP id 39so7140451iwn.13 for ; Mon, 15 Nov 2010 12:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=h8WrFI91YtjKIUoHKvIrD0fxmWmm5C59GIaYsXud1dw=; b=SkMnRIQLkkkQJhrsWeMkc204or+7ZF6Cl8JbFFQyGdqPQOmJPQEZ+ypYhKFeLgBK5S NTQTTLgmW6WEjprp2xIV/77eml+oTC0TyzkrDbqLgePhaTrDY6CpNt7PRtPKR6OJcI8/ RdVpBEUfqmPsLggn5MqtW7tXHH0d9UPX5AoYg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=dkAZ/zHLo3G7FX+4vFkKFU/pVjy+EA7bC4j4keuFs7NoPYl/F1TZJIvVvBFhhLr5ol IbznwRQymcAfLMaIM7NMl9XJfkks7azMlMu/2iuJMIhaI8bnwOK300VIgT3e3jDJqBnT qmPa/fpMCUbBMKSYZ1XAAczBCSzh7NClLdtao= MIME-Version: 1.0 Received: by 10.231.156.139 with SMTP id x11mr4941951ibw.22.1289850016358; Mon, 15 Nov 2010 11:40:16 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.231.21.35 with HTTP; Mon, 15 Nov 2010 11:40:16 -0800 (PST) In-Reply-To: References: Date: Mon, 15 Nov 2010 11:40:16 -0800 X-Google-Sender-Auth: SkqCyk-c3rgdlaWjCo1ff5sxjqc Message-ID: From: mdf@FreeBSD.org To: Garrett Cooper Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: 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 20:04:06 -0000 On Mon, Nov 15, 2010 at 9:53 AM, Garrett Cooper wrote: > =A0 =A0According to SYSCTL_INT(9): > > =A0 =A0 The SYSCTL kernel interfaces allow code to statically declare sys= ctl(8) > =A0 =A0 MIB entries, which will be initialized when the kernel module con= taining > =A0 =A0 the declaration is initialized. =A0When the module is unloaded, t= he sysctl > =A0 =A0 will be automatically destroyed. > > =A0 =A0The 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 debug.test_int_sysctl did disappear, and that was the sysctl in the module: SYSCTL_INT(_debug, OID_AUTO, test_int_sysctl, CTLFLAG_RW, &_sysctl, 0, "Test sysctl OID"); I am not sure where the other test_int_sysctl appeared from, but the results of "sysctl test_int_sysctl" didn't change from before kldunload to after. Thanks, matthew > toaster# sysctl test_int_sysctl > sysctl: unknown oid 'test_int_sysctl' > > =A0 =A0I've seen this behavior on 8.1-RELEASE (custom kernel, vanilla > sources), and CURRENT r215254. > =A0 =A0I'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 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org= " >