SMP detection

backyard backyard1454-bsd at yahoo.com
Thu Aug 31 14:05:06 UTC 2006



--- Skylar Thompson <skylar at cs.earlham.edu> wrote:

> Jordi Carrillo wrote:
> > 2006/8/30, backyard <backyard1454-bsd at yahoo.com>:
> >>
> >>
> >>
> >> --- Jordi Carrillo <jordilin at gmail.com> wrote:
> >>
> >> > I've read that SMP should be disabled for
> >> > performance issues (I did not know
> >> > that before installing freebsd). I have a P4
> 3GHz
> >> > with hyperthreading
> >> > technology. I have the SMP-GENERIC kernel and
> it
> >> > only launches one cpu. So,
> >> > I've decided to disable SMP from BIOS. Is that
> ok?,
> >> > knowing that I have a
> >> > Smp enabled kernel? or should I install one
> without
> >> > smp? If so, is there a
> >> > way to install one already precompiled?
> >> > Thanks in advance
> >> >
> >> > --
> >> > http://jordilin.wordpress.com
> >> > _______________________________________________
> >> > freebsd-questions at freebsd.org mailing list
> >> >
> >>
>
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> >> > To unsubscribe, send any mail to
> >> > "freebsd-questions-unsubscribe at freebsd.org"
> >> >
> >>
> >> if the system runs with one cpu now and you don't
> >> enable smp with HT with the sysctl variable then
> you
> >> should be ok. If your not doing SMP then
> recompiling
> >> the kernel for single processor mode will make
> things
> >> run a little quicker because the SMP code won't
> come
> >> into play.
> >>
> >> with HT disabling in FreeBSD is more for the
> security
> >> issues about a potential exploit whereby one
> process
> >> in one pipe can access the priveledged
> information of
> >> a process in another pipe because the two cores
> share
> >> one processor cache and thus one cache table. To
> my
> >> knowledge this hasn't been exploited yet.
> >>
> >> If you just install the generic kernel you it
> should
> >> be only the uniprocessor one. I would just do a:
> >>
> >> cd /usr/src && make buildworld && make
> >> KERNCONF=GENERIC buildkernel && make
> KERNCONF=GENERIC
> >> installkernel
> >>
> >> as opposed to a binary version assuming you
> haven't
> >> updated yet you won't have to install world but I
> >> believe it must have the build in the source tree
> to
> >> build a kernel. On your P4 though the difference
> >> between SMP and uniproc may not be worth the
> trouble
> >> because I don't think much of a gain would be
> made. on
> >> a P1 a much different story...
> >>
> >> if you aren't concerned with bad users or hackers
> >> hitting the box I would just enable HT with the
> sysctl
> >> variable. This will not make things run slower at
> all,
> >> just (in theory) less secure, which is why the
> >> veriable was created in the first place as I
> recall.
> >> If you are concerned I would wait until you
> update
> >> your system and then just build a GENERIC/CUSTOM
> >> kernel without the SMP option set.
> >>
> >>
> >> -brian
> >>
> >
> >
> > I will disable smp from bios. If I have a smp
> kernel, I suppose there
> > will
> > be no problem after all. Would that be ok?
> > The problem with having SMP enabled is that the
> smp kernel only
> > detects one
> > cpu and the system monitor only features one cpu
> as well as gkrellm (in
> > Linux it shows two cpus). When compiling the
> system monitor shows the
> > cpu at
> > a maximum of 50%, so what's going on with the
> other 50%?
> > writing machdep.hlt_logical_cpus to 2 in
> loader.conf does not solve
> > anything.
> I believe FreeBSD uses the other logical CPU to
> handle hardware
> interrupts, which can still help performance. You
> can check dmesg to see
> how it's actually handling it.
> 
> -- 
> -- Skylar Thompson (skylar at cs.earlham.edu)
> -- http://www.cs.earlham.edu/~skylar/
> 
> 
> 

While that is one method of hamdling SMP I'm fairly
certain FreeBSD does not use this model. The problem
with one CPU handling interrupts and one handling
processes is if your doing a 9000x9000 element matrix
inversion to calculate say the wave function for
uranium (yeah not right, but this be some nasty math
so bear with me); then even if the math library is
thread aware, one CPU will be frying eggs, and the
other one will be twiddling it's thumbs waiting on
interrupts to process. Most likely an
ACPI_THERMALZONE...

>From memory on my readings of Implementation of
FreeBSD 5.4 ( I think thats the title, but the Black
Book written by the BSD gurus...) It was decided the
SMP scheduler would handle processes and interrupts
simultainiously as scheduled and modified with
affinities to avoid switching which CPU cache has the
running process. This might be why HT is slower
because it only has one CPU cache so trying to keep
things on one core doesn't improve performance at all
because either core can access the cache. Since HT was
not the brightest thing Intel could have done (kind of
like 20-bit addressing...) and since AMD has Dual
cores they need to compete with I don't think tweaking
scheduler code to remove affinities on HT would be in
the works. I don't even know if that would help
either, just thinking out loud.

But Interrupts are handled by both CPUs once the
additional CPUs are launched by the boot CPU via the
kernel. The scheduler is designed to keep all the
pipes in the plant running with process/interuppts.

-brian


More information about the freebsd-questions mailing list