Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2002 15:58:54 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        hiten@uk.FreeBSD.org
Cc:        current@FreeBSD.org
Subject:   Re: Warnings in my bootup (dmesg.boot)
Message-ID:  <3C8D44BE.260E044B@mindspring.com>
References:  <20020311191653.A1421@hpdi.ath.cx> <3C8D0BB6.D31379B3@mindspring.com> <20020311195953.A1610@hpdi.ath.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C8D44BE.260E044B>