Date: Tue, 07 Jan 2003 20:44:33 -0500 (EST) From: John Baldwin <jhb@FreeBSD.org> To: John Baldwin <jhb@FreeBSD.org> Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: RE: cvs commit: src/sys/i386/i386 mp_machdep.c Message-ID: <XFMail.20030107204433.jhb@FreeBSD.org> In-Reply-To: <200301080133.h081XI8W028546@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 08-Jan-2003 John Baldwin wrote:
> jhb 2003/01/07 17:33:18 PST
>
> Modified files:
> sys/i386/i386 mp_machdep.c
> Log:
> Enumerate logical hyperthread CPUs manually if they aren't already listed
> in the mptable. The way this works is that we determine if the system
> has hyperthreading and how many logical CPU's should be in each physical
> CPU by using the information returned by cpuid. During the first pass of
> the mptable, we build a bitmask of the APIC IDs of the CPUs listed in the
> mptable. We then scan that bitmask to see if the CPUs are already listed
> by the mptable, or if there are any APIC IDs already in use that would
> conflict with the APIC IDs of the logical CPUs. If that test succeeds,
> then we fixup the count of application processors. Later on during the
> second pass of the mptable we create fake processor entries for logical
> CPUs and add them to the system.
>
> We only need this type of fixup hack when using the mptable to enumerate
> CPUs. The ACPI MADT table properly enumerates all logical CPUs.
Some dmesg excerpts from a machine with one CPU with 2 logical CPUs looks
something like this:
Copyright (c) 1992-2003 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 5.0-CURRENT #20: Tue Jan 7 17:35:34 EST 2003
john@kavik.baldwin.cx:/home/john/work/p4/htt/i386/compile/KAVIK
Preloaded elf kernel "/boot/test/kernel" at 0xc0482000.
Timecounter "i8254" frequency 1193182 Hz
CPU: Pentium 4 (686-class CPU)
Origin = "GenuineIntel"
Features=0xffffffffbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,P
GE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
Hyperthreading: 2 logical CPUs
...
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
cpu0 (BSP): apic id: 0, version: 0x00050014, at 0xfee00000
cpu1 (AP): apic id: 1, version: 0x00050014, at 0xfee00000
io0 (APIC): apic id: 2, version: 0x00178020, at 0xfec00000
...
APIC_IO: Testing 8254 interrupt delivery
APIC_IO: routing 8254 via IOAPIC #0 intpin 2
Timecounters tick every 10.000 msec
...
SMP: AP CPU #1 Launched!
Mounting root from ufs:/dev/ad0s1a
For the time being it mostly looks the same as a 2 CPU SMP system
to the kernel. Eventually we will need to teach the scheduler about
logical CPUs, but that's a bit more complicated. :)
For now I am working on reworking the i386 interrupt code so that
using the local and I/O APICs versus using the traditional PICs is
a runtime decision rather than a compile time decision as well as
fixing the mptable code to route PCI interrupts using the
pcib_route_interrupt() method and adding support for enumerating
APICs and CPUs via ACPI. The goal is to put SMP into GENERIC on
i386 to support SMP out of the box and obsolete /sys/i386/conf/SMP.
--
John Baldwin <jhb@FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030107204433.jhb>
