Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jun 1996 13:01:55 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        phk@FreeBSD.ORG (Poul-Henning Kamp)
Cc:        terry@lambert.org, nathan@netrail.net, freebsd-current@FreeBSD.ORG, freebsd-smp@FreeBSD.ORG
Subject:   Re: does freebsd support SMP?
Message-ID:  <199606092001.NAA01419@phaeton.artisoft.com>
In-Reply-To: <968.834348207@critter.tfs.com> from "Poul-Henning Kamp" at Jun 9, 96 12:23:27 pm

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606092001.NAA01419>