From owner-freebsd-stable@FreeBSD.ORG Fri Jul 16 11:14:31 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 84D8D1065675 for ; Fri, 16 Jul 2010 11:14:31 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id E35598FC1B for ; Fri, 16 Jul 2010 11:14:30 +0000 (UTC) Received: by wyf22 with SMTP id 22so1964718wyf.13 for ; Fri, 16 Jul 2010 04:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=AHQRacwMmc/LlHig0RdHRi3M5opOjK4Zx5yplfXk8Gs=; b=fnTzjucZ5zqAb4BPRTW1Mt4PgsNVk6WwZeuFVhn8NuRJtNsyQf45VV/vlWPB4WNRom ymwFmMM6FhzLNiNA6Bf5aK7Txn+g2+WN+reyLPbcffKYaBnMVsdUQU++XVl1zpmmKDSp KiNtCWLjByHFA/NuHT16iqTQQn6MpvieT/0YU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=f4wXOEC311OE26W/zJ+32bVv1CGm9fo3XDJeXbyRx72c3PhJ9U269Yhf7RcfG58AWV FqslLQL7pM2IkfC639/y0Ad/oppUydHTdWfi7HwhGrRg9zjQBkgNm4M8lx7q6WCNcERq uk5V9eJKF2YzFQMqj/Kqwczb7l/hzhXAgysEk= MIME-Version: 1.0 Received: by 10.227.136.17 with SMTP id p17mr804069wbt.54.1279278869331; Fri, 16 Jul 2010 04:14:29 -0700 (PDT) Received: by 10.216.137.23 with HTTP; Fri, 16 Jul 2010 04:14:29 -0700 (PDT) In-Reply-To: <201007151518.17012.jkim@FreeBSD.org> References: <201007151657.o6FGv97V080710@lurza.secnetix.de> <4C3F4BBB.30606@icyb.net.ua> <201007151507.33998.jkim@FreeBSD.org> <201007151518.17012.jkim@FreeBSD.org> Date: Fri, 16 Jul 2010 15:14:29 +0400 Message-ID: From: pluknet To: Jung-uk Kim Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Oliver Fromme , freebsd-stable@freebsd.org, Andriy Gapon 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: Fri, 16 Jul 2010 11:14:31 -0000 On 15 July 2010 23:18, Jung-uk Kim wrote: > On Thursday 15 July 2010 03:07 pm, Jung-uk Kim wrote: >> On Thursday 15 July 2010 01:56 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. =A0But the cpuid 0xb instruction doesn't seem to >> > > return useful data: =A0All 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: =A0It 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. =A0I think this >> > > is a better fallback procedure. =A0With 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 >=3D 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. >> > >> > Jung-uk, what do you think? >> >> Yes, you're right. =A0Please try new patch: >> >> http://people.freebsd.org/~jkim/mp_machdep2.diff > > I uploaded the patch again, it's compile-tested this now. > Just tried with the patch against 8.1-rc2. 2x E5520 - OK, no changes FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 SMT threads 2x E5440 - now OK FreeBSD/SMP: Multiprocessor System Detected: 8 CPUs FreeBSD/SMP: 2 package(s) x 4 core(s) 1x 5050 - OK, no changes FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 HTT threads --=20 wbr, pluknet