From owner-freebsd-stable@FreeBSD.ORG Thu Jul 15 18:45:54 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 ACB78106567D; Thu, 15 Jul 2010 18:45:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 7CD0E8FC1E; Thu, 15 Jul 2010 18:45:54 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 2B84B46B35; Thu, 15 Jul 2010 14:45:54 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 4CD378A04F; Thu, 15 Jul 2010 14:45:53 -0400 (EDT) From: John Baldwin To: freebsd-stable@freebsd.org Date: Thu, 15 Jul 2010 14:32:24 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100217; KDE/4.4.5; amd64; ; ) References: <201007151657.o6FGv97V080710@lurza.secnetix.de> <4C3F4BBB.30606@icyb.net.ua> In-Reply-To: <4C3F4BBB.30606@icyb.net.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201007151432.25052.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 15 Jul 2010 14:45:53 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Oliver Fromme , Andriy Gapon , jkim@freebsd.org 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 18:45:54 -0000 On Thursday, July 15, 2010 1:56:11 pm Andriy Gapon wrote: > on 15/07/2010 19:57 Oliver Fromme said the following: > > 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) > > Thank you for debugging this issue! > Not sure if this is the best patch that there can be, but its direction is > definitely correct. > As the Intel document says (translated to our x86 mp_machdep.c terms): > if cpu_high >= 0xb then we should execute cpuid_count(0xb, 0, p) and examine EBX > value (p[1]), only if it's non-zero should we proceed with topo_probe_0xb(), > otherwise we should fall back to topo_probe_0x4, etc. > > I think that your addition achieves this effect, perhaps just not as explicitly as > I would preferred. Maybe have topo_probe_0xb() explicitly call topo_probe_0x4() if EBX is 0? -- John Baldwin