From owner-freebsd-smp Sun Jun 9 13:02:15 1996 Return-Path: owner-smp Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id NAA14963 for smp-outgoing; Sun, 9 Jun 1996 13:02:15 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id NAA14952; Sun, 9 Jun 1996 13:02:11 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA01419; Sun, 9 Jun 1996 13:01:56 -0700 From: Terry Lambert Message-Id: <199606092001.NAA01419@phaeton.artisoft.com> Subject: Re: does freebsd support SMP? To: phk@FreeBSD.ORG (Poul-Henning Kamp) Date: Sun, 9 Jun 1996 13:01:55 -0700 (MST) Cc: terry@lambert.org, nathan@netrail.net, freebsd-current@FreeBSD.ORG, freebsd-smp@FreeBSD.ORG In-Reply-To: <968.834348207@critter.tfs.com> from "Poul-Henning Kamp" at Jun 9, 96 12:23:27 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-smp@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > >> DOes freebsd supoort SMP? > > > >Yes. There is a working SMP /usr/src/sys code tree that can be SUP'ed > >or CTM'ed. You do a normal CVS checkout, then you add: > > > >options SMP # enable SMP > >options NCPU=2 # or whatever max you want > > > >To your normal -current config file, config, makedepend, make, and > >install the SMP kernel. Then rebbot. You are running SMP. > > Well, you clearly havn't tried it Terry :-) > > Boot single user and then: > sysctl -w kern.smp_active=2 > to start the second CPU... That didn't used to be in there... clearly, I haven't tried it recently. 8-). Thanks for telling me, though, since I just pulled down the sources yesterday, and the only reason I'm in today is to play with it. I would have figured it out eventually. 4 hours or so. 8-) 8-). It seems that smp_active wants to be cpu.active, and wants to default to 1 (not zero). Actually, looking at the code, the values are only allowed to be 0 or 2 -- and it looks like 2 will actually start 'n' (the loop in mp_begin in locore.s). The locking code (mplock.s) only checks for non-zero. The code in swtch.s -- is it ever hit in the smp_active zero case? It seems to be an error to have the old idle loop present at all... am I missing something in the UP case, where the kernel is still compiled with SMP set? Also, in the idle spin loop, re: processor power consumption and heating: any chance of integrating a Linux-style "halt instruction" test and using it in the case that it works? Anyway, the reason I went looking was for a kernel variable like cpu.count for number of available cpu's so I could put it in my rc file instead of booting single-user: CPUCOUNT=`sysctl -n kern.cpu.count` if test "$CPUCOUNT" != "1" then echo -n "Starting auxillary processors..." sysctl -w kern.cpu.active=$CPUCOUNT echo "$(CPUCOUNT) PROCESSORS ACTIVE" fi This code could go into the main line rc file with no adverse affect, assuming the cpu.count wasn't conditional on being compiled with the SMP flag (the active could be conditional, since the count will never be non-1 in the UP/non-SMP options case) Who is actively hacking where in the assembly code? This seems like an easy fix that wouldn't drag me down into dealing with page tables. ;-). Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.