From owner-freebsd-current Mon Mar 11 15:59:23 2002 Delivered-To: freebsd-current@freebsd.org Received: from albatross.prod.itd.earthlink.net (albatross.mail.pas.earthlink.net [207.217.120.120]) by hub.freebsd.org (Postfix) with ESMTP id 95B3E37B405 for ; Mon, 11 Mar 2002 15:59:19 -0800 (PST) Received: from pool0501.cvx40-bradley.dialup.earthlink.net ([216.244.43.246] helo=mindspring.com) by albatross.prod.itd.earthlink.net with esmtp (Exim 3.33 #1) id 16kZh9-0007IS-00; Mon, 11 Mar 2002 15:59:12 -0800 Message-ID: <3C8D44BE.260E044B@mindspring.com> Date: Mon, 11 Mar 2002 15:58:54 -0800 From: Terry Lambert X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: hiten@uk.FreeBSD.org Cc: current@FreeBSD.org Subject: Re: Warnings in my bootup (dmesg.boot) References: <20020311191653.A1421@hpdi.ath.cx> <3C8D0BB6.D31379B3@mindspring.com> <20020311195953.A1610@hpdi.ath.cx> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hiten Pandya wrote: > On Mon, Mar 11, 2002 at 11:55:34AM -0800, Terry Lambert wrote: > > This means that it's trying to register a driver with a > > subsystem that has not yet been initialized. You probably > > need to split it off, and initialize it seperately ysing a > > SYSINIT in the SI_SUB_DRIVERS, SI_ORDER_ANY. If you have > > trouble doing this, let me know, and I can take a look at > > it for you (it's going to be a bit of a pain if it's allowed > > to be loaded later; if so, the easiest thing to do is to > > simply load it later, e.g. in /etc/rc.local). > > > > Hmm. AFAIK, All I did was to add the PERFMON driver to the kernel > configuration file, and when I compiled and installed the kernel, and > booted ofcourse, it came up with the error. Yes. The perfmon_init() in /sys/i386/i386/perfmon.c makes a call to make_dev(). With devfs, you can't call this until the device subsystem has been initialized. The perfmon_init() is called from /sys/i386/i386/machdep.c in cpu_startup(), which is called as a result of: SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) which happens before SI_SUB_DRIVERS. So to fix it, you would split the perfmon_init into a perfmon_init() and a perfmon_init_dev(). The perfmon_init_dev() code (in perfmon.c) would look like: static void perfmon_init_dev __P((void *)); SYSINIT(cpu, SI_SUB_DRIVERS, SI_ORDER_ANY, perfmon_init_dev, NULL) /* ARGSUSED */ static void perfmon_init_dev(dummy) void *dummy; { make_dev(&perfmon_cdevsw, 32, UID_ROOT, GID_KMEM, 0640, "perfmon"); } The SI_ORDER_ANY makes it the lowest priority to happen at SI_SUB_DRIVERS, which guaranteees that it's called *after*, which avoids the problem. In other words, it's a pretty rivial hack. If someone wants to commit the code, the code I've listed above is pretty much exactly what you'd need. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message