From owner-freebsd-smp Thu Oct 4 11: 0:58 2001 Delivered-To: freebsd-smp@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 708D037B401 for ; Thu, 4 Oct 2001 11:00:56 -0700 (PDT) Received: by elvis.mu.org (Postfix, from userid 1192) id 4A57881D05; Thu, 4 Oct 2001 13:00:51 -0500 (CDT) Date: Thu, 4 Oct 2001 13:00:51 -0500 From: Alfred Perlstein To: Kazutaka YOKOTA Cc: smp@freebsd.org Subject: Re: How to distinguish the SMP kernel and the UP kernel Message-ID: <20011004130051.B59854@elvis.mu.org> References: <200110030310.MAA13836@zodiac.mech.utsunomiya-u.ac.jp> <3BBB6757.9A668E99@mindspring.com> <200110041211.VAA24646@zodiac.mech.utsunomiya-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200110041211.VAA24646@zodiac.mech.utsunomiya-u.ac.jp>; from yokota@zodiac.mech.utsunomiya-u.ac.jp on Thu, Oct 04, 2001 at 09:11:30PM +0900 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 [011004 07:01] wrote: > > # moved to smp ML, to which this thread should have been posted > # in the first place :-) > > >Kazutaka YOKOTA wrote: > >> > >> Is there any way for the loadable module to detect if > >> the kernel is configured for SMP or UP? > > > >There is a global variable, "ncpu". Its name may have changed > >recently, so you will want to look at the SYSCTL() stuff in > >/sys/i386/i386 to be sure. > > > >-- Terry > > The sysctl variable hw.ncpu returns 1 in the UP kernel, > and returns the number of active CPUs in the SMP kernel. > > When hw.ncpu == 1, it doesn't necessarily signifies the kernel > is configured for UP. Because it is perfectly permissible > to run the SMP kernel on the multi-CPU motherboard with only one > CPU installed... > > Am I wrong? I'm quite sure you're right. It would probably make sense to have a sysctl that says weather or not MP is configured or not. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message