From owner-svn-src-head@freebsd.org Thu Apr 28 09:36:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B28F7B1E1C7; Thu, 28 Apr 2016 09:36:55 +0000 (UTC) (envelope-from fidaj@ukr.net) Received: from frv157.fwdcdn.com (frv157.fwdcdn.com [212.42.77.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78A041179; Thu, 28 Apr 2016 09:36:55 +0000 (UTC) (envelope-from fidaj@ukr.net) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ukr.net; s=fsm; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=w6hCghoSaJBSXiv/bfyWn6Yx1J+rtIqUEh1NLneKQm8=; b=BX9aJ/muzC8SZhq6tqCOzC1cwoeP/M7Rfgd7G7upDECq/sXbZ0coP03B1viwBJs8d/VchPrbF+mydbDpZhpoOxTojsAfghcnSWXjEAWjxVEcskGNsAwzI60eo6sgNgmkEfykaCAdzexx8lL4+WfQkFkMZWTgFFgM8YwdrXMg0UY=; Received: from ns.budzona.com.ua ([195.95.232.193] helo=nonamehost.local) by frv157.fwdcdn.com with esmtpsa ID 1aviNK-000Glo-RK ; Thu, 28 Apr 2016 12:36:46 +0300 Date: Thu, 28 Apr 2016 12:36:46 +0300 From: Ivan Klymenko To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r298736 - head/sys/amd64/amd64 Message-ID: <20160428123646.0993d51d@nonamehost.local> In-Reply-To: <201604280829.u3S8Tvwl045202@repo.freebsd.org> References: <201604280829.u3S8Tvwl045202@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Result: IP=195.95.232.193; mail.from=fidaj@ukr.net; dkim=pass; header.d=ukr.net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2016 09:36:55 -0000 On Thu, 28 Apr 2016 08:29:57 +0000 (UTC) Andriy Gapon wrote: > Author: avg > Date: Thu Apr 28 08:29:57 2016 > New Revision: 298736 > URL: https://svnweb.freebsd.org/changeset/base/298736 > > Log: > ensure that initial local apic id is sane on AMD 10h systems > > Summary: > The Initial Local APIC ID is returned by CPUID function 1 (in EBX). > On AMD Family 10h systems the way that ID is built is controlled by > an MSR bit (InitApicIdCpuIdLo). BKDG instructs BIOS to set it in a > certain way, but a BIOS can be buggy. In that case the ID can > confuse tools that use it, e.g. hwloc. > For example, on a system that I own real Local APIC IDs are > configured as 0, 1, 2, 3, but IDs reported via CPUID.1 are 0, 0x40, > 0x80, 0xc0. See: https://github.com/open-mpi/hwloc/issues/183 > > Reviewed by: kib > MFC after: 2 weeks > Differential Revision: https://reviews.freebsd.org/D6060 > > Modified: > head/sys/amd64/amd64/initcpu.c > > Modified: head/sys/amd64/amd64/initcpu.c > ============================================================================== > --- head/sys/amd64/amd64/initcpu.c Thu Apr 28 06:20:43 > 2016 (r298735) +++ head/sys/amd64/amd64/initcpu.c Thu > Apr 28 08:29:57 2016 (r298736) @@ -80,6 +80,19 @@ > init_amd(void) wrmsr(0xc0011029, rdmsr(0xc0011029) | 1); > break; > } > + > + /* > + * BIOS may fail to set InitApicIdCpuIdLo to 1 as it should > per BKDG. > + * So, do it here or otherwise some tools could be confused > by > + * Initial Local APIC ID reported with CPUID Function 1 in > EBX. > + */ > + if (CPUID_TO_FAMILY(cpu_id) == 0x10) { > + if ((cpu_feature2 & CPUID2_HV) == 0) { > + msr = rdmsr(MSR_NB_CFG1); > + msr |= (uint64_t)1 << 54; > + wrmsr(MSR_NB_CFG1, msr); > + } > + } > } > > /* > _______________________________________________ ... --- initcpu.o --- /usr/src/sys/amd64/amd64/initcpu.c:91:4: error: use of undeclared identifier 'msr' msr = rdmsr(MSR_NB_CFG1); ^ /usr/src/sys/amd64/amd64/initcpu.c:92:4: error: use of undeclared identifier 'msr' msr |= (uint64_t)1 << 54; ^ /usr/src/sys/amd64/amd64/initcpu.c:93:23: error: use of undeclared identifier 'msr' wrmsr(MSR_NB_CFG1, msr); ^ 3 errors generated. *** [initcpu.o] Error code 1 make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11 1 error make[2]: stopped in /media/da0s1/obj/usr/src/sys/mk11 *** [buildkernel] Error code 2 make[1]: stopped in /usr/src 1 error make[1]: stopped in /usr/src *** [buildkernel] Error code 2 make: stopped in /usr/src 1 error make: stopped in /usr/src