From owner-freebsd-questions Thu Feb 21 15:54:11 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mired.org (dsl-64-192-6-133.telocity.com [64.192.6.133]) by hub.freebsd.org (Postfix) with SMTP id 337D637B405 for ; Thu, 21 Feb 2002 15:54:03 -0800 (PST) Received: (qmail 72634 invoked by uid 100); 21 Feb 2002 23:54:02 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15477.34969.572893.76786@guru.mired.org> Date: Thu, 21 Feb 2002 17:54:01 -0600 To: Cliff Sarginson Cc: questions@freebsd.org Subject: Re: Kernel loader In-Reply-To: <89637344@toto.iv> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`;h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: "Mike Meyer" X-Delivery-Agent: TMDA/0.46 (Python 2.2; freebsd-4.5-STABLE-i386) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Cliff Sarginson types: > Well, I tried this out in -hackers, and got a couple of mono-syllabic > replies, but no-one answered my question. So I will try it here. Gee, I wouldn't answer on -hackers because I figured someone who knew the answers better than I would answer. Oh well... > The kernel loader code has mechanisms to implant dependencies in the > module code, e.g. if module A requires module B, then you can build > this knowledge into module A. That's correct. > Now I do not believe that if you load module A, then module B is > automagically loaded as well. Looking at the program kldload it > is just a few lines that just invokes a system call to load the > module requested. I think the system call code should be in my > source tree somewhere but I am damned if I can find it. Your belief is incorrect. Well, it's incorrect for elf modules. I don't know about other formats because I didn't check them. The source code you want is in sys/kern/kern_linker.c and link_elf.c. > What I was getting at is that in Linux they have this 'depmod' > setup that creates a dependency list, so that loading a module > should load all other required modules. I am looking for the > same functionality in FreeBSD. I do not believe it exists. You may be looking for gensetdefs. It's used in dealing with dependency lists in /usr/src/sys/conf/kmod.mk. It looks like the gensetdefs man page is out of date, though. However, if you're going to write a kld, you really don't care. > Can anyone confirm this, or refute it. I'm not sure which I did, but I think I answered your question. > My second question was this. > It seems to me that the kernel module loading may have some > sensitivity over the point at which it is loaded. I have reported > a bug in drm-kmod and my tests seem to show that it makes a > difference when a particular module (in this case "agp") is loaded > early on in the boot process via loader.conf, or later on by a shell > command in /usr/local/etc/rc.d. Is this likely to be expected ? I can't really help here, because I'm not that intimate with PC hardware. However, I know that BSD has run on hardware on which it mattered which order devices were allocated. Basically, if something that can use anything grabs what it thinks is best, then something needing a specific flavor or amount comes along, the second one may work if allocated first, and fail if allocated second. Just to make matters interesting, if you probed for them in the order that allocation worked, the probe didn't work, and vice versa. > I got zero answers to this question. > > If it does make a difference then I would be so bold as to say that > on-demand kernel loadable modules are not on-demand kernel loadable > modules if they cannot be loaded after the main boot process is > complete...and therefore you may as well build them into the kernel > in the first place. It may be that whether or not you can load them after the main boot process completes depends on what gets loaded by the main boot process. So that on some kernel configs it works fine as a kld, and on others it doesn't work because some resource it needs is no longer available. http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message