From owner-freebsd-stable@FreeBSD.ORG Sat Aug 28 20:35:59 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 10F6110656A6; Sat, 28 Aug 2010 20:35:59 +0000 (UTC) (envelope-from avg@freebsd.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 1D63F8FC15; Sat, 28 Aug 2010 20:35:57 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA09840; Sat, 28 Aug 2010 23:28:49 +0300 (EEST) (envelope-from avg@freebsd.org) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OpS1B-0007yq-Cw; Sat, 28 Aug 2010 23:28:49 +0300 Message-ID: <4C797180.5000905@freebsd.org> Date: Sat, 28 Aug 2010 23:28:48 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.8) Gecko/20100822 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Jung-uk Kim , freebsd-stable@freebsd.org References: <201007141414.o6EEEUx9014690@lurza.secnetix.de> <4C782D3B.6020407@icyb.net.ua> <201008271743.29393.jkim@FreeBSD.org> <4C7835E6.6070309@icyb.net.ua> <4C797023.8020206@freebsd.org> In-Reply-To: <4C797023.8020206@freebsd.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: pluknet 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: Sat, 28 Aug 2010 20:35:59 -0000 Oops, the patch had a small mistake. I've put it here now, just in case I'll want to fix/cleanup anything else: http://people.freebsd.org/~avg/intel-cpu-topo.diff on 28/08/2010 23:22 Andriy Gapon said the following: > So, here is my take on the problem. > The attached patch is against sources in FreeBSD tree, it should be applied > either to sys/amd64/amd64/mp_machdep.c or sys/i386/i386/mp_machdep.c depending > on the desired architecture. > > The patch is substantially based on the Junk-uk's patch, but with some changes > and additions: > - topo_probo_0x4() is rewritten so that it does APIC ID matching against masks > as described in the Intel article. The code still heavily depends on the > assumption of the uniform topology, it discovers number of cores in BSP package > and number of threads in BSP core and extrapolates that to global topology. > The difference with current code and Junk-uk's patch is that actual APIC ID > matching is done as opposed to deriving counts purely from max. values. > > - added a few comments that describe uniformity assumption, plus couple other > useful things. > > - changed "final fallback" code, so that each logical CPU is considered to be in > its own physical package as opposed to current code placing all logical CPUs as > cores of a single package. > > The rest is Junk-uk's work. > > Concerns: > - about my code: ilog2_round_pow2 name is ugly; looking for suggestions on a > better name or re-arranging/writing that code, so that the function is not needed. > - about current code: logical_cpus variable (don't confuse with cpu_logical) > doesn't seem to be consistently used; e.g. it is not set at all by > topo_probo_0xb(); also, the method of using it for setting logical_cpus_mask > doesn't seem to be reliable - BSP may be missed. > > Reviews, comments and test reports are very welcome! > Please test the patch if you have any problems with how CPU topology is reported > by the current code. Please test even if everything is OK, to avoid regressions. -- Andriy Gapon