From owner-freebsd-smp Sat Oct 6 0:58:41 2001 Delivered-To: freebsd-smp@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 4B74537B40A; Sat, 6 Oct 2001 00:58:22 -0700 (PDT) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f967wLM62618; Sat, 6 Oct 2001 00:58:21 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id BCEDA380A; Sat, 6 Oct 2001 00:58:21 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Kazutaka YOKOTA Cc: John Baldwin , smp@FreeBSD.ORG, Alfred Perlstein Subject: Re: How to distinguish the SMP kernel and the UP kernel In-Reply-To: <200110060625.PAA02451@zodiac.mech.utsunomiya-u.ac.jp> Date: Sat, 06 Oct 2001 00:58:21 -0700 From: Peter Wemm Message-Id: <20011006075821.BCEDA380A@overcee.netplex.com.au> Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Kazutaka YOKOTA wrote: > > >> - The following patch will add a new sysctl variable. > >> > >> kern.smp.kernel > >> > >> This will be 0 for the UP kernel and 1 for the SMP kernel. > >> > >> - It also make kern.smp.active available in the UP kernel as well. > >> (Previously this sysctl variable was only present in the SMP > >> kernel.) It will always be 0 for the UP kernel. > > > >This shouldn't be done. There's no need for 2 copies of the same sysctl. > >Actually, userland can _already_ tell if it is an SMP kernel or not by looki ng > >if the kern.smp.active sysctl exists. This is how top works, for example. > >Thus, userland doesn't need any of this. Only in the kernel do you need thi s. > > > >Now, ideally kernel modules shouldn't care if they are on a SMP kernel or no t. > > I agree. But, some modules need to know ;-< I was trying to make > the pnpbios driver into a module and it has #ifdef SMP in it. > > >Why does the module in question care? The only thing I would do here is > >possibly export a global variable saying if SMP was compiled in, nothing mor e. > > This is fine, as I am not very much interested in exposing to the userland > which kernel configration, SMP or UP, is running. I need to commit my config / build changes that build the kernel and modules with identical compile options. Remember, tuned modules go into /boot/kernel/* next to /boot/kernel/kernel. ie: this will not be a problem at all once this is committed since the module in question will have the SMP and/or APIC_IO ifdefs available. generic portable modules go in /boot/modules and dont get renamed away with a new kernel install. Things that need #ifdef SMP etc cannot go here. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message