From owner-cvs-all Tue Jan 7 17:44:33 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7288237B405 for ; Tue, 7 Jan 2003 17:44:29 -0800 (PST) Received: from mail.speakeasy.net (mail15.speakeasy.net [216.254.0.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 628A743ED4 for ; Tue, 7 Jan 2003 17:44:27 -0800 (PST) (envelope-from jhb@FreeBSD.org) Received: (qmail 31141 invoked from network); 8 Jan 2003 01:44:37 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail15.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 8 Jan 2003 01:44:37 -0000 Received: from laptop.baldwin.cx (laptop.baldwin.cx [192.168.0.4]) by server.baldwin.cx (8.12.6/8.12.6) with ESMTP id h081iPUT081655; Tue, 7 Jan 2003 20:44:25 -0500 (EST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <200301080133.h081XI8W028546@repoman.freebsd.org> Date: Tue, 07 Jan 2003 20:44:33 -0500 (EST) From: John Baldwin To: John Baldwin Subject: RE: cvs commit: src/sys/i386/i386 mp_machdep.c Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 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 <>< 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