From owner-freebsd-stable@FreeBSD.ORG Thu Jul 15 16:57:27 2010 Return-Path: Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6989106566B; Thu, 15 Jul 2010 16:57:27 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 27B0F8FC0A; Thu, 15 Jul 2010 16:57:26 +0000 (UTC) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.3/8.14.3) with ESMTP id o6FGv9u1080711; Thu, 15 Jul 2010 18:57:25 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.3/8.14.3/Submit) id o6FGv97V080710; Thu, 15 Jul 2010 18:57:09 +0200 (CEST) (envelope-from olli) Date: Thu, 15 Jul 2010 18:57:09 +0200 (CEST) Message-Id: <201007151657.o6FGv97V080710@lurza.secnetix.de> From: Oliver Fromme To: freebsd-stable@FreeBSD.ORG, avg@icyb.net.ua, jkim@FreeBSD.ORG In-Reply-To: <4C3F0149.1070500@icyb.net.ua> X-Newsgroups: list.freebsd-stable User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.4-PRERELEASE-20080904 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.4 (lurza.secnetix.de [127.0.0.1]); Thu, 15 Jul 2010 18:57:25 +0200 (CEST) Cc: Subject: Re: 8.1-PRERELEASE: CPU packages not detected correctly X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2010 16:57:27 -0000 Andriy Gapon wrote: > on 15/07/2010 15:27 Oliver Fromme said the following: > > Unfortunately, it didn't change. Kernel output during boot > > is still the same; it displays 1 package x 8 cores. > > If you are sure that everything is done correctly (patch really applied, kernel > really rebuilt and reinstalled, and reboot was to the new kernel), then perhaps > jkim would be interested in this issue. Yes, I'm sure, I even added some printf() so I can be sure that the patched code is actually executed. Here is what happens in sys/amd64/amd64/mp_machdep.c: In topo_probe(), cpu_high is 0xd, so topo_probe_0xb() is called. But the cpuid 0xb instruction doesn't seem to return useful data: All values are zero already in the first level, so cpu_cores remains 0. Back in topo_probe(), there is a fallback if cpu_cores is stil 0: It assigns mp_ncpu to cpu_cores, so it gets 8 which is wrong. I patched topo_probe() so it calls topo_probe_0x4() after topo_probe_0xb() if cpu_cores is still 0. I think this is a better fallback procedure. With this patch, cpu_cores gets the value 4 which is the correct one, finally: FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs FreeBSD/SMP: 2 package(s) x 4 core(s) This is the patch, it's against jkim's patched version: @@ -265,7 +268,7 @@ else if (cpu_vendor_id == CPU_VENDOR_INTEL) { if (cpu_high >= 0xb) topo_probe_0xb(); - else if (cpu_high >= 0x4) + if (cpu_high >= 0x4 && cpu_cores == 0) topo_probe_0x4(); } if (cpu_cores == 0) Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "With sufficient thrust, pigs fly just fine. However, this is not necessarily a good idea. It is hard to be sure where they are going to land, and it could be dangerous sitting under them as they fly overhead." -- RFC 1925